Skip to main content
Glama
TheCodeWulf

custodyops-mcp-python

by TheCodeWulf

custodyops-mcp-python

一个极简的 Python MCP 服务器,基于 Streamable HTTP,使用 FastAPI + fastmcp 构建,可直接部署到 Render 并启用 HTTPS。它暴露了一个 ping 工具以及两个演示工具(get_positionslist_upcoming_corporate_actions),你可以将其替换为托管数据的只读适配器。

为什么选择 Streamable HTTP? 它是 远程/托管 MCP 服务器 的推荐传输方式,将双向流简化为单个 POST /mcp 端点,使云部署变得简单直接。请参考 MCP HTTP 快速入门和 SDK 文档了解标准模式。

功能特性

  • POST /mcp 提供 Streamable HTTP 端点

  • 通过 AUTH_TOKEN 实现 Bearer 认证

  • /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 $PORT

使用 cURL 测试:

# 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.sh

部署到 Render(HTTPS)

  1. Fork 或推送 此仓库到你的 GitHub。

  2. 在 Render 中:New → Web Service → Connect repo

  3. 根据 render.yaml 查看设置(Python 环境,免费方案)。Render 会自动配置 HTTPS

  4. 在 Render Environment 中设置 AUTH_TOKEN(如果使用 blueprint 则会自动生成)。

  5. 部署 → 你的公共 MCP 端点为:https://<your-app>.onrender.com/mcp

测试远程:

APP_URL=https://<your-app>.onrender.com AUTH_TOKEN=<token> ./scripts/test_remote.sh

从 Claude 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。

许可证

A
license - permissive license
-
quality - not tested
C
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

  • F
    license
    -
    quality
    D
    maintenance
    A 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.
  • A
    license
    -
    quality
    D
    maintenance
    An experimental MCP server demonstrating remote calls via FastAPI, supporting ping-pong commands through API endpoints and SSE transport.
    2
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    Enables building and running MCP servers over streamable HTTP, exposing tools to AI assistants like Cursor, with examples of mounting multiple servers in FastAPI.

View all related MCP servers

Related MCP Connectors

  • Multi-tenant FastMCP server for Charles Schwab brokerage data, monetized via DPYC Tollbooth

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • MCP server for verifying EUDI/Talao wallet data via OIDC4VP (pull) for AI agents.

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/TheCodeWulf/custodyops-mcp-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server