Python Template

v1.0.0Developer Toolsstable

This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.

aicodeassistantaicodingmcpmcp-servermodel-context-protocol
Share:
17
Stars
0
Downloads
0
Weekly
0/5

What is Python Template?

Python Template is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to this template provides a streamlined foundation for building model context protocol (mcp) servers in python. it's designed to make ai-assisted development of mcp tools easier and more efficient.

This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • This template provides a streamlined foundation for building

Use Cases

Build MCP servers in Python with a streamlined foundation.
Create AI-assisted MCP tools and integrations efficiently.
sontallive

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMar 31, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx python-template

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Python Template

Python Template MCP Server is a ready-to-use project scaffold for building Model Context Protocol servers in Python, designed to make AI-assisted MCP development faster and more accurate. It bundles the complete MCP specification, the Python SDK reference, and a working weather service example directly in the project so AI coding tools have all the context they need without external lookups. The template supports both stdio transport for local CLI tools and SSE transport for web-accessible servers, and is built around the FastMCP high-level API from the official MCP Python SDK.

Prerequisites

  • Python 3.12 or later
  • uv or pip for package management
  • Git to clone the template repository
  • An MCP-compatible client such as Claude Desktop for testing your built server
1

Clone the template repository

Clone the mcp-server-python-template repository as the starting point for your new MCP server project.

git clone https://github.com/sontallive/mcp-server-python-template.git my-mcp-server
cd my-mcp-server
2

Create a virtual environment and install dependencies

Set up an isolated Python environment and install the required packages including the mcp SDK, httpx, starlette, and uvicorn.

python -m venv .venv
source .venv/bin/activate
pip install -e .
3

Run the included example server

Start the bundled weather service example to confirm the template works correctly before customizing it.

python server.py --transport stdio
4

Define your own MCP tools

Open server.py and replace or extend the example tools using the @mcp.tool() decorator. Each decorated function becomes a callable tool that AI clients can discover and invoke.

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("my-namespace")

@mcp.tool()
async def my_tool(query: str) -> str:
    """
    Describe what this tool does.

    Args:
        query: The input query

    Returns:
        The result string
    """
    return f"Result for: {query}"

if __name__ == "__main__":
    mcp.run(transport='stdio')
5

Add your server to Claude Desktop for testing

Register your custom server with Claude Desktop using the absolute path to your server.py file and your virtual environment's Python binary.

{
  "mcpServers": {
    "my-mcp-server": {
      "command": "/path/to/my-mcp-server/.venv/bin/python",
      "args": ["/path/to/my-mcp-server/server.py", "--transport", "stdio"]
    }
  }
}

Python Template Examples

Client configuration

Claude Desktop configuration for a server built from the Python Template, using the venv Python binary.

{
  "mcpServers": {
    "my-mcp-server": {
      "command": "/Users/yourname/my-mcp-server/.venv/bin/python",
      "args": ["/Users/yourname/my-mcp-server/server.py", "--transport", "stdio"]
    }
  }
}

Prompts to try

Once your custom tools are defined and the server is registered, Claude can invoke them by name.

- "Use the my_tool function to look up information about Python async patterns"
- "What tools does this MCP server expose?"
- "Run the example weather tool to get the forecast for New York"
- "Call my custom tool with the query 'database indexing best practices'"

Troubleshooting Python Template

ImportError for mcp module when running server.py

Make sure your virtual environment is activated and you ran 'pip install -e .' from the project root. The mcp package requires Python 3.12+, so check your version with 'python --version'.

Claude Desktop does not detect any tools from the server

Verify the command path in claude_desktop_config.json points to the Python binary inside the .venv directory, not the system Python. Use the absolute path to both the binary and server.py.

SSE transport mode does not start or is unreachable

When running with --transport sse, the server listens on the host and port you specify (default 0.0.0.0:8080). Make sure no firewall is blocking that port and that uvicorn is installed as part of the dependencies.

Frequently Asked Questions about Python Template

What is Python Template?

Python Template is a Model Context Protocol (MCP) server that this template provides a streamlined foundation for building model context protocol (mcp) servers in python. it's designed to make ai-assisted development of mcp tools easier and more efficient. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Python Template?

Follow the installation instructions on the Python Template GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Python Template?

Python Template works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Python Template free to use?

Yes, Python Template is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "python-template": { "command": "npx", "args": ["-y", "python-template"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Python Template?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides