custodyops-mcp-python
custodyops-mcp-python
最小限のPython MCPサーバーで、Streamable HTTP上で動作し、FastAPI + fastmcp を使用しています。Render で HTTPS 対応のデプロイが可能です。ping ツールと2つのデモツール(get_positions、list_upcoming_corporate_actions)を公開しており、これらはカストディデータへの読み取り専用アダプターに置き換えることができます。
なぜ Streamable HTTP なのか? リモート/ホスト型 MCP サーバーに推奨されるトランスポートであり、双方向ストリーミングを単一の
POST /mcpエンドポイントに簡略化し、クラウドデプロイを容易にします。正規のパターンについては MCP HTTP クイックスタートおよび SDK ドキュメントを参照してください。
機能
POST /mcpの Streamable HTTP エンドポイントBearer 認証(
AUTH_TOKEN経由)/healthエンドポイント(稼働確認用)最小限のコード量で、さらに MCP ツールを追加しやすい
render.yamlによる ワンクリックデプロイ(Render 対応)
Related MCP server: MCP Ping-Pong Server
クイックスタート(ローカル)
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scriptsctivate
pip install -r requirements.txt
export AUTH_TOKEN=devtoken123
export PORT=3000
uvicorn app:app --host 0.0.0.0 --port $PORTcURL でテスト:
# tools/list
curl -s -X POST http://localhost:3000/mcp -H "Content-Type: application/json" -H "Authorization: Bearer devtoken123" -d '{"jsonrpc":"2.0","id":"1","method":"tools/list","params":{}}' | jq
# tools/call ping
curl -s -X POST http://localhost:3000/mcp -H "Content-Type: application/json" -H "Authorization: Bearer devtoken123" -d '{"jsonrpc":"2.0","id":"2","method":"tools/call","params":{"name":"ping","arguments":{}}}' | jqまたはヘルパースクリプトを実行:
chmod +x scripts/test_locally.sh
AUTH_TOKEN=devtoken123 PORT=3000 ./scripts/test_locally.shRender にデプロイ(HTTPS)
このリポジトリを フォークまたはプッシュ して自分の GitHub に追加します。
Render で: New → Web Service → Connect repo。
render.yamlの設定を確認します(Python 環境、フリープラン)。Render は自動的に HTTPS をプロビジョニングします。Render の Environment で
AUTH_TOKENを設定します(ブループリントを使用する場合は自動生成されます)。デプロイ → パブリックな MCP エンドポイントは次のようになります:
https://<your-app>.onrender.com/mcp。
リモートでテスト:
APP_URL=https://<your-app>.onrender.com AUTH_TOKEN=<token> ./scripts/test_remote.shClaude Desktop から使用する(リモート MCP)
claude_desktop_config.json にリレーエントリを追加:
{
"mcpServers": {
"custodyops-mcp": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://<your-app>.onrender.com/mcp"],
"env": { "AUTH_TOKEN": "<same-token>" }
}
}
}アプリを再起動し、Claude に利用可能なツールを尋ねます。
実際のカストディデータで拡張する
デモツールを、データマートまたは API への読み取り専用アダプターに置き換えます。レスポンスは 小さく型付けされた ものにし、可能な限りフィールドの出所を追加します。
スケルトン例:
@mcp_tool
def get_positions(account_id: str) -> str:
rows = query_positions(account_id) # your adapter
return json.dumps(rows)セキュリティ上の注意
AUTH_TOKENは秘密に保ち、定期的にローテーションします。エンタープライズ用途では、OAuth/JWT に移行し、アカウントごとの認可を追加します。HTTP トランスポート の場合、通常のログ記録で問題ありませんが、機密データは編集し、リクエスト ID を追加します。
ライセンス
MIT
Related MCP Connectors
MCP server for Modern Treasury — payment orders, transactions, counterparties and ledgers.
Multi-tenant FastMCP server for Charles Schwab brokerage data, monetized via DPYC Tollbooth
MCP server for Codat — companies, connections, invoices, bills and financial statements.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA minimal Model Context Protocol server built with FastAPI that provides a basic "Hello World" resource and tool. Serves as a starting point for building and validating MCP client integrations with richer resources and tools.-
- AlicenseNot gradedqualityDmaintenanceAn experimental MCP server demonstrating remote calls via FastAPI, supporting ping-pong commands through API endpoints and SSE transport.2MIT
- FlicenseNot gradedqualityDmaintenanceEnables building and running MCP servers over streamable HTTP, exposing tools to AI assistants like Cursor, with examples of mounting multiple servers in FastAPI.-
- FlicenseNot gradedqualityDmaintenanceA Python-based MCP server that exposes tools over streamable HTTP using FastAPI, enabling connection to AI assistants like Cursor. Supports multiple servers mounted in a single FastAPI app.-