Logo de Longbridge

Longbridge

Organisation
longbridge

US/HK markets — 110 tools: real-time quotes, options, orders, fundamentals, alerts, DCA & portfolio

Éditeurlongbridge
Dépôtlongbridge-mcp
LangueRust
Forks
3
Étoiles
14
Outils disponibles
0
Type de transportstdio
Catégories
LicenceApache-2.0
Liens
  • Connectez des outils à vos workflows IA

    Longbridge propose des fonctionnalités MCP utilisables par les clients et agents IA compatibles.

  • 0 outils disponibles

    Parcourez les actions invocables ci-dessous, avec leurs noms et descriptions lorsque le serveur les fournit.

  • Configuration prête à copier

    Utilisez les exemples de configuration pour configurer ce serveur dans votre client MCP préféré.

  • Indicateurs de popularité open source

    14 étoiles et 3 forks sur le dépôt associé.

Official MCP server for the Longbridge brokerage. 164 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 placeThen just ask
ChatGPTSettings → Apps & Connectors → add Longbridge"How's NVDA trading today?" · "Show my HK positions"
ClaudeSettings → 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

  • 164 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 response schemas available as MCP resources.

Built in Rust with rmcp and axum.

Filter tool responses with jq

Every tool accepts an optional _jq string in its arguments. The expression runs on the complete returned JSON, after the normal response serialization. The _jq name is reserved for response filtering to avoid conflicts with business parameters. Usage guidance is sent once in the MCP initialize response's instructions; each tool schema declares only the optional parameter name and type. For example:

json
{
  "name": "quote",
  "arguments": {
    "symbols": ["AAPL.US", "MSFT.US"],
    "_jq": "map({symbol, last_done})"
  }
}

Use .data[:5] to take the first five entries of a data array, .data | map(select(.price > 10)) to select rows, or {total: .total} to project fields. Expressions use the embedded jaq engine's jq-compatible syntax; no separate jq executable is needed.

  • Omit _jq (or pass null) to preserve the original response.
  • One output value is returned directly, multiple values as an array, and no values as []. Scalars and arrays are JSON text; objects also appear in structuredContent, containing only the filtered fields.
  • Plain text responses are available as JSON strings. Multiple content blocks without structured content are available as an array.
  • Tool errors and permission/no-data explanations remain unfiltered.
  • Empty, invalid, or non-string expressions are rejected before the tool runs. If filtering fails at runtime, the response explicitly says the tool already executed. Do not automatically retry writes such as placing an order.
  • Environment access, filesystem imports, and logging filters are unavailable. Output is limited to 10,000 values and 8 MiB; exceeding a limit returns an error rather than a partial result.

Because filters can change the response shape, tools do not advertise a fixed outputSchema. Original typed schemas remain available through resources/list and resources/read at lb://tools/{tool-name}/output-schema for schema-backed tools.

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

bash
claude mcp add --transport http longbridge https://mcp.longbridge.com

Claude Desktop — add to claude_desktop_config.json, then restart:

json
{ "mcpServers": { "longbridge": { "url": "https://mcp.longbridge.com" } } }

Cursor · Cline · Windsurf · Zed · other clients — point them at https://mcp.longbridge.com with transport streamable-http.

bash
# 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 revocation

On 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 164 tools

Twenty categories spanning market data, trading, research and account management.

CategoryCountCoverage
Quote32Real-time and historical quotes, candlesticks, depth, brokers, options, warrants, watchlists, capital flow, market temperature, short positions, option volume
Fundamental33Financial statements/reports, business segments, institutional views, industry peers/valuation, dividends, EPS forecasts, valuations & valuation comparison, company info/executives, shareholders, corporate actions, operating metrics
Trade15Order submission/cancellation/replacement, multi-leg option combination orders, positions, balance, executions, cash flow, margin
Market15Market status, industry/top-mover rank, broker holdings, A/H premium, trade statistics, anomalies, short trades/margin, index constituents
DCA9Dollar-cost averaging plan create/update/pause/resume/stop, execution history, statistics, support check
Grid11Grid trading order submit/replace/cancel/suspend/restart, list/detail/trigger-history reads, per-symbol setup info, one-time strategy consent
Sharelist8Community sharelist CRUD, member add/remove/sort, popular lists
IPO7IPO subscriptions, calendar, listed stocks, order detail, profit/loss analysis
Content7News list/detail, discussion topic CRUD and replies
Alert5Price alert CRUD (add, delete, enable, disable, list)
Screener5Stock screener search, indicators, strategy recommendation/management
Portfolio4Exchange rates, profit/loss analysis (summary, detail, realized)
ATM3Bank cards, withdrawal records, deposit records
Macrodata2Macroeconomic indicator list and detail
Search2News search, community topic search
Statement2Account statement listing and export
Calendar1Finance calendar (earnings, dividends, IPOs, macro data, closures)
Quant1Run a quant indicator script against historical K-line data
Authenticate1OAuth code exchange for clients that can't complete a browser redirect
Utility1Current UTC time

