sugra-api-mcp

sugra-api-mcp

Gateway connector between LLM agents and world data, providing access to financial market prices, macroeconomic indicators, and news through a bundled endpoint catalog.

Category
访问服务器

README

sugra-api-mcp

<!-- mcp-name: io.github.Sugra-Systems/sugra-api-mcp -->

<p align="center"> <img src="https://app.sugra.ai/images/brand/sugra-app-icon.svg" alt="sugra.ai" width="112" height="112" /> </p>

<p align="center"> <a href="https://pypi.org/project/sugra-api-mcp/">PyPI v0.6.3</a> | Python 3.11+ | <a href="https://github.com/Sugra-Systems/prod-sugra-ai-MCP/blob/main/LICENSE">MIT</a> </p>

Gateway connector between LLM agents and world data. Official Model Context Protocol server for the Sugra API, backed by a bundled endpoint catalog and operation_id calls.

Works with Anthropic Claude, OpenAI GPT, Google Gemini, xAI, and any MCP-enabled IDE.

Client details:

  • Anthropic Claude: Claude Desktop, Claude Code (CLI), claude.ai (web)
  • OpenAI GPT: ChatGPT (via MCP connector)
  • Google Gemini: Gemini CLI, Gemini Code Assist (VS Code + JetBrains)
  • xAI: Remote MCP Tools in xAI SDK and Responses API
  • IDEs: VS Code (native), Cursor, Zed, Cline, Continue.dev, Windsurf
  • Custom agents: anything built on the Python or TypeScript MCP SDK

What you get

Current release: six-tool gateway surface with hosted OAuth activity validation for https://app.sugra.ai/mcp, plus ChatGPT Apps-compatible OAuth tool metadata. Curated tool names such as get_market_price, get_macro_indicator, and get_news are not part of this package. The package exposes exactly six tools:

Tool Purpose
fetch_data One-step: find best endpoint for a natural-language query and call it. Combines search + call in one round trip.
search_endpoints Search the bundled endpoint catalog. Runtime search does not fetch /openapi.json.
describe_endpoint Inspect an endpoint by operation_id, including path, method, parameters, and required inputs.
call_endpoint Call a Sugra API operation by operation_id. Arbitrary path calls are no longer supported.
list_toolsets List catalog groups and endpoint counts.
list_sources Show bundled catalog source metadata.

call_endpoint and fetch_data both support response shaping with limit, fields, and include_raw.

Installation

pip install sugra-api-mcp

Get a free API key at app.sugra.ai/settings/billing (Free tier: 50 req/day).

Usage with Claude Desktop (stdio)

Add to claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: Claude Desktop has no Linux build. On Linux, pip install sugra-api-mcp and use Claude Code (CLI), an IDE client, or the hosted HTTP endpoint below.
{
  "mcpServers": {
    "sugra": {
      "command": "sugra-api-mcp",
      "env": {
        "SUGRA_API_KEY": "sugra_xxx_yourkey..."
      }
    }
  }
}

Restart Claude Desktop. Sugra tools appear in the tools menu.

Usage with Claude Code (Anthropic CLI)

claude mcp add sugra -- sugra-api-mcp
# then set the env var that sugra-api-mcp reads
export SUGRA_API_KEY=sugra_xxx_...

Or edit ~/.claude/config.json manually with the same shape as Claude Desktop above.

Usage with Cursor, Zed, Cline, Continue.dev, Windsurf

Each of these has an MCP settings file (typically mcp.json or equivalent) with the same stdio config shape as Claude Desktop.

Usage with ChatGPT

ChatGPT supports MCP through its connector UI. Use the hosted HTTP endpoint (below) since ChatGPT does not launch local stdio processes.

Usage over HTTP (claude.ai, ChatGPT, remote agents)

Hosted Streamable HTTP endpoint:

https://app.sugra.ai/mcp

Add to claude.ai, ChatGPT, or any Streamable HTTP MCP client. Authenticate with Authorization: Bearer sugra_xxx_....

In claude.ai: Settings -> Connectors -> Add custom connector. In ChatGPT: Settings -> Connectors -> Add MCP server.

CLI

Server startup is unchanged:

sugra-api-mcp
sugra-api-mcp --transport streamable-http --port 8001

Catalog and gateway helpers:

sugra-api-mcp doctor
sugra-api-mcp list-toolsets
sugra-api-mcp search "NASDAQ futures"
sugra-api-mcp describe cot_financial
sugra-api-mcp call quotes_symbol_price --params '{"symbol":"AAPL"}'

Environment variables

Variable Required Default Description
SUGRA_API_KEY Yes (stdio) - Your Sugra API key. In HTTP mode with OAuth this becomes a fallback for requests without Bearer
SUGRA_API_BASE No https://sugra.ai Override for self-hosted or beta environments
SUGRA_TIMEOUT No 30 Request timeout in seconds
SUGRA_MCP_ALLOWED_HOSTS No (HTTP) - Comma-separated hostnames to allow behind a reverse proxy
SUGRA_MCP_ALLOWED_ORIGINS No (HTTP) chatgpt.com, claude.ai, cursor.sh + others Comma-separated allowed Origins for browser-based MCP clients. Applies to BOTH the outer Starlette CORS layer and the inner FastMCP DNS rebinding Origin check, so the two stay in sync. * disables the inner Origin check entirely (self-hosted / dev only); Bearer auth still gates tool calls

