This is a basic example of a Model Context Protocol (MCP) server implementation that demonstrates core functionality including tools and resources.
- Initialize the project (Go to any local folder and launch powershell or cmd):
uv init mcp-server-basic
cd mcp-server-basic uv venv
.venv\Scripts\activate- Install dependencies:
uv add "mcp[cli]"or
uv add -r requirements.txtThe server implements the following features:
add(a: int, b: int): Adds two numberssubtract(a: int, b: int): Subtracts second number from first
greeting://{name}: Returns a personalized greeting
To run the server with the MCP Inspector for development:
uv run mcp dev main.pyTo run the server normally:
uv run mcp runTo install the server in Claude desktop app:
uv run mcp install main.py- Open folder/mcp-server-basic in vs code
- open terminal and run below command :
uv run main.py- Click Cntrl+Shift+I to launch chat in vs code
- Do login with Github and setup
main.py: Main server implementation with tools and resourcespyproject.toml: Project configuration and dependencies
- make sure your docker desktop is already installed in your system
- run this command in your terminal "docker build -t mcp-server ." to push the mcp server in docker desktop
- "docker run -p [your running port no]:[your running port no] mcp-server"to run the server in docker desktop