AgentLadle MCP AKShare
AgentLadle MCP AKShare
English | ไธญๆ
๐จ๐ณ China A-Share Market โ Cloud-hosted MCP for annual financial reports (2023-2025). Read more | Get API Key
A MCP (Model Context Protocol) server that provides 46 financial data tools for AI assistants, covering A-share, HK, US markets, macroeconomics, funds, and derivatives โ powered by AKShare.
It enables AI assistants (Claude, Cursor, etc.) to access financial market data through 46 semantic tools โ from candlestick history to macro indicators, with unified symbol format, normalized output, and built-in caching/rate-limiting.
Features
46 MCP tools across 11 scopes: market, quote, flow, fundamentals, shareholders, content, sector, sentiment, IPO, macro, derivatives
Unified symbol format:
<code>.<market>(e.g.000001.SZ,00700.HK,AAPL.US) โ automatically converted to each AKShare function's required formatNormalized output: Chinese column names โ English snake_case with unit conversion (ไธๅ โๅ , ไบฟ่กโ่ก)
Built-in infrastructure: TTL cache (history 24h / realtime 10s), token-bucket rate limiter (10 QPS global), retry with fallback sources,
asyncio.to_threadasync wrappingoutputSchema: Each tool returns a typed
ToolResponsedataclass with structured output schemaTool annotations:
readOnlyHint,idempotentHint,openWorldHinton all toolsScope-based loading: Load a subset of tools via
AKSHARE_MCP_SCOPESenv var (e.g.market,quote)AI workflow hints: Each response includes a
hintfield guiding the next logical stepChinese keyword handling: AKShare's Chinese enum parameters (e.g.
ๅๅ่ต้) mapped to English (direction=north)Zero-config install โ one line to add to your MCP client, no clone or manual setup needed
Pure Python, cross-platform (Windows / macOS / Linux)
Related MCP server: smart-financial-mcp
Prerequisites
Python 3.10+ โ Download Python
uv โ Install uv
Note: After installing uv, restart your terminal and MCP client (e.g. Claude Desktop, Cursor) to ensure the
uvcommand is recognized.
Quick Start
Add to your MCP client configuration (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"mcp-akshare": {
"command": "uvx",
"args": ["agentladle-mcp-akshare"]
}
}
}That's it. uvx will automatically download the package and its dependencies from PyPI โ no clone, no manual install, no path configuration.
Optional: Scope filtering
To load only specific scopes (useful for clients with tool count limits):
{
"mcpServers": {
"mcp-akshare": {
"command": "uvx",
"args": ["agentladle-mcp-akshare"],
"env": {
"AKSHARE_MCP_SCOPES": "market,quote,fundamentals"
}
}
}
}Alternative: pip install
If you prefer managing the environment yourself:
pip install agentladle-mcp-akshareThen configure:
{
"mcpServers": {
"mcp-akshare": {
"command": "agentladle-mcp-akshare"
}
}
}Alternative: Run from source (local development)
Clone the repository and run directly:
git clone https://github.com/agentladle/mcp-akshare.gitThen configure your MCP client:
{
"mcpServers": {
"mcp-akshare": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-akshare", "agentladle-mcp-akshare"]
}
}
}Replace /path/to/mcp-akshare with the actual path to the cloned repository.
Data Flow
AKShare Library (1.18.40) MCP AKShare Server
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
stock_zh_a_hist() โโโ get_candlesticks()
stock_zh_a_spot_em() โโโ get_quote()
stock_financial_*() โโโ get_financial_statement/metrics()
stock_hsgt_hist_em() โโโ get_northbound_flow()
stock_zt_pool_em() โโโ get_limit_up_pool()
macro_china_gdp() โโโ get_macro_data()
fund_etf_hist_em() โโโ get_fund_nav_history()
โ
โโโ Symbol Normalizer (<code>.<market> โ func-specific format)
โโโ Param Normalizer (period/adjust/date/keyword enums)
โโโ Field Mapper (ไธญๆๅๅ โ English snake_case + unit conversion)
โโโ TTL Cache (history 24h / realtime 10s / fundamental 1h)
โโโ Rate Limiter (10 QPS global, 2 QPS per-interface)
โโโ Retry + Fallback (primary โ backup source)
โ
โผ
ToolResponse { status, data, hint, cached, source, updated_at }Tools
46 tools across 11 scopes. All tools are read-only with readOnlyHint=true.
Scope: market (4 tools)
Tool 1: get_trading_days
Get trading days for a market between dates.
Parameter | Type | Required | Description |
| string | โ |
|
| string | โ | Start date |
| string | โ | End date |
Tool 2: get_market_status
Get current trading status for all markets (CN/HK/US). No parameters.
Tool 3: get_security_list
List securities for a market.
Parameter | Type | Required | Description |
| string | โ |
|
| string | โ | A-share board: |
| int | โ | Max results (default 100, max 1000) |
| int | โ | Pagination offset (default 0) |
Tool 4: get_exchange_rate
Get major currency exchange rates.
Parameter | Type | Required | Description |
| string | โ | Base currency (default |
Scope: quote (5 tools)
Tool 5: get_candlesticks
Get candlestick (OHLCV) data for any asset class โ routes to the correct AKShare function based on asset_class ร period.
Parameter | Type | Required | Description |
| string | โ | Security symbol (e.g. |
| string | โ |
|
| string | โ |
|
| string | โ | Start date |
| string | โ | End date |
| string | โ |
|
| int | โ | Recent N bars (default 100, max 1000) |
Tool 6: get_quote
Get latest quote snapshot for one or more symbols.
Parameter | Type | Required | Description |
| string[] | โ | List of security symbols |
Tool 7: get_intraday
Get intraday time-share data.
Parameter | Type | Required | Description |
| string | โ | Security symbol |
| string | โ | Date |
Tool 8: get_depth
Get order book (bid/ask depth).
Parameter | Type | Required | Description |
| string | โ | Security symbol |
Tool 9: get_trades
Get recent trade ticks.
Parameter | Type | Required | Description |
| string | โ | Security symbol |
| int | โ | Number of trades (default 100, max 1000) |
Scope: flow (4 tools)
Tool 10: get_capital_flow
Get capital flow time series for a stock.
Parameter | Type | Required | Description |
| string | โ | Stock symbol |
| string | โ |
|
Tool 11: get_northbound_flow
Get northbound/southbound capital flow (Stock Connect).
Parameter | Type | Required | Description |
| string | โ |
|
| string | โ |
|
| string | โ | Individual stock (when |
| string | โ | Start date |
| string | โ | End date |
Tool 12: get_margin_trading
Get margin trading data (financing + short selling).
Parameter | Type | Required | Description |
| string | โ | Stock symbol (empty = market aggregate) |
| string | โ | Start date |
| string | โ | End date |
Tool 13: get_block_trade
Get block trade (ๅคงๅฎไบคๆ) records.
Parameter | Type | Required | Description |
| string | โ | Stock symbol (empty = all market) |
| string | โ | Start date |
| string | โ | End date |
Scope: fundamentals (8 tools)
# | Tool | Key Parameters |
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
Scope: shareholders (5 tools)
# | Tool | Key Parameters |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
Scope: content (4 tools)
# | Tool | Key Parameters |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
Scope: sector (4 tools)
# | Tool | Key Parameters |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
Scope: sentiment (6 tools)
# | Tool | Key Parameters |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
Scope: ipo (2 tools)
# | Tool | Key Parameters |
41 |
|
|
42 |
|
|
Scope: macro (4 tools)
# | Tool | Key Parameters |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
Scope: derivatives (8 tools)
# | Tool | Key Parameters |
47* |
|
|
48* |
|
|
49* |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
*Tools 47-49 cover fund data within the derivatives scope.
Configuration
On first run, a default config file is created at ~/.agentladle/mcp-akshare/config.yaml:
# MCP AKShare Server Configuration
cache:
ttl_history: 86400 # 24h โ historical daily data
ttl_realtime: 10 # 10s โ real-time quotes
ttl_fundamental: 3600 # 1h โ financial statements
ttl_calendar: 604800 # 7d โ trading calendar
ttl_company: 86400 # 1d โ company basic info
ttl_news: 300 # 5m โ news
max_size: 200 # max cached entries
ratelimit:
global_qps: 10 # global 10 QPS
per_interface_qps: 2 # per-interface 2 QPS
retry:
max_retries: 1
timeout: 30.0
retry_delay: 1.0
# Comma-separated scope list (empty = all scopes)
# Available: market,quote,flow,fundamentals,shareholders,content,sector,sentiment,ipo,macro,derivatives
scopes: []Environment Variables
Configuration can be overridden via environment variables (highest priority):
Variable | Description | Default |
| Comma-separated scopes to load (empty = all) |
|
| Global QPS limit |
|
| Per-interface QPS limit |
|
| Request timeout (seconds) |
|
| Max retry attempts |
|
| Cache TTL for historical data (seconds) |
|
| Cache TTL for real-time data (seconds) |
|
Data Directory Structure
~/.agentladle/mcp-akshare/
โโโ config.yaml # Configuration (auto-created)
โโโ data/ # Data directoryExample Usage
The tools are designed with an EAFP (Easier to Ask for Forgiveness than Permission) approach. AI assistants should directly invoke data retrieval tools and rely on the hint field for workflow guidance.
Scenario A: Get stock price history
User: "What's Apple's stock price trend over the last 30 days?"
1. get_candlesticks(symbol="AAPL.US", period="day", count=30)
โ Returns 30 daily OHLCV bars.
โ hint: "Use get_quote for real-time price, or get_financial_metrics for fundamentals."Scenario B: Fundamental analysis workflow
User: "Analyze Ping An Bank's fundamentals"
1. get_company(symbol="000001.SZ")
โ Returns company overview (industry, listing date, shares).
2. get_financial_metrics(symbol="000001.SZ", count=8)
โ Returns ROE, ROA, margins, debt ratio for 8 periods.
3. get_valuation(symbol="000001.SZ")
โ Returns current PE, PB, PS, dividend yield.
โ hint: "Use get_valuation_history for PE/PB trend."Scenario C: Discover valid symbols
User: "What stocks are in the CSI 300 index?"
1. get_index_constituent(symbol="000300.INDEX")
โ Returns 300 constituent stocks with weights.
2. get_candlesticks(symbol="600519.SH", count=10)
โ Get candlestick data for a specific constituent.Scenario D: Market sentiment
User: "How's the A-share market doing today?"
1. get_market_summary(market="CN")
โ Returns up/down/flat counts, limit-up/down counts, total turnover.
2. get_limit_up_pool()
โ Returns today's limit-up stocks with reasons.
โ hint: "Check consecutive_days for multi-day limit-ups."Tech Stack
Component | Choice | Purpose |
MCP Framework |
| MCP server with stdio/streamable-http transport |
Data Source |
| 1086+ financial data interfaces (A-share, HK, US, macro, funds) |
Config |
| YAML configuration file |
Async |
| Wrap sync akshare calls in async MCP handlers |
Cache | Built-in TTLCache | TTL + LRU eviction, per-category TTL |
Rate Limit | Built-in TokenBucket | Token bucket algorithm, global + per-interface |
Output Types |
| Structured outputSchema (no pydantic dependency) |
Build |
| PEP 621 standard build backend |
Package Manager |
| Fast dependency resolution + |
Project Structure
src/akshare_mcp/
โโโ __init__.py # Package version
โโโ __main__.py # python -m entry point
โโโ server.py # FastMCP init + tool registration + logging (stderr)
โโโ config.py # Config loading (~/.agentladle/mcp-akshare/config.yaml, singleton)
โโโ instances.py # Service singletons (lazy-loaded)
โโโ models.py # Internal data models (dataclass)
โโโ response.py # Response builders (success/error/skipped + hint)
โโโ scopes.py # 11 scope definitions + tool mapping
โโโ tools/ # Tool layer (thin: parameter validation + response wrapping)
โ โโโ market.py # scope: market (4 tools)
โ โโโ quote.py # scope: quote (5 tools)
โ โโโ flow.py # scope: flow (4 tools)
โ โโโ fundamental.py # scope: fundamentals (8 tools)
โ โโโ shareholder.py # scope: shareholders (5 tools)
โ โโโ news.py # scope: content (4 tools)
โ โโโ sector.py # scope: sector (4 tools)
โ โโโ sentiment.py # scope: sentiment (6 tools)
โ โโโ ipo.py # scope: ipo (2 tools)
โ โโโ macro.py # scope: macro (4 tools)
โ โโโ derivative.py # scope: derivatives (8 tools)
โโโ services/ # Business layer (thick: core logic)
โ โโโ base_service.py # Base class with config/retry accessors
โ โโโ market_service.py # Trading days, candlesticks, quotes, depth
โ โโโ fundamental_service.py # Financials, valuation, shareholders, IPO
โ โโโ flow_service.py # Capital flow, northbound, margin, block trade
โ โโโ news_service.py # News, filings, research reports
โ โโโ sentiment_service.py # Limit pools, dragon tiger, anomaly, summary
โ โโโ macro_service.py # Macro indicators, interest rates, bond yields
โ โโโ sector_service.py # Index constituents, sector quotes/rank
โ โโโ fund_service.py # Fund quote, NAV, holdings
โ โโโ derivative_service.py # Futures, options, bonds, forex, REITs
โ โโโ symbol_normalizer.py # Unified <code>.<market> โ function-specific format
โ โโโ param_normalizer.py # Period/adjust/date/keyword enum mapping
โ โโโ field_mapper.py # Chinese column โ English snake_case + unit conversion
โโโ output/ # OutputSchema types (Longbridge-style)
โ โโโ common.py # ToolResponse wrapper
โ โโโ market.py # TradingDayItem, SecurityItem, ...
โ โโโ quote.py # CandlestickItem, QuoteItem, DepthOutput, ...
โ โโโ flow.py # CapitalFlowItem, NorthboundFlowItem, ...
โ โโโ fundamental.py # CompanyInfo, FinancialMetricItem, ValuationData, ...
โ โโโ shareholder.py # ShareholderItem, InsiderTradeItem, ...
โ โโโ content.py # NewsItem, FilingItem, ResearchReportItem
โ โโโ sector.py # IndexConstituentItem, SectorQuoteItem, ...
โ โโโ sentiment.py # LimitPoolItem, DragonTigerItem, MarketSummary, ...
โ โโโ ipo.py # IPOCalendarItem, IPODetail
โ โโโ macro.py # MacroIndicatorItem, InterestRateItem, ...
โ โโโ derivatives.py # FundQuoteItem, FuturesQuoteItem, OptionQuoteItem, ...
โโโ infra/ # Infrastructure
โโโ cache.py # TTL cache with LRU eviction
โโโ ratelimit.py # Token bucket (global + per-interface)
โโโ retry.py # Retry with exponential backoff
โโโ async_wrap.py # asyncio.to_thread wrapper for sync callsLicense
MIT
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/agentladle/mcp-akshare'
If you have feedback or need assistance with the MCP directory API, please join our Discord server