olohmann/template-python-mcp-server
If you are the rightful owner of template-python-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This document provides a comprehensive overview of a Python Model Context Protocol (MCP) server template, designed to facilitate the development of MCP servers using the fastmcp library.
README
This is a template for a Python MCP (Model Context Protocol) server based on the fastmcp library. It is optimized for VS Code setups with GitHub Copilot.
Getting Started
To get started with this template, clone the repository and replace all occurrences of TODO-TEMPLATE
with your own values and start implementing your MCP server in .
# Shallow clone the repository
git clone --depth 1 --single-branch https://github.com/olohmann/template-python-mcp-server.git my-mcp-server
# Change into the project directory
cd my-mcp-server
# Remove the .git directory to start fresh
rm -rf .git
# Initialize a new git repository
git init
# Find all TODO-TEMPLATE occurrences in the repository and replace them
# First, see what will be changed
grep -rn "TODO-TEMPLATE" . --exclude=README.md
# Then replace automatically in all files
grep -rl "YEAR-TODO-TEMPLATE" . --exclude=README.md | xargs sed -i '' 's/YEAR-TODO-TEMPLATE/2025/g'
grep -rl "AUTHOR-TODO-TEMPLATE" . --exclude=README.md | xargs sed -i '' 's/YEAR-TODO-TEMPLATE/Name/g'
grep -rl "TODO-TEMPLATE" . --exclude=README.md | xargs sed -i '' 's/TODO-TEMPLATE/my-mcp-server/g'
# Finally, update the README.md
vi README.md
File Structure
File/Directory | Purpose |
---|---|
Main MCP server implementation using FastMCP with example tools | |
Project configuration, dependencies, and tool settings (Ruff) | |
Locked dependency versions for reproducible builds | |
Container configuration for deployment | |
Project documentation and usage instructions | |
MIT license file | |
Git ignore patterns for Python projects | |
Cross-editor code formatting configuration | |
GitHub-specific configuration and workflows | |
└── | Coding guidelines for GitHub Copilot |
└── | GitHub Actions CI/CD workflows |
VS Code workspace configuration | |
└── | VS Code editor settings |
└── | VS Code build and test tasks |
└── | Recommended VS Code extensions |
Managing Dependencies
This template uses uv to manage dependencies.
License
This project is licensed under the MIT License - see the file for details.