mcp-server-python-mt9e4j8z
MCP サーバーテンプレート (Python)
Render 向けの最小限の Model Context Protocol サーバーテンプレートです。フォークして、独自のツールを追加し、デプロイしてください。
含まれるもの
Streamable HTTP トランスポート対応の MCP Python SDK を使用した、動作する MCP サーバー
MCP_API_TOKENによるベアラートークン認証(デプロイ時に自動生成)パターンを示すサンプルツール(
hello)が1つRender のヘルスチェック用の
/healthエンドポイントワンクリックデプロイ用の
render.yamlBlueprintAI コーディングアシスタントが新しいツールの雛形を作成できるようにする
AGENTS.md
注: このテンプレートはデフォルトでフリープランにデプロイされます。フリーサービスは15分間非アクティブが続くとスピンダウンし、次のリクエスト時に30〜60秒のコールドスタートが発生します。この遅延中に MCP クライアントがタイムアウトする可能性があります。確実に使用するには、Render Dashboard で 有料プラン にアップグレードしてください — Starter プランなら、サービスを継続的に稼働させ続けられます。
Related MCP server: mcp-server-python
ローカルで始める
git clone https://github.com/render-examples/mcp-server-python.git
cd mcp-server-python
pip install -r requirements.txt
python server.pyサーバーは http://localhost:10000 で起動します。MCP エンドポイントは /mcp です。
テストの実行
pip install -r requirements.txt
pytest認証
サーバーはベアラートークンを使用してリクエストを認証します。Render の Blueprint は、初回デプロイ時にランダムな MCP_API_TOKEN を自動生成します。
デプロイ後にトークンを確認するには、Render Dashboard > お使いのサービス > Environment に移動し、MCP_API_TOKEN の値をコピーしてください。
クライアントは Authorization ヘッダーにトークンを含める必要があります:
Authorization: Bearer YOUR_TOKENMCP_API_TOKEN が設定されていない場合(例: ローカル開発中など)、認証は無効になり、すべてのリクエストが許可されます。
トークンの管理
初回デプロイ後は、トークンを自分で管理できます:
ローテーションするには、Render Dashboard の Environment で
MCP_API_TOKENを更新します。サービスは新しい値で自動的に再起動します。新しいトークンを生成するには、次のいずれかを使用します:
openssl rand -base64 32python3 -c "import secrets; print(secrets.token_urlsafe(32))"パスワードマネージャーのジェネレーター(1Password、Bitwarden など)
トークンをコミットしないでください。ソース管理にコミットせず、環境変数または
.envファイル(.gitignoreに含まれています)を使用してください。マルチユーザーまたは本番環境のセットアップでは、OAuth 2.1 へのアップグレードを検討してください。
MCP サーバーへの接続
Render へのデプロイ後、MCP エンドポイントは次の場所で利用できます:
https://your-service-name.onrender.com/mcpCursor
プロジェクトの .cursor/mcp.json に追加します:
{
"mcpServers": {
"my-mcp-server": {
"url": "https://your-service-name.onrender.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_TOKEN"
}
}
}
}Claude Desktop
Claude Desktop の設定に追加します:
{
"mcpServers": {
"my-mcp-server": {
"type": "streamable-http",
"url": "https://your-service-name.onrender.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_TOKEN"
}
}
}
}Codex
codex mcp add --transport streamable-http \
--url https://your-service-name.onrender.com/mcp \
--header "Authorization: Bearer YOUR_TOKEN" \
my-mcp-serverまたは .codex/config.toml に追加します:
[mcp_servers.my-mcp-server]
url = "https://your-service-name.onrender.com/mcp"
http_headers = { Authorization = "Bearer YOUR_TOKEN" }ツールの追加
server.py で関数を @mcp.tool() でデコレートして、ツールを追加します:
@mcp.tool()
def fetch_weather(city: str, units: str = "celsius") -> str:
"""Get the current weather for a city."""
# your implementation here
return f"Weather for {city}"docstring がツールの説明になります。MCP クライアントはこの説明を LLM に表示します。必ず明確な説明を書きましょう。
このリポジトリには
AGENTS.mdファイルが含まれています。AI コーディングアシスタント(Cursor、Copilot、Codex、Windsurf など)を使用している場合は、「新しいツールを追加して」と頼むと、AGENTS.mdの規約に従って自動的に新しいツールを追加してくれます。
プロジェクト構造
server.py MCP server with example tool and health check
requirements.txt Python dependencies
render.yaml Render Blueprint for deployment
.env.example Environment variable reference
tests/test_server.py Test suite (auth, health, tool calls)
pyproject.toml pytest configuration
AGENTS.md Instructions for AI coding assistants
CLAUDE.md Pointer to AGENTS.md for Claude Code詳細
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceA minimal template for deploying Model Context Protocol servers on Render with Streamable HTTP transport, bearer token authentication, and an example hello tool.
- FlicenseNot gradedqualityCmaintenanceA minimal MCP server template for Python with Streamable HTTP transport, bearer token authentication, and a hello tool, designed for deployment on Render.
- FlicenseNot gradedqualityCmaintenanceA minimal MCP server template for Render with Streamable HTTP transport, bearer token authentication, and an example 'hello' tool. Enables developers to quickly scaffold and deploy their own MCP servers.
- FlicenseNot gradedqualityCmaintenanceA minimal MCP server template for Render with Streamable HTTP transport, bearer token authentication, and an example 'hello' tool.
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Remote ChromaDB vector database MCP server with streamable HTTP transport
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/Suryakanta26/mcp-server-python-mt9e4j8z'
If you have feedback or need assistance with the MCP directory API, please join our Discord server