Python MCP Server Template
py-mcp-server-テンプレート
このリポジトリは、Pythonで独自のMCP(モデルコンテキストプロトコル)サーバーを作成するのに役立つテンプレートです。始めるには、このリポジトリをフォークしてください。
UVを使ったセットアップ
このプロジェクトでは、Pythonのパッケージングと仮想環境の管理にuvを使用しています。UV uvインストールされていない場合は、公式のUVインストールガイドを参照してください。
フォークしたリポジトリをクローンします。
git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git cd YOUR_REPOSITORY_NAME**仮想環境を作成してアクティブ化します。**通常、
uvプロジェクト ルートに.venvディレクトリを作成します。uv venv source .venv/bin/activate # On macOS/Linux # .venv\Scripts\activate # On Windows**依存関係のインストール:**このプロジェクトは、依存関係を管理するために
pyproject.tomlを使用します。uv pip install .新しい依存関係を追加する場合は、
pyproject.tomlファイルで定義し、このコマンドを再度実行してください。何らかの理由でrequirements.txtファイルを使用している場合は、uv pip install -r requirements.txtでインストールできます。
Related MCP server: mcp-framework-starter
サーバーの実行
mcp_server.pyスクリプトは MCP サーバーを起動します。
サーバーを直接実行するには:
uv run python mcp_server.pyClaude DesktopまたはCursorとの統合
このMCPサーバーをClaude DesktopやCursorなどのアプリケーションで使用するには、アプリケーションの設定で設定する必要があります。設定には通常、サーバーを実行するコマンドの指定が含まれます。
設定例を以下に示します。/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME /ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAMEシステム上のプロジェクトディレクトリへの実際の絶対パスに置き換える必要があります。
{
"mcpServers": {
"my-custom-python-server": {
"command": "uv",
"args": [
"run",
"--python",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/.venv/bin/python",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/mcp_server.py"
],
"workingDirectory": "/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME"
}
}
}構成の説明:
"my-custom-python-server": これはサーバー構成に付ける名前です。"command": "uv": 実行するコマンドとしてuvを指定します。"args":uvコマンドの引数のリスト:"run": 管理対象環境内でコマンドを実行するようにuvに指示します。"--python": 使用するPythonインタープリタを指定します。UVuv環境(.venv/bin/python)内のPythonインタープリタを指定することが重要です。"/ABSOLUTE/PATH/TO/PARENT/FOLDER/YOUR_REPOSITORY_NAME/mcp_server.py": サーバー スクリプトへの絶対パス。
"workingDirectory": サーバー プロセスの作業ディレクトリを指定します。これはプロジェクトのルート ディレクトリである必要があります。
重要:
argsとworkingDirectory内のパスがシステムに対して正しいことを確認してください。アプリケーションが
uvを見つけられない場合は、"command"フィールドにフルパスを指定する必要があるかもしれません。通常、macOSまたはLinuxのターミナルでwhich uv実行するか、Windowsの場合はwhere uv実行することで、このパスを見つけることができます。サーバーは、
mcp_server.py(mcp.run(transport='stdio')) で設定されているとおり、デフォルトでstdioをリッスンします。これは通常、Cursor などのアプリケーションが期待するものです。
設定後、アプリケーションは Python MCP サーバーと通信できるようになります。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- AlicenseCqualityDmaintenanceA starter template for building Model Context Protocol servers that can be integrated with Cursor or Claude Desktop, allowing developers to create custom tools and extensions for AI assistants.1514MIT
- Flicense-qualityDmaintenanceA starter template for building Model Context Protocol (MCP) servers, enabling developers to create and add custom tools that can be integrated with Claude Desktop.2
- FlicenseCqualityDmaintenanceA starter template for building Model Context Protocol servers that integrate with AI assistants like Claude and Cursor, providing custom tools, resource providers, and prompt templates.215
- FlicenseCqualityDmaintenanceA starter template for building Model Context Protocol servers that integrate with AI assistants like Claude and Cursor, providing custom tools, resource providers, and prompt templates.215
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Primarily to be used as a template repository for developing MCP servers with FastMCP in Python, P…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nictuku/py-mcp-server-template'
If you have feedback or need assistance with the MCP directory API, please join our Discord server