← Back to directory
A

A-Share MCP Server

Community
MCP server for China A-share market data and financials via Baostock
GitHub source repository ↗
★ 646 Stars Category · Other Popular Source revision 4a2d4b730e13
64FMRS · C
Reliability
7/20
Security and permissions
15/20
Maintenance
12/20
Documentation
16/20
Setup experience
14/20

This server offers broad coverage (41 tools) for China A-share market, financial, and macroeconomic data queries. Setup requires manually specifying absolute paths and the project was primarily developed/validated on Windows, making it suitable for individual developers and research use, but it lacks authentication and depends on a free third-party data source, so it is not suited for production environments requiring strict data reliability or timeliness.

Read the FMRS scoring method →

a-share-mcp is an MCP server focused on the China A-share stock market, built on the free Baostock data source. It exposes 41 tools covering stock basic info, historical K-line (candlestick) data, adjustment factors, dividend records, six categories of financial indicators (profitability, operations, growth, solvency, cash flow, DuPont analysis), performance express/forecast reports, index constituents (SSE 50, CSI 300, CSI 500), industry classification, macroeconomic data (deposit/loan rates, reserve requirement ratio, money supply), and trading-calendar/date utilities. It is written in Python, managed with uv, and communicates with MCP clients over stdio.

Tools

get_historical_k_data
get_stock_basic_info
get_dividend_data
get_adjust_factor_data
get_profit_data
get_operation_data
get_growth_data
get_balance_data
get_cash_flow_data
get_dupont_data
get_performance_express_report
get_forecast_report
get_fina_indicator
get_trade_dates
get_all_stock
search_stocks
get_suspensions
get_stock_industry
get_index_constituents
get_sz50_stocks
get_hs300_stocks
get_zz500_stocks
list_industries
get_industry_members
get_deposit_rate_data
get_loan_rate_data
get_required_reserve_ratio_data
get_money_supply_data_month
get_money_supply_data_year
get_latest_trading_date
get_market_analysis_timeframe
is_trading_day
previous_trading_day
next_trading_day
get_last_n_trading_days
get_recent_trading_range
get_month_end_trading_dates
get_stock_analysis
normalize_stock_code
normalize_index_code
list_tool_constants

Setup

1) Ensure Python 3.10+ and the uv package manager are installed; 2) Clone the repo and run uv venv in the project root to create a virtual environment; 3) Activate it (Windows: .venv\Scripts\activate; macOS/Linux: source .venv/bin/activate); 4) Run uv sync to install dependencies; 5) In an MCP-capable client (Cursor, VS Code, Trae, CherryStudio, etc.), add a stdio MCP server entry with command set to uv (or its absolute path) and args set to --directory, the absolute path to the project root, run, python, mcp_server.py; 6) If the client reports ModuleNotFoundError, also set workingDirectory to the project root's absolute path.

claude_desktop_config.json
{"mcpServers":{"a-share-mcp":{"command":"uv","args":["--directory","/path/to/a_share_mcp","run","python","mcp_server.py"],"transport":"stdio"}}}

Fit and risk

Best for

  • Developers who need programmatic access to A-share market and financial data
  • Users doing A-share Q&A or research/analysis through an AI assistant
  • Individuals wanting free A-share data access without a paid data account

Not for

  • High-frequency trading scenarios needing real-time tick-level or order-book data
  • Users needing Hong Kong, US, or other non-A-share market data
  • Institutional production environments with strict requirements on data accuracy/timeliness (data source is the free, unofficial Baostock service)

Required permissions

  • Runs a local Python process launched via uv
  • Outbound network access to fetch market and financial data from Baostock
  • No API keys or account credentials required

Risks and side effects

  • Data comes from the free third-party source Baostock, not officially guaranteed, with update delays (e.g. daily K-line data isn't stored until after 17:30)
  • The project was primarily developed and tested on Windows; cross-platform (macOS/Linux) compatibility is not thoroughly verified
  • No authentication mechanism — any client with access to the MCP server can call all tools and query all data
  • If Baostock's underlying interface changes, some tools may break without official support

Troubleshooting

  1. On ModuleNotFoundError, verify `uv sync` was run and try explicitly setting workingDirectory to the project root in the client config
  2. Confirm the uv path in `command` is accessible/executable by the client; use the absolute path to uv.exe if needed
  3. On Windows, escape paths with double backslashes (e.g. `C:\\Users\\...`); macOS/Linux use forward slashes with no escaping needed
  4. If today's data is missing, check Baostock's official data ingestion schedule (e.g. daily K-line after 17:30, minute K-line the next day after 11:00)
  5. In CherryStudio, if the enable toggle appears unresponsive after configuration, navigate to another menu and back to the MCP settings page to refresh the status

Use cases

Query a stock's historical K-line data, adjustment factors, and dividend/distribution records
Retrieve financial indicators such as profitability, growth, and solvency for listed companies
Look up constituents and industry classification for indices like SSE 50, CSI 300, CSI 500
Query macroeconomic data such as deposit/loan rates and money supply
Perform trading-calendar date calculations (previous/next trading day, last N days, etc.)

Supported clients

Claude DesktopPartial support
CursorFull support
VS CodeFull support
TraeFull support
CherryStudioFull support