Self-hosting

Prefer your own instance? Run the published image:

bash
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.pem

Set --base-url to your externally reachable URL on any public deployment — it is published in the OAuth metadata clients use to discover the authorization server. It defaults to http://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.

OptionConfig KeyCLI FlagDefaultDescription
Bind addressbind--bind127.0.0.1:8000HTTP server listen address
Base URLbase_url--base-urlautoPublic base URL for resource metadata
Log directorylog_dir--log-dir(stderr)Directory for rolling log files
TLS certificatetls_cert--tls-cert(none)PEM certificate file for HTTPS
TLS private keytls_key--tls-key(none)PEM private key file for HTTPS
Canary upstreamcanary--canaryfalseTalk to the Longbridge canary environment (*.longbridge.xyz). --canary=false forces production even when the config file enables it

The mainland-China environment (*.longbridge.cn) is not a flag: it is auto-selected when LONGBRIDGE_REGION=cn is set (the same variable the SDK uses), so a mainland cluster needs no dedicated setting.

Upstream endpoints are fixed by the selected environment:

Production (default)Canary (--canary)Mainland (LONGBRIDGE_REGION=cn)
OpenAPIhttps://openapi.longbridge.comhttps://openapi-global.longbridge.xyzhttps://openapi.longbridge.cn
Quote WebSocketwss://openapi-quote.longbridge.com/v2wss://openapi-global-quote.longbridge.xyz/v2wss://openapi-quote.longbridge.cn/v2
Trade WebSocketwss://openapi-trade.longbridge.com/v2wss://openapi-global-trade.longbridge.xyz/v2wss://openapi-trade.longbridge.cn/v2
OAuth / connect pageopenapi.longbridge.com / open.longbridge.comopenapi-global.longbridge.xyz / open.longbridge.xyzopenapi.longbridge.cn / open.longbridge.cn

Canary uses the -global gateway, not openapi.longbridge.xyz: only the former is CloudFront-fronted and performs x-dc-region data-center routing, which this server depends on to serve us_- and ap_-prefixed credentials from one process.

Canary and mainland pin every URL above at startup; production defers to the SDK's own resolution except that a us_ credential with no upstream override is pinned to the global .com gateway. See src/endpoints.rs for the exact selection rules.

Advanced environment variables — most deployments never touch these; they exist for SDK debugging and edge/global-entry deployments.

