longbridge
OfficialLongbridge MCP server provides 145 tools for brokerage operations across US and HK markets:
Quotes & Market Data: Real-time and historical quotes, candlesticks, order book depth, broker queues, capital flow, market sentiment/temperature, A/H premium, options chain, short positions, market anomalies, and index constituents.
Trading: Submit, cancel, and replace orders; view positions, account balance, executions, cash flow, and margin ratios.
Fundamentals: Financial statements, business segments, dividends, EPS forecasts, analyst consensus, institutional ratings, company profiles, corporate actions, regulatory filings, and industry valuations.
Market & Industry Data: Industry rankings, broker holdings (HKEX CCASS), trade statistics, popularity leaderboards, stock screener, and calculated financial indexes.
Macroeconomic Data: Access macro indicators (CPI, GDP, NFP, etc.) and their historical values.
IPO: Subscriptions, calendar, recently listed stocks, order details, and profit/loss analysis.
Portfolio: Profit/loss analysis (overall and per-symbol), exchange rates.
DCA (Dollar-Cost Averaging): Create, update, pause, resume, and stop plans; view execution history and statistics.
Alerts: Add, delete, enable, disable, and list price alerts.
Watchlists & Community: Watchlist group management, community sharelist CRUD, member management, and popular lists.
Content & Search: Symbol news, news search, discussion topics, community topic search, and financial calendar (earnings, dividends, IPOs, macro events, market holidays).
Banking & Statements: Bank cards, deposit/withdrawal records, and account statement listing/export.
Quant: Run custom indicator scripts against historical K-line data.
Utility: Retrieve current UTC time.
Official MCP server for the Longbridge brokerage. 163 tools across real-time quotes, options, order routing, fundamentals, analyst ratings, calendars, IPO, price alerts, DCA plans, grid trading, portfolio analytics and community sharelists — covering US and HK markets. Built with Rust using rmcp and axum.
Add it in one place | Then just ask | |
ChatGPT | Settings → Apps & Connectors → add Longbridge | "How's NVDA trading today?" · "Show my HK positions" |
Claude | Settings → Connectors → add Longbridge (web · desktop · mobile) | "Compare AAPL and MSFT valuations" · "Any IPOs this week?" |
Sign in once with your Longbridge account. Every request runs over the same hosted, OAuth 2.1–secured endpoint documented below — read-only market data plus full account, portfolio, and trading tools, all gated by your own credentials.
Highlights
163 tools, one endpoint — quotes, options, order routing, fundamentals, analyst research, screeners, IPO, alerts, DCA, grid trading and portfolio analytics across US and HK markets.
Stateless by design — every request forwards its Bearer token straight to the Longbridge SDK. No sessions, no database, nothing stored server-side.
OAuth 2.1, auto-discovered — RFC 9728 protected-resource and RFC 8414 authorization-server metadata; clients complete the flow with no token to paste.
Clean, typed responses — snake_case fields, RFC 3339 timestamps, human-readable symbols, and typed
outputSchemadescriptors for compatible clients.
Built in Rust with rmcp and axum.
Related MCP server: Stock MCP Server
Connect your own client
Longbridge runs a hosted endpoint at https://mcp.longbridge.com — point any MCP client at it and complete OAuth when prompted. Authorization is auto-discovered via RFC 9728; there is no token to paste.
Claude Code
claude mcp add --transport http longbridge https://mcp.longbridge.comClaude Desktop — add to claude_desktop_config.json, then restart:
{ "mcpServers": { "longbridge": { "url": "https://mcp.longbridge.com" } } }Cursor · Cline · Windsurf · Zed · other clients — point them at https://mcp.longbridge.com with transport streamable-http.
# Local self-hosted instance (see Self-hosting below)
claude mcp add --transport http longbridge-local http://localhost:8000/mcp
claude mcp list # registered servers
claude mcp get longbridge # config + auth status
claude mcp remove longbridge # unregister
claude mcp logout longbridge # re-trigger OAuth after revocationOn first use, the client reads the WWW-Authenticate challenge, fetches /.well-known/oauth-protected-resource (RFC 9728), and opens your browser for the Longbridge OAuth flow. Tokens are cached per session and refreshed automatically.
The 163 tools
Twenty categories spanning market data, trading, research and account management.
Category | Count | Coverage |
Quote | 32 | Real-time and historical quotes, candlesticks, depth, brokers, options, warrants, watchlists, capital flow, market temperature, short positions, option volume |
Fundamental | 33 | Financial statements/reports, business segments, institutional views, industry peers/valuation, dividends, EPS forecasts, valuations & valuation comparison, company info/executives, shareholders, corporate actions, operating metrics |
Trade | 14 | Order submission/cancellation/replacement, positions, balance, executions, cash flow, margin |
Market | 15 | Market status, industry/top-mover rank, broker holdings, A/H premium, trade statistics, anomalies, short trades/margin, index constituents |
DCA | 9 | Dollar-cost averaging plan create/update/pause/resume/stop, execution history, statistics, support check |
Grid | 11 | Grid trading order submit/replace/cancel/suspend/restart, list/detail/trigger-history reads, per-symbol setup info, one-time strategy consent |
Sharelist | 8 | Community sharelist CRUD, member add/remove/sort, popular lists |
IPO | 7 | IPO subscriptions, calendar, listed stocks, order detail, profit/loss analysis |
Content | 7 | News list/detail, discussion topic CRUD and replies |
Alert | 5 | Price alert CRUD (add, delete, enable, disable, list) |
Screener | 5 | Stock screener search, indicators, strategy recommendation/management |
Portfolio | 4 | Exchange rates, profit/loss analysis (summary, detail, realized) |
ATM | 3 | Bank cards, withdrawal records, deposit records |
Macrodata | 2 | Macroeconomic indicator list and detail |
Search | 2 | News search, community topic search |
Statement | 2 | Account statement listing and export |
Calendar | 1 | Finance calendar (earnings, dividends, IPOs, macro data, closures) |
Quant | 1 | Run a quant indicator script against historical K-line data |
Authenticate | 1 | OAuth code exchange for clients that can't complete a browser redirect |
Utility | 1 | Current UTC time |
Self-hosting
Prefer your own instance? Run the published image:
docker run -p 8443:8443 \
-v /path/to/certs:/certs:ro \
ghcr.io/longbridge/longbridge-mcp \
--bind 0.0.0.0:8443 \
--base-url https://mcp.example.com \
--tls-cert /certs/cert.pem \
--tls-key /certs/key.pemSet
--base-urlto your externally reachable URL on any public deployment — it is published in the OAuth metadata clients use to discover the authorization server. It defaults tohttp://localhost:{port}, which remote clients cannot use.
Or build from source: cargo build --release && ./target/release/longbridge-mcp.
Config lives at ~/.longbridge/mcp/config.json (override the directory with LONGBRIDGE_MCP_CONFIG_DIR). CLI flags take precedence. When tls_cert and tls_key are both set the server runs HTTPS, otherwise HTTP; base_url defaults to https://localhost:{port} with TLS or http://localhost:{port} without.
Option | Config Key | CLI Flag | Default | Description |
Bind address |
|
|
| HTTP server listen address |
Base URL |
|
| auto | Public base URL for resource metadata |
Log directory |
|
| (stderr) | Directory for rolling log files |
TLS certificate |
|
| (none) | PEM certificate file for HTTPS |
TLS private key |
|
| (none) | PEM private key file for HTTPS |
Advanced environment variables — most deployments never touch these; they exist for non-production Longbridge environments and SDK debugging.
Variable | Default | Description |
|
| Config file directory |
|
| Longbridge API base URL (also used for OAuth metadata) |
| (none) | Comma-separated hostnames accepted from the edge-injected |
| (none) | Authorization-server URL advertised to requests arriving via an allowlisted |
|
| Quote WebSocket endpoint |
|
| Trade WebSocket endpoint |
|
| Idle seconds before a cached quote WebSocket context is evicted |
|
| Maximum cached quote WebSocket contexts per server process |
| (unset) |
|
| (none) | SDK internal log path. Leave unset in production — the SDK writes unfiltered request/response bodies there |
MCP requests and responses carry customer data — cash balances, positions, order history — and upstream SDK frames carry access tokens. None of it belongs in a log file, so the server caps the log targets that would print it, independent of RUST_LOG:
Target | Cap | What it would otherwise print |
|
| OpenAPI request and full response bodies (INFO) |
|
| Every WebSocket frame, auth token included (INFO) |
|
| Order push events (INFO) |
|
| Decoded MCP requests and full tool results (DEBUG), raw JSON-RPC frames (TRACE) |
So raising verbosity is safe: RUST_LOG=debug (or trace) gives you the server's own logs without leaking customer data. Two switches defeat this, both off by default — LONGBRIDGE_MCP_LOG_PAYLOADS=1 (removes the caps; use only against a test account locally) and LONGBRIDGE_LOG_PATH (makes the SDK write unfiltered bodies to that directory; the server warns at startup when set).
The server expects a Longbridge OAuth access token in Authorization: Bearer <token>. On missing or invalid auth it returns 401 with a WWW-Authenticate header pointing to the protected-resource metadata, which directs clients to the Longbridge OAuth authorization server.
Method | Path | Description |
GET |
| Protected Resource Metadata (RFC 9728) |
GET |
| Authorization Server Metadata (RFC 8414); advertises direct Longbridge authorize/register and proxied token/revoke endpoints |
POST |
| OAuth token proxy; derives |
POST |
| OAuth revocation proxy; derives |
GET |
| Prometheus metrics |
POST/GET/DELETE |
| MCP Streamable HTTP endpoint (requires Bearer token) |
Prometheus metrics: mcp_tool_calls_total (counter), mcp_tool_call_duration_seconds (histogram), and mcp_tool_call_errors_total (counter) — each labelled by tool_name.
Development
cargo +nightly fmt # format
cargo clippy # lint
cargo test # testLicense
Released under the MIT License.
Maintenance
Related MCP Servers
- FlicenseDqualityDmaintenanceProvides real-time stock data and AI-powered analysis for A-shares, Hong Kong stocks, and US stocks. Features sentiment analysis of financial news, deep research reports, and comprehensive market data through multiple integrated data sources.22171
- AlicenseCqualityCmaintenanceEnables financial research and analysis through AI agents that combine web search, content crawling, entity extraction, and deep research workflows. Supports extracting stock/fund entities with security codes and conducting structured financial investigations.924Apache 2.0
- FlicenseNot gradedqualityCmaintenanceProvides comprehensive stock market data across US, Hong Kong, and Chinese markets, combining real-time quotes, historical data, fundamentals, and financial statements from multiple sources including Yahoo Finance, Finnhub, Tushare, and Futu OpenAPI.
Related MCP Connectors
Real-time market data, screeners, technical analysis & backtesting for stocks, crypto and forex.
Real-time news with bias scoring, live market data, and AI-powered options pricing
Options analytics: 17 pricing models, 17 Greeks, GEX, IV, 23 screeners, unusual, dark pool, max pain
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/longbridge/longbridge-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server