A minimal Model Context Protocol (MCP) server template. Clone this to build your own MCP server.
server.py- A basic MCP server with one example toolrequirements.txt- Python dependencies- This README
git clone https://github.com/YOUR-USERNAME/mcp-template.git
cd mcp-templatepip install -r requirements.txtpython server.pyThe server runs and waits for input from Claude Desktop.
Edit your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"simple-server": {
"command": "python",
"args": ["/absolute/path/to/mcp-template/server.py"]
}
}
}Replace /absolute/path/to/mcp-template/ with the actual path.
Quit and restart Claude Desktop. Your MCP server will now be available.
Edit server.py and add new tools in the list_tools() function:
@server.list_tools()
async def list_tools() -> list[Tool]:
return [
Tool(
name="your_tool_name",
description="What your tool does",
inputSchema={
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Parameter description"
}
},
"required": ["param1"]
}
)
]Add your logic in the call_tool() function:
@server.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
if name == "your_tool_name":
# Your logic here
result = do_something(arguments.get("param1"))
return [TextContent(type="text", text=result)]Import what you need and call it from your tool handlers:
import requests
@server.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
if name == "fetch_data":
response = requests.get("https://api.example.com/data")
return [TextContent(type="text", text=response.text)]- MCP Documentation
- Anthropic MCP Course
- awesome-mcp-servers - More examples
MIT - Use this however you want.