Python MCP Server Blueprint
A blueprint for building Python MCP servers using FastMCP, with uv for dependency management and ruff for code quality, enabling rapid development of MCP tools, resources, and prompts.
README
Python MCP Server Blueprint
uv と ruff を使用した、Python製 Model Context Protocol (MCP) サーバーのテンプレートプロジェクト。
フレームワークとして、Anthropic公式の直感的な高レベルAPIである FastMCP を採用している。
機能・特徴
- FastMCP: 最小限のコードで MCP Tool, Resource, Prompt を定義可能。
- uv: 高速なパッケージマネージャーによる依存関係管理と仮想環境構築。
- ruff: 超高速なリンター&フォーマッターによるコード品質管理。
開発の準備
1. 依存関係のインストール
プロジェクトルートディレクトリで以下のコマンドを実行し、仮想環境の構築と依存関係の同期を行う。
uv sync
コード品質の維持 (Ruff)
コードの静的解析 (Lint)
uv run ruff check .
自動修正を実行する場合:
uv run ruff check --fix .
コードのフォーマット
uv run ruff format .
サーバーの起動
標準入出力 (stdio) モードでサーバーを起動する。
uv run python-mcp-server
ビルドとクリーンアップ
パッケージのビルド
配布用パッケージ(WheelおよびSdist)をビルドする。
uv build
プロジェクトのクリーンアップ
ビルド生成物(dist/, build/)、パッケージ情報(*.egg-info)、キャッシュファイル(__pycache__, .ruff_cache)を削除する。
uv run clean-project
MCP クライアントへの登録例 (Claude Desktop)
Claude Desktop でこのサーバーを動作させるには、設定ファイル(通常は %APPDATA%\Claude\claude_desktop_config.json)に以下のように登録する。
{
"mcpServers": {
"python-mcp-server-blueprint": {
"command": "uv",
"args": [
"--directory",
"D:\\Sources\\python_mcp_server_blueprint",
"run",
"python-mcp-server"
]
}
}
}
[!IMPORTANT]
D:\\Sources\\python_mcp_server_blueprintの部分は、実際のプロジェクトの絶対パスに合わせて修正すること。また、Windowsのパス区切り文字は\\にエスケープする必要がある。
Docker / nerdctl での実行
プロジェクトをコンテナイメージとしてビルドし、実行することができる。
1. イメージのビルド
nerdctl build -t python-mcp-server-blueprint .
2. コンテナの起動
標準入出力 (stdio) モードで起動する場合
標準入出力の対話が必要なため、インタラクティブモード(-i)を有効にして起動する。
nerdctl run -i --rm python-mcp-server-blueprint
SSE (HTTP) モードで起動する場合
ポート 8000 をフォワードし、ホストを 0.0.0.0 に指定して起動する。
nerdctl run -d -p 8000:8000 --name mcp-server python-mcp-server-blueprint --transport sse --host 0.0.0.0
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.