HTTP transport with OAuth

When running with --transport streamable-http the server allows unauthenticated MCP discovery requests (initialize, notifications/initialized, tools/list, resources/list, prompts/list, and ping) so ChatGPT Apps and other mixed-auth clients can discover tool metadata. CORS is enabled for major MCP clients (ChatGPT, Claude, Cursor) so browser connector UIs can complete the OAuth flow; override the allowlist with SUGRA_MCP_ALLOWED_ORIGINS. Tool calls still require Authorization: Bearer .... Two token formats are accepted:

  • Raw API key (sugra_...) - passed through as the downstream x-api-key. Compatible with earlier local API-key setups.
  • OAuth JWT - signature verified against the issuer's JWKS. The audience must match https://app.sugra.ai/mcp, the token must include sugra:read, and hosted access is validated against APP before resolving the user's primary API key. Successful hosted OAuth requests update MCP connection activity in APP.
Variable Required Default Description
SUGRA_APP_URL HTTP + OAuth https://app.sugra.ai Base URL of the authorization server
SUGRA_JWKS_URL No $SUGRA_APP_URL/oauth/jwks.json JWKS endpoint
INTERNAL_API_TOKEN HTTP + OAuth - Shared secret for the user lookup and MCP activity endpoints on the authorization server. Same value must be set on both the MCP process and the app.sugra.ai Laravel process

Examples

Ask Claude:

  • "Search Sugra endpoints for NASDAQ futures."
  • "Describe the cot_financial operation."
  • "Call quotes_symbol_price with symbol AAPL and return only symbol and price."
  • "List available Sugra toolsets."

Troubleshooting

SUGRA_API_KEY environment variable is required

The server could not find your API key. Depending on how you run it:

  • As an MCP tool from your client (Claude, ChatGPT, Gemini, xAI, IDE, etc.): check the env block in your MCP config file. Value should be a full key like sugra_ao1_..., not empty and not wrapped in extra quotes.
  • Shell / CI: export SUGRA_API_KEY=sugra_... before running sugra-api-mcp.
  • HTTP mode: set via .env or systemd EnvironmentFile, not the shell.

401 Unauthorized or 403 Forbidden in tool responses

Key accepted but rejected. Common causes:

  • Key was regenerated in app.sugra.ai/settings/billing and your config still has the old one.
  • Typo - key contains only lowercase letters and digits, no spaces, no trailing newlines.
  • Free tier was deactivated. Sign in to verify status.

429 Too Many Requests

Hit your plan's daily limit. Response headers include X-RateLimit-Reset with the UTC timestamp when the counter resets (midnight UTC). Upgrade your plan at app.sugra.ai/settings/billing.

Invalid Host header (only if self-hosting HTTP mode)

FastMCP has DNS rebinding protection. Set SUGRA_MCP_ALLOWED_HOSTS to a comma-separated list of the public hostnames your reverse proxy serves. Example: SUGRA_MCP_ALLOWED_HOSTS=mcp.example.com,example.com.

Tool result truncated with meta.truncated notice

Some endpoints return very large payloads (global wildfires, full table catalogs). The client enforces the MCP 25k token limit - when hit, the data list is trimmed and a retry hint appears in meta.truncated.retry_hint. Add narrower filters (country, date range, limit) to get the full result.

Python version 3.11 or higher is required

sugra-api-mcp requires Python 3.11+. Check: python --version. If you have 3.10 or older:

  • Ubuntu: install Python 3.11 or newer from your distribution packages or the deadsnakes PPA.
  • macOS: brew install python@3.11
  • Windows: download from python.org

Then recreate your venv.

Hosted app.sugra.ai/mcp returns 5xx

The hosted endpoint can briefly restart after deploys. Wait 60 seconds and retry. If persistent, email support@sugra.systems.

Debugging tool calls locally

Run with stdio and log JSON-RPC messages:

SUGRA_API_KEY=sugra_... sugra-api-mcp 2>&1 | tee mcp-debug.log

Send manual JSON-RPC from a second terminal using nc or an MCP inspector.

Development

git clone https://github.com/Sugra-Systems/prod-sugra-ai-MCP
cd prod-sugra-ai-MCP
pip install -e ".[dev,http]"
export SUGRA_API_KEY=sugra_...
python -m sugra_api_mcp  # stdio mode
python -m sugra_api_mcp --transport streamable-http --port 8001  # HTTP mode
python scripts/build_endpoint_catalog.py  # rebuild bundled catalog from sibling API openapi.json

Run tests:

pytest

License

MIT © 2026 Sugra Systems, Inc.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选