VariableDefaultDescription
LONGBRIDGE_MCP_CONFIG_DIR~/.longbridge/mcpConfig file directory
LONGBRIDGE_PUBLIC_HOSTS(none)Comma-separated hostnames accepted from the edge-injected X-Host header; matching requests echo that host in the 401 challenge / RFC 9728 metadata. Unset = X-Host ignored
LONGBRIDGE_GLOBAL_OAUTH_URL(none)Authorization-server URL advertised to requests arriving via an allowlisted X-Host (global single-domain entry). Unset = fall back to the mode's OpenAPI base URL
LONGBRIDGE_MCP_QUOTE_WS_IDLE_TTL_SECS600Idle seconds before a cached quote WebSocket context is evicted
LONGBRIDGE_MCP_QUOTE_WS_MAX_CONTEXTS1024Maximum cached quote WebSocket contexts per server process
LONGBRIDGE_MCP_LOG_PAYLOADS(unset)1 lifts the payload log caps (see below). Never set this in production
LONGBRIDGE_LOG_PATH(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:

TargetCapWhat it would otherwise print
longbridge_httpcliwarnOpenAPI request and full response bodies (INFO)
longbridge_wscliwarnEvery WebSocket frame, auth token included (INFO)
longbridge::tradewarnOrder push events (INFO)
rmcpinfoDecoded 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.

MethodPathDescription
GET/.well-known/oauth-protected-resourceProtected Resource Metadata (RFC 9728)
GET/.well-known/oauth-authorization-serverAuthorization Server Metadata (RFC 8414); advertises direct Longbridge authorize/register and proxied token/revoke endpoints
POST/oauth2/tokenOAuth token proxy; derives x-dc-region from the code/refresh token, defaulting to AP
POST/oauth2/revokeOAuth revocation proxy; derives x-dc-region from the token, defaulting to AP
GET/metricsPrometheus metrics
POST/GET/DELETE/mcpMCP 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

bash
cargo +nightly fmt      # format
cargo clippy            # lint
cargo test              # test

License

Released under the MIT License.

Utilisez le serveur MCP Longbridge avec plusieurs modèles IA

TypingMind connecte les outils MCP au niveau de l’espace de travail. Une fois Longbridge connecté, vous pouvez donc l’utiliser avec différents modèles IA dans TypingMind sans avoir à le configurer séparément pour chaque modèle. Cette intégration MCP s’exécute localement sur votre appareil via le connecteur MCP de TypingMind.

Guide de configuration du connecteur local

Choisissez cette méthode si le serveur MCP doit accéder à des fichiers locaux, à des applications ou à des ressources privées sur votre ordinateur.

1

Ouvrir les paramètres MCP

Dans TypingMind, accédez à « Paramètres », puis à « Paramètres avancés » et à « Model Context Protocol », et choisissez « Configurer connecteur ».

  1. Ouvrez TypingMind dans votre navigateur.
  2. Cliquez sur l’icône Paramètres.
  3. Accédez aux paramètres avancés.
  4. Ouvrez la section Model Context Protocol.
  5. Cliquez sur « Configurer connecteur » et choisissez « Cet appareil ».
Écran de configuration du connecteur MCP de TypingMind avec l’option « Cet appareil » sélectionnée
2

Exécuter la commande du connecteur

Choisissez « Cet appareil », copiez la commande depuis TypingMind et exécutez-la dans Terminal. Laissez le processus en cours d’exécution pendant que vous utilisez MCP.

  1. Copiez la commande de configuration affichée par TypingMind.
  2. Ouvrez Terminal sur macOS ou Windows Terminal sur Windows.
  3. Collez et exécutez la commande.
  4. Autorisez l’installation du paquet si Terminal vous demande de confirmer.
  5. Gardez la fenêtre de Terminal ouverte et le processus en cours d’exécution pendant que vous utilisez les outils MCP.
3

Ajoutez Longbridge en tant que serveur

Lorsque l’état du connecteur affiche « Prêt », cliquez sur « Éditer serveurs » et collez la configuration du serveur MCP.

  1. Attendez que l’état du connecteur affiche « Prêt ».
  2. Cliquez sur « Éditer serveurs ».
  3. Collez la configuration du serveur MCP Longbridge.
  4. Enregistrez la liste des serveurs.
  5. Actualisez pour vérifier que le connecteur est toujours prêt.
Paramètres MCP de TypingMind affichant un serveur actif et le bouton « Éditer serveurs »
{
  "mcpServers": {
    "longbridge-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Utiliser la connexion avec différents modèles

Enregistrez la liste des serveurs, ouvrez « Plugins », activez les outils MCP de Longbridge, puis sélectionnez un modèle IA compatible dans TypingMind et utilisez les outils dans une discussion ou attribuez-les à un agent IA.

  1. Ouvrez la page Plugins dans TypingMind.
  2. Activez les outils MCP de Longbridge.
  3. Démarrez une discussion et choisissez le modèle IA que vous souhaitez utiliser.
  4. Utilisez les outils MCP dans le chat ou attribuez-les à un agent IA.
  5. Passez à un autre modèle IA selon vos besoins sans rétablir la connexion MCP.
Discussion TypingMind utilisant des outils MCP activés avec un modèle d’IA sélectionné
Pouvez-vous utiliser Longbridge pour m’aider dans cette tâche ?
Longbridge
Bien sûr. J’ai tout lu.
Voici ce que j’ai trouvé avec Longbridge.

Foire aux questions

À quoi sert le serveur MCP Longbridge ?

Longbridge est un serveur MCP qui permet aux applications IA compatibles d’accéder à des outils et à des informations contextuelles externes. Dans TypingMind, il vous suffit d’ajouter ce serveur MCP une seule fois pour rendre ses outils disponibles dans votre espace de travail IA.

Puis-je utiliser le serveur MCP Longbridge avec plusieurs modèles IA dans TypingMind ?

Oui. TypingMind connecte les outils MCP au niveau de l’espace de travail. Vous pouvez donc utiliser Longbridge avec différents modèles IA comme Claude, ChatGPT, Gemini ou d’autres modèles configurés dans TypingMind, sans avoir à configurer le serveur MCP séparément pour chaque modèle.

Pourquoi utiliser le connecteur MCP Longbridge avec TypingMind ?

TypingMind est l’une des meilleures interfaces de chat avec les LLM, car elle réunit plusieurs modèles IA, prompts, plugins, agents IA, clés API et outils MCP dans un seul espace de travail. Une fois Longbridge connecté, vous pouvez utiliser ses outils MCP avec vos modèles préférés tout en gardant vos discussions bien organisées dans TypingMind.

Comment connecter le serveur MCP Longbridge à TypingMind ?

Longbridge fonctionne via le connecteur MCP local de TypingMind. C’est l’option idéale lorsque le serveur MCP doit accéder à des fichiers locaux, des applications de bureau, des outils en ligne de commande ou des ressources privées sur votre ordinateur.

Quels outils le serveur MCP Longbridge propose-t-il dans TypingMind ?

Longbridge propose des fonctionnalités MCP que vous pouvez activer depuis la page Plugins de TypingMind et utiliser dans les discussions ou attribuer à des agents IA.

Dois-je partager mes clés API avec TypingMind pour utiliser le serveur MCP Longbridge ?

Non. TypingMind privilégie le fonctionnement local et vous permet de garder le contrôle de vos fournisseurs de modèles, clés API, prompts et paramètres MCP. Si Longbridge nécessite une authentification, ajoutez les en-têtes, les paramètres OAuth ou la configuration locale requis pour ce serveur MCP lors de la création de la connexion.

Serveurs MCP similaires

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