This repository provides an example of using the Model Context Protocol with a single tool, resource, and prompt, showcasing installation and usage of both the MCP server and client for interaction.
This example illustrates the usage of the Model Context Protocol (MCP) with a simplified setup involving a single tool, resource, and prompt.
To set up the environment:
pip install uv
uv init
uv venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # Mac/Linux
uv add mcp[cli] # Option-1
# or
uv add -r requirements.txt # Option-2
This involves installing uv
, initializing a virtual environment, activating it, and then installing the mcp[cli]
package or packages from requirements.txt
.
To start the MCP server:
# Server
mcp dev server.py
# Need to install the following packages:
# @modelcontextprotocol/[email protected]
# Ok to proceed? (y) y
The MCP server can be accessed via the inspector at http://localhost:5173/ after installing the @modelcontextprotocol/inspector
package.
The client.py
file is used to interact with the MCP server.
python client.py
buraketmen/mcp-example
February 26, 2025
March 23, 2025
Python