Python MCP Server Starter Template

by ltwlf

156 downloads Not rated yet MIT license
GitHub

About

Opinionated starter kit for building Model-Context-Protocol (MCP) server in Python — clean project scaffold, typed code, VS Code debug config, Docker & GitHub Actions ready out-of-the-box

Details

License
MIT license

Explore

- Implements an MCP server using the mcp Python SDK (FastMCP).
- Exposes MCP Tools (functions callable by LLMs) and Resources (data accessible by LLMs).
- Clean, modular architecture
- Easy tool and resource registration
- Command-line interface with customizable options
- Ready for production deployment
- Built-in debug capabilities using debugpy with VS Code integration
- Development tools configured (using uv for environment/package management)
- Docker support for containerized deployment

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Python MCP Server Starter Template
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Python 3.10 or higher
- uv (Recommended for environment and package management)
- MCP Inspector (Recommended visual tool for testing/debugging MCP servers)
- [Optional] Git
- [Optional] Docker for containerized deployment

uv venv

.venv\Scripts\Activate.ps1

You can run the server directly using uv run or the mcp CLI tool provided by the SDK. This allows testing with tools like the MCP Inspector.

Update the Dockerfile and docker-compose.yml to reflect your renamed project/package before building.

```bash

Add new tools using the @mcp.tool() decorator in your_package_name/server.py:


@mcp.tool()
async def my_new_tool(param1: str, param2: int, ctx: Context) -> dict:
"""
Description of what your tool does.
Use the ctx object to report progress, log info, or read resources.
"""
ctx.info(f"Running my_new_tool with {param1=}, {param2=}")

result = f"Processed {param1} {param2} times"
await ctx.report_progress(1, 1) # Example progress
return {"result": result}

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "python mcp server starter template": {
            "python-mcp-starter": {
                "command": "uv",
                "args": [
                    "venv"
                ]
            }
        }
    }
}

McpServers

{
    "python-mcp-starter": {
        "command": "uv",
        "args": [
            "venv"
        ]
    }
}
A template repository for creating Python applications using the Model Context Protocol (MCP) and the MCP Python SDK.

Features

- Implements an MCP server using the mcp Python SDK (FastMCP). - Exposes MCP Tools (functions callable by LLMs) and Resources (data accessible by LLMs). - Clean, modular architecture - Easy tool and resource registration - Command-line interface with customizable options - Ready for production deployment - Built-in debug capabilities using debugpy with VS Code integration - Development tools configured (using uv for environment/package management) - Docker support for containerized deployment

Getting Started

Prerequisites

- Python 3.10 or higher - uv (Recommended for environment and package management) - MCP Inspector (Recommended visual tool for testing/debugging MCP servers) - [Optional] Git - [Optional] Docker for containerized deployment

Installation

1. Clone or Use as Template: Get the code. ``shell git clone https://github.com/ltwlf/python-mcp-starter.git your-repo-name # Or use GitHub's "Use this template" button cd your-repo-name ` 2. Rename the Project: Rename the core components: Rename the hello_mcp_server directory to your desired Python package name (e.g., my_awesome_mcp). Search and replace hello-mcp-server (in pyproject.toml, README.md, Dockerfile, docker-compose.yml) with your project name (e.g., my-awesome-mcp). Search and replace hello_mcp_server (in Python import statements like in main.py, tests/test_server.py, pyproject.toml scripts section) with your new package name. Update the APP_ID in your renamed server.py file. * Update .vscode/launch.json configuration file to reflect your new project and package names. 3. Create Virtual Environment: `shell # Create the virtual environment uv venv # Activate the environment (Windows PowerShell) .venv\Scripts\Activate.ps1 # Or for other shells: # source .venv/bin/activate (Linux/macOS) # .venv\Scripts\activate.bat (Windows Command Prompt) ` 4. Install Dependencies: `shell uv pip install -e ".[dev]" `

Running the MCP Server for Development

You can run the server directly using
uv run or the mcp CLI tool provided by the SDK. This allows testing with tools like the MCP Inspector.
In stdio mode (for MCP Inspector)
Method 1: Using
uv run ``powershell
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.