lb-mcp-ui-proxy
An MCP proxy server that enriches Longbridge's financial API with UI-enhanced tools. It transforms JSON responses into interactive dashboards such as stock cards, candlestick charts, and portfolio views for any MCP host.
README
Longbridge MCP-UI Proxy
An MCP (Model Context Protocol) proxy server that wraps the Longbroker OpenAPI MCP server and transforms its plain JSON responses into rich, interactive HTML dashboards — stock cards, candlestick charts, portfolio views, order forms, option chains, and more.
Built on the MCP-UI specification so any MCP host that renders ui:// resources (Goose, Claude Desktop, etc.) gets visual UIs instead of raw JSON.
Quick start
# 1. Install dependencies
npm install
# 2. Set your Longbridge token
export LONGBRIDGE_TOKEN="your_token_here"
# Generate a token at https://open.longbridge.com/connect
# 3. Run in dev mode (auto-restart on changes)
npm run dev
# 4. Or build and run production
npm run build
npm start
The server starts on http://localhost:3456 by default.
Docker
docker build -t lb-mcp-ui-proxy .
docker run -p 3456:3456 -e LONGBRIDGE_TOKEN=your_token lb-mcp-ui-proxy
Configuration
All config is via environment variables (see .env.example):
| Variable | Default | Description |
|---|---|---|
PORT |
3456 |
Server listen port |
LONGBRIDGE_MCP_URL |
https://openapi.longbridge.com/mcp |
Longbridge MCP backend URL |
LONGBRIDGE_TOKEN |
(required) | Bearer token for Longbridge API |
LOG_LEVEL |
info |
Logging verbosity: debug, info, warn, error |
How it works
┌──────────┐ MCP (Streamable HTTP) ┌──────────────────┐ MCP (Streamable HTTP) ┌──────────────────┐
│ MCP Host │ ◄───────────────────────► │ lb-mcp-ui-proxy │ ◄───────────────────────► │ Longbridge MCP │
│ (Goose, │ ui:// HTML resources │ (this server) │ JSON tool calls │ (openapi. │
│ Claude) │ │ │ │ longbridge.com) │
└──────────┘ └──────────────────┘ └──────────────────┘
- An MCP host connects to this proxy at
POST /mcpusing the Streamable HTTP transport. - The proxy exposes 11 UI-enhanced tools (prefixed
lb_). - When the host calls a tool, the proxy:
- Opens a session to the real Longbridge MCP server.
- Forwards the tool call (e.g.
get_quote→ Longbridge). - Parses the JSON response.
- Renders an interactive HTML dashboard via
@mcp-ui/server'screateUIResource. - Returns the HTML as a
ui://longbridge/...resource that the host renders.
Tools
| Proxy tool | Longbridge tool | UI |
|---|---|---|
lb_quote |
get_quote |
Stock card with price, change, OHLCV, amplitude bar |
lb_chart |
get_candlesticks |
Canvas-rendered candlestick chart with volume bars |
lb_search |
search_security |
Search results table with symbol, name, exchange |
lb_portfolio |
get_account_summary + get_positions |
Portfolio dashboard with P&L, positions table |
lb_orders |
get_orders |
Orders table with status badges |
lb_place_order |
place_order |
Interactive order form or direct order with confirmation |
lb_option_chain |
get_option_chain |
Color-coded calls/puts table with Greeks |
lb_alerts |
get_alerts |
Alerts list with toggle switches |
lb_market_overview |
get_market_status |
Market indices and status (text) |
lb_dca_plans |
get_dca_plans |
DCA plans dashboard with progress cards |
Tool parameters
All tools accept their parameters as Zod-validated fields. Examples:
# Get a quote for Tesla
lb_quote(symbol: "TSLA.US")
# Candlestick chart
lb_chart(symbol: "TSLA.US", period: "1d", count: 100)
# Place a limit order
lb_place_order(symbol: "TSLA.US", side: "buy", type: "limit", price: 250.00, quantity: 10)
# Show the interactive order form
lb_place_order(_showForm: true)
API endpoints
| Endpoint | Method | Description |
|---|---|---|
/mcp |
POST |
MCP Streamable HTTP endpoint (session-based) |
/health |
GET |
Health check — returns status, version, config check |
Project structure
src/
├── index.ts # Express server, MCP endpoint, session management
├── config.ts # Environment variable config loader
├── longbridge-client.ts # MCP client wrapper for Longbridge backend
├── tools/
│ └── register.ts # Tool definitions — wires params → Longbridge → UI
└── ui/
├── styles.ts # Shared CSS, HTML page wrapper, formatting helpers
├── quotes.ts # Quote card + search results
├── chart.ts # Candlestick chart (canvas)
├── portfolio.ts # Portfolio dashboard + positions table
├── orders.ts # Orders table + order form + confirmation
├── options.ts # Option chain + price alerts
└── dca.ts # DCA plans dashboard
Development
# Dev server with hot reload
npm run dev
# Type-check only
npx tsc --noEmit
# Build for production
npm run build
Tech stack
- Runtime: Node.js 22, TypeScript (ESM)
- MCP SDK:
@modelcontextprotocol/sdk(Streamable HTTP transport, both client and server) - UI rendering:
@mcp-ui/server(createUIResourcewith raw HTML) - Web server: Express + CORS
- Validation: Zod (tool parameter schemas)
- Container: Docker (multi-stage build, Alpine)
License
Private — not yet licensed for distribution.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。