mcp-finance
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
English | 简体中文
⚡ Quick Start
pip install mcp-markets
# Mode 1: Run as an MCP Server (for Claude / Codex / Cursor)
python -m mcp_finance.server
# Mode 2: Launch the built-in Web Dashboard
mcp-dashboard # default http://localhost:8080Python 3.10+ · MCP Python SDK 2.x · Zero config · Optional
TUSHARE_TOKENenv var for advanced fundamentals
Related MCP server: Stock SDK MCP Server
✨ Capabilities at a Glance
Module | Capability | Highlight |
📈 Real-time Quotes | A-Share / HK / US / Futures / Indices | easy-tdx millisecond-level with tri-source fallback |
📊 K-line Data | Daily / Weekly / Monthly / Minute bars, adj. | 800 bars for A-shares, yfinance fallback for HK/US |
🔬 Technical Analysis | MA·MACD·KDJ·RSI·BOLL·WR·BIAS | Auto-detect golden/dead cross & overbought/oversold |
🔍 Stock Screener | 11-dimension filter + 5-factor ranking | Momentum · Value · Quality · Growth · Volatility |
🧪 Backtesting | 9 strategies + parameter optimization | Backtrader event-driven, 125× performance boost |
💼 Portfolio | Multi-stock comparison + correlation + portfolio backtest | Equal-weight or custom weights |
🏢 Fundamentals | Financials / Holdings / Research / Dragon-Tiger | AKShare + Tushare dual source |
🖥️ Web Dashboard | Flask real-time dashboard | Plotly + ECharts interactive charts |
🏗️ Four-Source Architecture
graph LR
A["📡 Data Sources"] --> B["⚡ easy-tdx<br/>TDX TCP · <50ms"]
A --> C["🌐 AKShare<br/>Sina / THS / EastMoney"]
A --> D["🌍 yfinance<br/>Yahoo Finance Fallback"]
A --> E["📈 Tushare<br/>Deep Fundamentals · Token"]
B --> F["🔧 31 MCP Tools"]
C --> F
D --> F
E --> F
F --> G["📈 Quotes<br/>Real-time · Batch · K-line"]
F --> H["🔬 Technical<br/>MA·MACD·KDJ·RSI·BOLL"]
F --> I["📋 Screening<br/>Conditional · 5-Factor"]
F --> J["⚙️ Backtest<br/>9 Strategies · Bayesian Opt"]
F --> K["📊 Portfolio<br/>Comparison · Correlation"]
F --> L["🏢 Fundamentals<br/>Financials · Research · Flow"]
F --> M["🖥️ Dashboard<br/>Flask Web · Live Refresh"]
style A fill:#1e1b4b,stroke:#6366f1,color:#fff
style F fill:#0f172a,stroke:#334155,color:#fff
style G fill:#312e81,color:#fff
style H fill:#312e81,color:#fff
style I fill:#312e81,color:#fff
style J fill:#312e81,color:#fff
style K fill:#312e81,color:#fff
style L fill:#312e81,color:#fff
style M fill:#be185d,color:#fff🎯 All 31 MCP Tools
Quotes & Market Data
Tool | Description | Data Source | Latency |
| Single-stock real-time quote (price / change / volume ratio / turnover) | easy-tdx → AKShare → yfinance | < 100ms |
| Batch real-time quotes for multiple stocks | easy-tdx | < 1s / batch |
| Daily / Weekly / Monthly K-line with forward/backward adjust | easy-tdx (A) / AKShare+yfinance (HK/US) | < 500ms |
| 1/5/15/30/60 minute K-line (A-shares only) | easy-tdx | < 200ms |
| A-share / HK / US market indices | easy-tdx → AKShare | < 500ms |
| China commodity & index futures main contracts | AKShare Sina | ~1s |
| Fuzzy search by code or name | Local mapping | Instant |
Technical Analysis
Tool | Description |
| MA·MACD·KDJ·RSI·BOLL·WR·BIAS + auto signal detection |
| Interactive candlestick HTML with moving averages, volume, MACD/KDJ/RSI sub-charts |
Screening & Analysis
Tool | Description |
| 11-dimension conditional screening (change / volume ratio / turnover / PE / PB / ROE / market cap…) |
| 5-factor composite scoring & ranking (momentum · value · quality · growth · volatility) |
| One-stop stock analysis report (quote + technicals + financials + score 0-100) |
| Multi-stock comparison ranked by score |
| Return correlation matrix for diversification |
Backtesting & Optimization
Tool | Description | Strategies |
| Single-stock strategy backtest | MA Cross · MACD · RSI · KDJ · BOLL · Turtle · Vol Trend · Mean Reversion · Custom Combo |
| Grid search / Optuna TPE Bayesian optimization | Auto-pruning + parameter importance |
| Walk-Forward out-of-sample validation | Rolling train/test · overfitting assessment |
| Monte Carlo robustness test | Return reshuffling · probability and drawdown distributions |
| Multi-stock portfolio backtest | Custom weights / equal weight |
Market Intelligence
Tool | Description |
| Industry / Concept / Region sector rankings |
| North/South-bound capital flow (Stock Connect) |
| Individual stock fund flow (easy-tdx millisecond-level) |
| Dragon & Tiger list (broker buy/sell details) |
| Block trade details |
| Margin trading & short selling data |
| China macroeconomics (GDP / CPI / PMI / M2 / FX reserves) |
Fundamentals
Tool | Description |
| 5 categories, 19+ indicators (core / profitability / growth / risk / operations) |
| Top 10 shareholders & institutional holdings |
| Analyst research reports (ratings + price targets) |
| Multi-stock normalized comparison chart (interactive HTML) |
| One-click diagnostic of all data source availability |
🖥️ Web Dashboard
Built-in Flask dashboard that visualizes all MCP tool capabilities.
mcp-dashboard # http://localhost:8080
mcp-dashboard 3000 # custom port
mcp-dashboard --host 0.0.0.0 # explicitly allow LAN accessPage | Route | Features |
Market Overview |
| Indices · Hot stocks · Sector rankings · North flow · K-line lookup · Search |
Screener |
| 5-factor ranking + 11-dimension conditional screening |
Backtest | /backtest | 9 strategies · Grid / Bayesian optimization · Walk-Forward · Monte Carlo (Dashboard and MCP) |
Responsive layout · Plotly / ECharts interactive charts · Live quote refresh
🔌 MCP Client Setup
{
"mcpServers": {
"mcp-finance": {
"command": "python",
"args": ["-m", "mcp_finance.server"]
}
}
}codex mcp add mcp-finance -- python -m mcp_finance.server{
"mcpServers": {
"mcp-finance": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_finance.server"]
}
}
}Optional: Tushare fundamentals — Set
TUSHARE_TOKEN=your_tokenenv var. Register free. Falls back gracefully without it.
🧪 Development & Testing
git clone https://github.com/xiaobinzhe/finance-anyl-mcp.git
cd finance-anyl-mcp
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Lint
ruff check mcp_finance/🌟 AI Conversation Examples
Scenario | Natural Language Query |
Quote | "What's the price of Moutai (600519)?" / "How are Tencent HK and Apple US doing today?" |
Technical | "Is Moutai's MACD golden cross? What's the RSI?" |
Screening | "Find A-shares up >3%, volume ratio >1.5, PE <30" / "Top 20 by 5-factor ranking" |
Backtest | "Backtest MA cross (5,20) on Moutai for 2024" / "Find the best MACD params for Moutai" |
Portfolio | "Backtest equal-weight portfolio of Moutai + CATL + CMB for the past year" |
Analysis | "Give me a comprehensive analysis of Moutai" / "Compare Moutai, Wuliangye, Luzhou Laojiao" |
Macro | "Show me recent China CPI data" / "What is north-bound capital buying recently?" |
Research | "Latest analyst ratings for Moutai" |
⚠️ Disclaimer
This tool is for educational purposes only. All data is for reference and does not constitute investment advice.
Data is sourced from third-party public APIs and web scraping, with no guarantee of accuracy, completeness, or timeliness
No proprietary data sources; all data depends on easy-tdx (reverse-engineered TDX protocol), AKShare (web scraping), yfinance, and Tushare
No commercial data license; personal non-commercial use is acceptable, commercial use carries copyright and compliance risks
Backtest results do not predict future performance
The author bears no responsibility for any investment losses · Invest at your own risk
📄 License
MIT © mcp-finance
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
China A-share data for AI agents: 57 read-only tools plus 6 tools for your own watchlist.
Six-market financial data (A/US/HK stocks, crypto, indices, ETFs): symbols, klines, macro.
China A-share market data over MCP: 22 tools for quotes, K-line, financials, money flow, top-trader boards, sectors, macro, convertible bonds and factor screening. Five tools need no API key, so you can connect and try it immediately.
Access real-time and historical market data for China A-shares and Hong Kong stocks, along with ne…
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to query real-time and historical market data across A-shares, Hong Kong, US stocks, funds, futures, and options, including K-lines, technical indicators (MA/MACD/BOLL/KDJ/RSI), sector and capital-flow data. It also provides composite analysis tools, presets, and prompts for stock screening, multi-stock comparison, portfolio monitoring, and market overviews.140 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to fetch real-time and historical market data across A-shares, Hong Kong and US equities, funds, futures, and options, including technical indicators, sector and capital-flow data, and trading calendars. It also provides composite analysis tools and built-in prompts/skills for full-stock diagnostics, multi-stock comparison, market overviews, conditional screening, and portfolio monitoring.140 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to query real-time and historical market data across A-share, Hong Kong, US, and fund markets, including quotes, K-line data, technical indicators, sector and futures/options data. It also supports batch market scans, composite stock analysis, condition-based screening, and built-in analyst prompts and skills for financial workflows.140 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to query real-time and historical market data for A-shares, Hong Kong, US stocks, funds, futures, options, and sectors, calculate technical indicators, and run screening and composite analysis workflows. It also exposes prompts and resources for stock analysis, market overviews, monitoring, and futures data.140 npmISC