guangxiangdebizi/FinanceMCP
About
This is an MCP for the financial domain. By integrating the Tushare API and Binance API, it provides language models such as Claude with comprehensive access to real-time financial data and supports multidimensional analysis of financial data, including stocks, funds, bonds, macroeconomic indicators, stablecoins, and virtual currencies. It also includes financial data queries, financial news queries, and National Bureau of Statistics data queries.
Business & FinanceMeasured star growth
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README_EN.md
Original
FinanceMCP Synapse
Unified, routable, and attributable multi-market financial data for AI agents
19 stable MCP tools · Tushare / Qveris / Binance · stdio + Streamable HTTP
Quick start · Routing · API access · Tools · Security · Star history · 中文
[!WARNING] Service status: the public hosted service is temporarily unavailable. The former public domain has expired, so there is currently no official live demo or hosted
/mcpendpoint. A replacement domain may be introduced later and will be announced in this repository. The npm package, local stdio usage, and self-hosted deployments are unaffected.
[!IMPORTANT] v4.11.2 hardens Twingly news routing with input and request-size validation, safer provider fallback, dynamic tool schemas, and additional sensitive-header redaction. The existing 19 tool names and primary integration patterns remain unchanged.
[!NOTE] To share model prompt/KV-cache routing and conversation lineage across Trae, Cursor, Claude Code, and Codex, optionally run the standalone
finance-cache-gateway. It uses a separate process, port, and configuration; existing MCP tools, stdio, and/mcpbehavior remain unchanged when it is not enabled.
🔗 Project Integration: FinNote Intelligent Financial Document System
FinanceMCP has been integrated with MarkiNote to form FinNote, an end-to-end system for financial research, AI-assisted analysis, and intelligent document management. The project participated in the Shanghai Collegiate Computer Application Ability Competition and received a Second Prize.
🌐 Live Demo: temporarily unavailable; the domain may change later 📝 MarkiNote: https://github.com/wink-wink-wink555/MarkiNote
Within the FinNote architecture, FinanceMCP acts as the core financial data and MCP tool service layer. Built with Node.js, Express, and the Model Context Protocol (MCP) SDK, it currently exposes 19 stable MCP tools that provide AI agents with access to stocks, funds, bonds, macroeconomic data, financial news, technical indicators, and multi-market financial data. It supports both local stdio and remote Streamable HTTP transports.
MarkiNote serves as the upper-layer AI Agent-powered document and knowledge management system, handling natural-language interaction, AI analysis presentation, Markdown document generation, editing, and long-term knowledge preservation. In the FinNote use case, MarkiNote accesses FinanceMCP through the HTTP / MCP service workflow, allowing real-time financial data capabilities to participate directly in the agent's reasoning and document-generation process.
The resulting workflow is:
Natural-language request → AI Agent task understanding → FinanceMCP tool invocation → Multi-source financial data retrieval → AI-assisted analysis → Markdown document generation → Document management and knowledge preservation
FinanceMCP can therefore be used not only as a standalone financial-data MCP server for MCP clients and AI agents such as Claude, Cursor, and Codex, but also as the financial data infrastructure behind higher-level AI applications such as FinNote, providing unified, structured, callable, and attributable financial data for intelligent research, financial analysis, and document-oriented agents.
✨ Highlights
| Capability | Description | |
|---|---|---|
| 🔌 | Non-invasive extension | Keeps the existing 19 tool names and schemas; routing happens in request context |
| 🧭 | Intelligent routing | Supports Tushare, optional Qveris, Binance, and public news sources |
| 🔁 | Automatic fallback | Continues by priority when a preferred source is unsupported, unavailable, rate-limited, or times out |
| 🏷️ | Transparent attribution | Every result identifies its source and includes the fallback route when one occurred |
| 🛡️ | Request isolation | HTTP credentials are isolated with AsyncLocalStorage and redacted from logs |
| 📈 | Multi-market coverage | China, Hong Kong, US, indices, funds, bonds, futures, FX, macro, and crypto |
| 🧮 | Indicator engine | MACD, RSI, KDJ, BOLL, and MA with automatic history prefetch |
| 🚀 | Two transports | Local stdio and remote Streamable HTTP |
🧭 Data-source routing
flowchart LR
C[AI / MCP Client] -->|Existing 19 tools| R{FinanceMCP Router}
R -->|Default first| T[Tushare]
R -->|Global news| G[Twingly]
R -->|Optional extension| Q[Qveris]
R -->|Crypto| B[Binance]
R -->|News / Time| L[Public sources and local compute]
Q -. Unsupported / timeout / rate limit .-> T
T -. Not applicable .-> B
T & G & Q & B & L --> O[Attributed MCP result]
HTTP headers
X-Tushare-Token: YOUR_TUSHARE_TOKEN
X-Qveris-Api-Key: YOUR_QVERIS_API_KEY
X-Twingly-Api-Key: YOUR_TWINGLY_API_KEY
X-Finance-Source-Priority: twingly,qveris,tushare,binance
Default priority:
tushare,twingly,qveris,binance
Routing behavior:
- With one credential, FinanceMCP prefers the matching provider.
- With multiple credentials and no custom order, Tushare remains first; news tools then try Twingly before Qveris and public sources.
X-Finance-Source-Prioritychanges the order per request; unknown values are ignored, duplicates removed, and omitted providers appended in default order.- Unsupported or failed preferred sources fall back automatically. A valid empty result does not trigger duplicate upstream calls.
- Qveris runs Discover → Inspect → Probe → Call, with at most one potentially billable Call per MCP request.
Example result prefix:
数据来源: Tushare
数据源路由: Qveris(不支持)→ Tushare(成功)
Existing tool output...
[!NOTE] Qveris is optional. FinanceMCP does not call Qveris or consume credits unless
X-Qveris-Api-Key/QVERIS_API_KEYis present. See the Qveris REST API.
[!NOTE] Twingly is an optional global-news source and is never called without
X-Twingly-Api-Key/TWINGLY_API_KEY. FinanceMCP returns only titles, attribution, timestamps, URLs, language/region, and deduplication metadata; it does not return or persist article bodies.
Credential-scoped tool discovery
tools/list filters the MCP catalog by credentials on the current request. A
Twingly-only request exposes the two existing news tools, a Qveris-only request exposes only tools covered by the Qveris adapter, and a
Tushare-only request exposes Tushare-backed tools; both credentials expose the
union. With no credential, only public and local tools are listed. tools/call
enforces the same scope.
🔑 Data providers and API access
| Provider | Credential | Official access | FinanceMCP configuration |
|---|---|---|---|
| Tushare Pro | Token required | Create an account · Get a Token | stdio: TUSHARE_TOKEN; HTTP: X-Tushare-Token |
| Qveris | API key required | Dashboard / API Keys · Documentation | stdio: QVERIS_API_KEY; HTTP: X-Qveris-Api-Key |
| Twingly News Search | API key required | Dashboard / API Key · News API | stdio: TWINGLY_API_KEY; HTTP: X-Twingly-Api-Key |
| Binance Public API | Not required | Spot REST API documentation | No configuration; crypto market data uses public endpoints automatically |
| Baidu News | Not required | No developer API application required | No configuration; used by finance_news |
| Local system clock | Not required | None | No configuration; used only by current_timestamp |
Tushare Token
- Register and sign in at Tushare.
- Open Profile → Account and TOKEN, then copy the Token. See the official Token guide.
- Set
TUSHARE_TOKENlocally, or pass the Token inX-Tushare-Tokenfor remote MCP requests.
[!TIP] 🎓 Verified university students can receive 2,000 Tushare points for free. The current official process asks students to complete their school/profile information, join the university user group, and submit a student ID or CHSI verification screenshot together with their Tushare ID. Follow the latest instructions on the student-points page. Tushare's service terms state that verified university students and teaching staff can receive 2,000 / 5,000 points, respectively. Point thresholds and request limits vary by endpoint; check the relevant API documentation and the permissions page.
Qveris API key
- Sign in to Qveris and open Dashboard / API Keys.
- Create and copy an API key. Qveris currently includes 1,000 credits for new accounts; Discover and Inspect are free, while an actual Call may be billed by capability.
- Set
QVERIS_API_KEYlocally, or pass it in the dedicatedX-Qveris-Api-Keyheader for remote MCP requests.
Twingly API key
- Sign in to the Twingly Dashboard, then copy the API key shown in the top-right corner and check the remaining quota.
- Set
TWINGLY_API_KEYlocally, or pass it in the dedicatedX-Twingly-Api-Keyheader for remote MCP requests. - Twingly stays behind
finance_newsandhot_news_7x24; authentication failures, rate limits, service failures, and empty matches fall through to the next configured provider. Caller input validation failures do not fall through to a provider with different search semantics. finance_newstreats whitespace-separated input as required terms by default. Use double quotes for an exact phrase, for example"Federal Reserve" inflation. Twingly accepts at most 250 combined terms and a 16 KiB UTF-8 request body; either limit is validated before the upstream request is sent.- Twingly returns at most 250 documents per request. When Twingly is the current preferred news source,
tools/listadvertises 250 as thehot_news_7x24.limitschema maximum; other providers may advertise their own limits.
Keyless providers
- Binance: FinanceMCP calls only public Kline endpoints with security type
NONE; no Binance account, API key, or trading permission is required. - Baidu News: public news search requires no developer credential. If the network or upstream search is unavailable, routing may try a Qveris news capability according to the configured priority.
[!WARNING] Never put a live Token or API key in a README, checked-in MCP example, or Git commit. Use
.env, client environment variables, or per-request HTTP headers.
🚀 Quick start
npm / stdio
npx -y finance-mcp
Local MCP configuration for Claude Desktop, Cursor, and similar clients:
{
"mcpServers": {
"finance-mcp": {
"command": "npx",
"args": ["-y", "finance-mcp"],
"env": {
"TUSHARE_TOKEN": "YOUR_TUSHARE_TOKEN",
"QVERIS_API_KEY": "YOUR_QVERIS_API_KEY",
"TWINGLY_API_KEY": "YOUR_TWINGLY_API_KEY",
"FINANCE_SOURCE_PRIORITY": "tushare,twingly,qveris,binance"
}
}
}
}
Streamable HTTP
The public hosted endpoint is currently unavailable. Until a replacement domain is announced, use the local stdio configuration above or deploy your own Streamable HTTP service:
{
"mcpServers": {
"finance-mcp": {
"type": "streamableHttp",
"url": "https://your-finance-mcp.example/mcp",
"timeout": 600,
"headers": {
"X-Tushare-Token": "YOUR_TUSHARE_TOKEN",
"X-Qveris-Api-Key": "YOUR_QVERIS_API_KEY",
"X-Twingly-Api-Key": "YOUR_TWINGLY_API_KEY",
"X-Finance-Source-Priority": "twingly,qveris,tushare,binance"
}
}
}
}
All three credentials are optional and may be supplied independently. Authorization: Bearer ... and X-Api-Key remain compatible Tushare token forms; Qveris and Twingly use dedicated headers.
Environment variables
| Variable | Default | Purpose |
|---|---|---|
TUSHARE_TOKEN |
empty | Tushare credential |
QVERIS_API_KEY |
empty | Qveris credential |
QVERIS_BASE_URL |
https://qveris.ai/api/v1 |
Qveris REST API base URL |
TWINGLY_API_KEY |
empty | Twingly News Search credential |
TWINGLY_BASE_URL |
https://data.twingly.net/news/b/search/v1/search |
Twingly News Search API URL |
FINANCE_SOURCE_PRIORITY |
tushare,twingly,qveris,binance |
Default stdio/server priority |
PORT |
3000 |
HTTP server port |
MCP_HTTP_HOST |
127.0.0.1 |
HTTP bind address; containers use 0.0.0.0 |
MCP_ALLOWED_HOSTS |
loopback hostnames | Comma-separated hostname allowlist (without ports); recommended for non-loopback deployments |
Run your own remote instance (optional)
There is currently no official hosted endpoint. If you want a dedicated /mcp
URL of your own, the root Dockerfile deploys as-is: it starts
node build/httpServer.js, binds 0.0.0.0, reads PORT from the environment,
and answers GET /health. Any future official domain will be announced in this
repository.
docs/deploy-dockhold.md is a worked example on
Dockhold, one managed host among others and not an
affiliated or preferred one, covering the HTTPS endpoint, where TUSHARE_TOKEN
and QVERIS_API_KEY go, and why MCP_ALLOWED_HOSTS is strongly recommended
once the server is publicly reachable.
🧰 19 MCP tools
| Tool | Purpose | Data provider / API |
|---|---|---|
current_timestamp |
Current UTC+8 timestamp | Local system clock |
finance_news |
Financial-news keyword search | Twingly* · Baidu News · Qveris* |
stock_data |
Multi-market history and technical indicators | Tushare Pro · Qveris* · Binance Public API (crypto) |
stock_data_minutes |
China A-share and crypto intraday bars | Tushare Pro · Qveris* · Binance Public API (crypto) |
index_data |
Index history, metadata, and valuation | Tushare Pro · Qveris* |
macro_econ |
GDP, CPI, PPI, PMI, Shibor, LPR, Libor, Hibor, and more | Tushare Pro · Qveris* |
company_performance |
China company, statement, dividend, ownership, and valuation data | Tushare Pro · Qveris* |
company_performance_hk |
Hong Kong income, balance-sheet, and cash-flow statements | Tushare Pro · Qveris* |
company_performance_us |
US financial statements and indicators | Tushare Pro · Qveris* |
fund_data |
Fund NAV, holdings, dividends, and profiles | Tushare Pro |
fund_manager_by_name |
Fund-manager and managed-fund lookup | Tushare Pro |
convertible_bond |
Convertible-bond lifecycle data | Tushare Pro |
block_trade |
Block-trade details | Tushare Pro |
money_flow |
Stock, market, sector, and cross-border flows | Tushare Pro |
margin_trade |
Margin financing, securities lending, and refinancing | Tushare Pro |
csi_index_constituents |
CSI performance, weights, and financial summaries | Tushare Pro · Qveris* |
dragon_tiger_inst |
Dragon-Tiger institutional trades | Tushare Pro |
hot_news_7x24 |
Deduplicated 7×24 financial headlines | Tushare Pro · Twingly* · Qveris* |
futures_data |
Futures-member position rankings | Tushare Pro |
Qveris* is a dynamic capability-routing layer. It selects an integrated upstream provider for each request (for example, Finnhub or Tiingo) and returns the chosen provider, capability ID, and source attribution with the Tool result. Tools without Qveris in this table report the capability as unsupported before falling back to their listed native provider.
📊 Technical indicators
macd(12,26,9) rsi(14) kdj(9,3,3) boll(20,2) ma(5) ma(10) ma(20)
stock_data automatically fetches the extra history required by each indicator, computes the series, and then trims it to the requested date range. Indicator requests stay on native sources to preserve established calculations and formatting.
🛠️ Development
git clone https://github.com/guangxiangdebizi/FinanceMCP.git
cd FinanceMCP
cp .env.example .env
npm ci
npm test
npm run start:stdio # stdio
npm run start:http # http://127.0.0.1:3000/mcp
node_modules/ and build/ are generated locally and intentionally untracked. npm's prepare lifecycle builds the project before publishing, and only the required build/ output enters the package tarball.
🛡️ Security
- API keys are read only from request headers or environment variables and never committed.
- HTTP credentials are isolated per request; sensitive headers are logged as
[REDACTED]. QVERIS_BASE_URLrequires HTTPS except for loopback regression tests.- Qveris candidates pass read-only filtering, parameter probing, response-size limits, and timeouts.
- Git ignore rules cover
.env, dependencies, build output, logs, and local research artifacts.
⭐ Star history
If FinanceMCP is useful to you, consider leaving a ⭐. The repository's own GitHub Actions refreshes this chart every Monday (or on demand) with its temporary GITHUB_TOKEN, without third-party stargazer scraping or long-lived credentials.
🤝 Ecosystem and contributions
- FinanceMCP can serve as the financial-data backend for FinNote / MarkiNote.
- Live endpoint: public hosting is temporarily unavailable; the domain may change later
- MCP ecosystem listings: Glama · Smithery · MCP Toplist
- Video guide: Complete FinanceMCP tutorial
- Bugs and feature requests: GitHub Issues
Issues and pull requests are welcome. New provider capabilities should extend the existing aggregate tools whenever possible rather than creating one public tool per upstream endpoint.
📄 License
Explore related projects
Loading…