Skip to main content
Glama
Suryakanta26

mcp-server-python-mt9e4j8z

by Suryakanta26

MCP サーバーテンプレート (Python)

Render 向けの最小限の Model Context Protocol サーバーテンプレートです。フォークして、独自のツールを追加し、デプロイしてください。

含まれるもの

  • Streamable HTTP トランスポート対応の MCP Python SDK を使用した、動作する MCP サーバー

  • MCP_API_TOKEN によるベアラートークン認証(デプロイ時に自動生成)

  • パターンを示すサンプルツール(hello)が1つ

  • Render のヘルスチェック用の /health エンドポイント

  • ワンクリックデプロイ用の render.yaml Blueprint

  • AI コーディングアシスタントが新しいツールの雛形を作成できるようにする 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_TOKEN

MCP_API_TOKEN が設定されていない場合(例: ローカル開発中など)、認証は無効になり、すべてのリクエストが許可されます。

トークンの管理

初回デプロイ後は、トークンを自分で管理できます:

  • ローテーションするには、Render Dashboard の EnvironmentMCP_API_TOKEN を更新します。サービスは新しい値で自動的に再起動します。

  • 新しいトークンを生成するには、次のいずれかを使用します:

    • openssl rand -base64 32

    • python3 -c "import secrets; print(secrets.token_urlsafe(32))"

    • パスワードマネージャーのジェネレーター(1Password、Bitwarden など)

  • トークンをコミットしないでください。ソース管理にコミットせず、環境変数または .env ファイル(.gitignore に含まれています)を使用してください。

  • マルチユーザーまたは本番環境のセットアップでは、OAuth 2.1 へのアップグレードを検討してください。

MCP サーバーへの接続

Render へのデプロイ後、MCP エンドポイントは次の場所で利用できます:

https://your-service-name.onrender.com/mcp

Cursor

プロジェクトの .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

詳細

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

UpdatingMaintainers
UpdatingResponse time
Release cycle
0Releases (12mo)
Commit activity

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

  • F
    license
    Not graded
    quality
    C
    maintenance
    A minimal template for deploying Model Context Protocol servers on Render with Streamable HTTP transport, bearer token authentication, and an example hello tool.
  • F
    license
    Not graded
    quality
    C
    maintenance
    A minimal MCP server template for Python with Streamable HTTP transport, bearer token authentication, and a hello tool, designed for deployment on Render.
  • F
    license
    Not graded
    quality
    C
    maintenance
    A 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.
  • F
    license
    Not graded
    quality
    C
    maintenance
    A minimal MCP server template for Render with Streamable HTTP transport, bearer token authentication, and an example 'hello' tool.

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

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