mcpField
M
MCP Python Starter

MCP Python Starter

Local
github.com/SamMorrowDrumsDeveloper Tools19Updated 4w ago

About MCP Python Starter

MCP Python Starter is a Python MCP server template built with FastMCP, demonstrating tools, resources, templates, prompts, sampling and progress updates. It is intended as a starting point for new MCP servers.

Key features

  1. 01Examples of tools, resources, templates and prompts
  2. 02Decorator-based definitions using FastMCP
  3. 03Supports both stdio and HTTP transports
  4. 04MCP Inspector integration for debugging
  5. 05VS Code configuration and DevContainer setup

Use cases

  1. 01Using as a starting template for a new Python MCP server
  2. 02Learning annotations, progress updates and sampling in FastMCP
  3. 03Debugging tools and resources with MCP Inspector

MCP support

This is an MCP server template that exposes tools such as hello, get_weather and ask_llm, along with resources, resource templates and prompts, to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP Python Starter

CI Python Ruff License: MIT MCP

A feature-complete Model Context Protocol (MCP) server template in Python using FastMCP. This starter demonstrates all major MCP features with clean, Pythonic code.

📚 Documentation

✨ Features

CategoryFeatureDescription
ToolshelloBasic tool with annotations
get_weatherTool returning structured data
ask_llmTool that invokes LLM sampling
long_taskTool with 5-second progress updates
load_bonus_toolDynamically loads a new tool
Resourcesinfo://aboutStatic informational resource
file://example.mdFile-based markdown resource
Templatesgreeting://{name}Personalized greeting
data://items/{id}Data lookup by ID
PromptsgreetGreeting in various styles
code_reviewCode review with focus areas

🚀 Quick Start

Prerequisites
Installation
# Clone the repository
git clone https://github.com/SamMorrowDrums/mcp-python-starter.git
cd mcp-python-starter

# Install with uv (recommended)
uv sync

# Or with pip
pip install -e .
Running the Server

stdio transport (for local development):

uv run mcp-python-starter --stdio

HTTP transport (for remote/web deployment):

uv run mcp-python-starter --http --port 3000

🔧 VS Code Integration

This project includes VS Code configuration for seamless development:

  1. Open the project in VS Code
  2. The MCP configuration is in .vscode/mcp.json
  3. Test the server using VS Code's MCP tools
Using DevContainers
  1. Install the Dev Containers extension
  2. Open command palette: "Dev Containers: Reopen in Container"
  3. Everything is pre-configured and ready to use!

📁 Project Structure

.
├── mcp_starter/
│   ├── __init__.py
│   ├── tools.py       # Tool definitions (hello, get_weather, ask_llm, etc.)
│   ├── resources.py   # Resource and template definitions
│   ├── prompts.py     # Prompt definitions
│   └── server.py      # Server orchestration (imports and wires modules)
├── .vscode/
│   ├── mcp.json       # MCP server configuration
│   ├── settings.json  # Python settings
│   └── extensions.json
├── .devcontainer/
│   └── devcontainer.json
├── pyproject.toml     # Project configuration (uv/pip, Ruff config)
└── .python-version

🛠️ Development

# Run the server (Python reloads automatically on changes)
uv run mcp-python-starter --stdio

# Use MCP Inspector for debugging
uv run mcp dev mcp_starter/server.py

# Format code
uv run ruff format .

# Lint
uv run ruff check .

# Lint with auto-fix
uv run ruff check --fix .

# Type check
uv run pyright
Live Reload

Python scripts reload automatically when run with uv run. For enhanced debugging, use mcp dev which provides the MCP Inspector UI.

🔍 MCP Inspector

The MCP Inspector is an essential development tool for testing and debugging MCP servers.

Running Inspector
npx @modelcontextprotocol/inspector -- uv run mcp-python-starter
What Inspector Provides
  • Tools Tab: List and invoke all registered tools with parameters
  • Resources Tab: Browse and read resources and templates
  • Prompts Tab: View and test prompt templates
  • Logs Tab: See JSON-RPC messages between client and server
  • Schema Validation: Verify tool input/output schemas
Debugging Tips
  1. Start Inspector before connecting your IDE/client
  2. Use the "Logs" tab to see exact request/response payloads
  3. Test tool annotations (ToolAnnotations) are exposed correctly
  4. Verify progress notifications appear for long_task
  5. Check that Context injection works for sampling tools

📖 Feature Examples

Tool with Annotations (FastMCP decorator)
@mcp.tool(
    title="Say Hello",
    description="A friendly greeting tool",
    annotations={"readOnlyHint": True},
)
def hello(name: str) -> str:
    """Say hello to someone.
    
    Args:
        name: The name to greet
    """
    return f"Hello, {name}!"
Resource Template
@mcp.resource("greeting://{name}")
def greeting_template(name: str) -> str:
    """Generate a personalized greeting."""
    return f"Hello, {name}!"
Tool with Progress Updates
@mcp.tool(title="Long Task")
async def long_task(
    task_name: str,
    ctx: Context[ServerSession, None],
) -> str:
    for i in range(5):
        await ctx.report_progress(
            progress=i / 5,
            total=1.0,
            message=f"Step {i + 1}/5",
        )
        await asyncio.sleep(1.0)
    return "Done!"
Tool with Sampling
@mcp.tool(title="Ask LLM")
async def ask_llm(
    prompt: str,
    ctx: Context[ServerSession, None],
) -> str:
    result = await ctx.session.create_message(
        messages=[{"role": "user", "content": {"type": "text", "text": prompt}}],
        max_tokens=100,
    )
    return result.content.text

🔐 Environment Variables

Copy .env.example to .env and configure:

cp .env.example .env

🤝 Contributing

Contributions welcome! Please ensure your changes maintain feature parity with other language starters.

📄 License

MIT License - see LICENSE for details.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.