gexbot-mcp
gexbot-mcp
一个轻量级 MCP 服务器,封装了 GEXBot API,以便在 claude.ai 中作为自定义连接器添加。
使用官方 MCP Python SDK(FastMCP)构建,通过 Streamable HTTP 提供服务,因此可以远程托管(例如在 Render 上)。
规范参考:nfa-llc/gexbot-openapi — 基础 URL https://api.gex.bot/v2,Bearer 令牌认证。
暴露的工具
工具 | 描述 |
| 零伽马/翻转水平、前 3 个看涨期权墙、前 3 个看跌期权墙、净 GEX 符号 + 值、现货价格、时间戳。 |
| 现货价格 ±3% 范围内每个行权价的净 GEX,已修剪。 |
| GEXBot 支持的股票/指数/期货代码。 |
另外还有一个普通的 HTTP GET /health 端点(不是 MCP 工具),用于正常运行时间检查 / Render 健康检查。
关于 dte
GEXBot 不接受任意的 DTE 整数 — 它将数据分入固定的类别。此服务器将 dte 参数映射到这些类别:
dte=0→zero(下一个到期日 / 0DTE)dte=1→one(下一个到期日 + 1)任何其他值 →
full(所有已发布到期日的完整聚合,最长约 90 天)
你关心的代码
没有硬编码限制 — GEXBot 支持的任何代码都可以使用(参见 list_tickers())。你可能会最常使用:QQQ、SPY、NDX、SPX、SPXW。
Related MCP server: ai-trader
认证
服务器在请求时从环境中读取 GEXBOT_API_KEY,并将其作为 Authorization: Bearer <key> 发送给 GEXBot。密钥永远不会硬编码 — 必须在运行此服务的任何地方(本地、Docker 或 Render)将其设置为环境变量。
本地运行
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -r requirements.txt
set GEXBOT_API_KEY=gexbot_custom_your_key_here # cmd.exe
# or: $env:GEXBOT_API_KEY = "gexbot_custom_your_key_here" # PowerShell
python server.py服务器默认监听 http://0.0.0.0:8000(可通过 PORT 覆盖)。MCP 端点在 /mcp;健康检查在 /health。
快速检查:
curl http://localhost:8000/health使用 Docker 运行
docker build -t gexbot-mcp .
docker run -p 8000:8000 -e GEXBOT_API_KEY=gexbot_custom_your_key_here gexbot-mcp部署到 Render(免费套餐)
将此文件夹推送到 GitHub(或 GitLab)仓库。
在 Render 仪表板中:New + → Web Service → 连接你的仓库。
Render 会自动检测
Dockerfile。将构建/启动命令留空(Docker 会处理)。或者,如果你更喜欢一键配置,此仓库包含
render.yaml— 使用 New + → Blueprint 并指向该仓库。
将 Instance Type 设置为 Free。
在 Environment 下,添加:
GEXBOT_API_KEY= 你的密钥(将其标记为 Secret)。请在 Render 仪表板中自行粘贴 — 不要将其放入仓库或render.yaml中。
Health Check Path:
/health。部署。Render 将构建 Docker 镜像并为你提供一个 URL,例如:
https://gexbot-mcp.onrender.com
注意:Render 的免费 Web 服务在闲置 15 分钟后会关闭,并在下一次请求时大约需要 30-60 秒重新唤醒 — 闲置后的第一次工具调用可能会很慢。
在 claude.ai 中添加为自定义连接器
在 claude.ai 中:Settings → Connectors → Add custom connector。
URL:
https://<your-app>.onrender.com/mcp保存。Claude 将发现这三个工具(
get_gex_levels、get_gex_profile、list_tickers)。
错误处理
所有工具都返回紧凑的 JSON 字典。失败时返回 {"error": "<message>", ...} 而不是抛出异常,以便模型能够看到并转述问题。已处理的情况:
API 密钥错误/缺失 → GEXBot 返回 401 → 清晰的“检查 GEXBOT_API_KEY”消息。
密钥无权访问资源 → 403 → 清晰的消息。
不支持的代码 → 404 → 清晰的消息。
错误请求(例如格式错误的代码/类别)→ 400 → 显示 GEXBot 的错误消息。
GEXBot 故障 / 市场关闭的边界情况 → 5xx 已处理并给出清晰消息;此外,
get_gex_levels/get_gex_profile在返回数据的时间戳超过 24 小时时会包含"stale": true标志,因为 GEXBot 本身没有明确的“市场关闭”错误。网络/超时错误 → 清晰的消息,不会向客户端泄露堆栈跟踪。
项目结构
server.py # the MCP server (FastMCP, Streamable HTTP)
requirements.txt
Dockerfile
render.yaml # optional Render Blueprint config
.env.exampleTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
The full TraderMatrix market-data connector for Claude, Cursor and any MCP client. 51 tools: scored and tiered unusual options activity, dealer gamma (GEX), Apex levels and gamma pockets, IV rank, sector flow, dark-pool net-notional rollups, market health and macro regime, gap-continuation and breakout signals, wheel and CSP screeners, a one-call ticker snapshot, and your own watchlists. Needs a TraderMatrix API key (OAuth sign-in works for Claude web and mobile). A free, no-key connector with the gapper scanner and Market Health tools is listed separately as TraderMatrix Free.
Options analytics for AI assistants: chains, IV rank, VRP, Greeks, GEX, expected moves, screeners.
Your investing research inside Claude: watchlists, financial ratios, reverse-DCF valuations, investment theses, notes, portfolio, earnings calendar and news for the companies you follow. 70 read and write tools; ask what's on your morning desk, rank a watchlist by ROE, log a trade or save a thesis. OAuth sign-in. Free to start.
AI workspace with FinzData built in: stocks, futures, options GEX, macro, crypto data and code runs.
Related MCP Servers
- AlicenseBqualityBmaintenanceProvides 32 trading analysis tools for AI-powered market analysis, including real-time data, technical indicators, options Greeks, scanners, and Interactive Brokers portfolio management, all accessible via natural language in Claude Desktop.36416MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants like Claude to run backtests, fetch market data, list strategies, and analyze trading algorithms via natural language.1,141GPL 3.0
- AlicenseAqualityDmaintenanceEnables AI agents to discover and retrieve options market-structure data (GEX, gamma flip levels, dealer positioning, skew, max pain, expected-move levels, options flow, and ranked trade setups) from Trading Volatility's public API via natural language.171MIT
- AlicenseAqualityCmaintenanceProvides natural language access to ApexVol's options analytics platform, enabling queries on options chains, volatility metrics, Greeks, flow analysis, and strategy building via Claude Code or Claude Desktop.4324 PyPI2MIT