a-share-mcp
a-share-mcp
A股数据 MCP Server — 让 Claude / 任意 MCP 客户端直接查询 A股行情数据。
A-share data MCP server: K-line (Tencent source, qfq/hfq), limit-up/down pools, per-stock fund flow, index quotes, stock news.
数据仅供研究参考,不构成投资建议。For research only, not investment advice.
为什么是这个组合
A股数据接口的可用性是个坑:东方财富(push2)系接口间歇性限流断连,很多教程接口实际已死。本服务的选型来自长期实测:
工具 | 数据源 | 稳定性 |
| 腾讯 | ★ 稳定,主力链路 |
| 东财 via akshare | 间歇限流,内置自动重试 |
| 东财 via akshare | 同上 |
| 东财 via akshare | 同上 |
| 东财 via akshare | 同上 |
| 东财 via akshare | 同上 |
内置处理:
股票代码自动归一(
600519/sh600519/sz000001均可,自动推断市场)东财接口连续失败自动重试,最终报错给出可行动提示而非裸异常
绕开 akshare 涨跌停池函数"默认日期写死为 2024 年"的坑(自动回落到当天)
Related MCP server: akshare-mcp
快速开始
方式一:uvx(免安装,推荐)
uvx --from git+https://github.com/mazihua-lgtm/a-share-mcp a-share-mcp方式二:pip
pip install git+https://github.com/mazihua-lgtm/a-share-mcp
a-share-mcp # stdio transport要求 Python >= 3.10。
客户端配置
Claude Desktop / 通用 MCP 客户端 (claude_desktop_config.json):
{
"mcpServers": {
"a-share": {
"command": "uvx",
"args": ["--from", "git+https://github.com/mazihua-lgtm/a-share-mcp", "a-share-mcp"]
}
}
}Claude Code:
claude mcp add a-share -- uvx --from git+https://github.com/mazihua-lgtm/a-share-mcp a-share-mcp工具一览
Tool | 参数 | 说明 |
|
| K线,period: day/week/month,adjust: qfq/hfq/none,count ≤ 800 |
|
| 涨停池:连板数、炸板次数、封板资金、所属行业 |
|
| 跌停池(仅最近 30 个交易日) |
|
| 主力/超大单/大单/中单/小单逐日净流入 |
| — | 上证/深证/创业板/沪深300 等实时行情 |
|
| 个股新闻:标题/摘要/时间/来源/链接 |
涨跌停池 date 缺省为当天:盘中调用返回实时池,盘前为空属正常。
本地开发
git clone https://github.com/mazihua-lgtm/a-share-mcp && cd a-share-mcp
# 数据层冒烟测试(无需 mcp 包,Python 3.9 可跑)
python3 tests/smoke_test.py
# MCP 协议端到端测试(需 Python >= 3.10)
uv venv --python 3.12 .venv && uv pip install -e . && .venv/bin/python tests/mcp_client_test.pyRoadmap
龙虎榜、板块资金流
分钟级 K线
可选 x402 按调用计费(配合 cashier-mcp)
License
MIT
Available Tools
6 toolsget_fund_flowC
个股逐日资金流:主力/超大单/大单/中单/小单净流入与占比。
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | ||
| symbol | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. It states what data is returned but says nothing about whether this is a read-only call, whether there are symbol-format or market-scope constraints, rate limits, or data freshness. The 'get' wording weakly implies read-only but that is inference, not disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single compact sentence that front-loads the resource ('个股逐日资金流') followed by the returned fields. No filler or repetition, though it is terse enough to omit essential invoking detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return-value explanation is not required, and the description does add the field taxonomy anyway. However, with 0% parameter documentation and no usage or behavioral context, an agent still lacks what it needs to invoke the tool correctly across markets or symbol formats.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% — neither 'symbol' nor 'days' is documented anywhere. The description does not compensate at all: it never mentions the stock identifier or the lookback window, so an agent gets no guidance on symbol format or what the days default of 10 means.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a concrete resource (per-stock daily fund flow) and enumerates the specific data returned (main force / super-large / large / medium / small order net inflow and their proportions). That is far more specific than a tautology. It does not, however, position itself against siblings like get_kline or the limit-up/limit-down pools, which an agent may confuse for related market-data queries.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use statement, no conditions or prerequisites, and no mention of an alternative tool. The agent must infer from the resource name alone that this is for capital-flow analysis rather than price history, which get_kline also covers.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_index_spotB
主要指数实时行情:上证指数/深证成指/创业板指/沪深300/中证500 等。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. It discloses only that the data is 'real-time' (实时), without saying whether quotes are delayed, how fresh they are, what happens for unknown indices, or any rate-limit considerations for a live-market endpoint.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence identifies the resource and its coverage with zero filler. Appropriate sizing for a zero-argument lookup tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no parameters and an output schema present, the description does not need to explain return values, and the example index list gives a good idea of scope. It is near-complete, lacking only note of whether the response is a fixed set or exhaustive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so schema description coverage is trivially 100% and there are no parameter semantics for the description to compensate for. Baseline 4 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific resource — real-time quotes for major indices — and enumerates concrete examples (SSE Composite, SZSE Component, ChiNext, CSI 300, CSI 500). An agent can distinguish this market-data tool from get_kline (candlesticks) or get_fund_flow (money flow) by resource type, though no sibling is named explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use guidance, no statement of prerequisites, and no mention of alternatives such as get_kline for historical or per-stock data. Usage is only inferable from the resource name itself.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_klineB
获取A股K线(腾讯源,稳定)。symbol 支持 "600519"/"sh600519"/"sz000001"; period: day/week/month;adjust: qfq(前复权)/hfq(后复权)/none;count 1-800。
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| adjust | No | qfq | |
| period | No | day | |
| symbol | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry the full behavioral load. It discloses the data source and asserts stability, which is useful context, but says nothing about read-only nature, rate limits, latency, or failure modes. An output schema exists so return-shape omission is acceptable, leaving a moderately thin behavioral profile for a no-annotation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Purpose is front-loaded in the first clause, followed by a dense but scannable semicolon-separated list of parameter constraints. No filler sentences, though the telegraphic style is terse rather than polished.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Parameter semantics are fully covered and an output schema handles return values, so an agent has what it needs to call the tool correctly. The missing piece is routing guidance relative to the five sibling market-data tools.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% with no enums, so the description is the sole source of parameter meaning. It covers all four: accepted symbol formats ('600519'/'sh600519'/'sz000001'), period values (day/week/month), adjust values (qfq/hfq/none), and the count range 1-800. It does not restate defaults, but it substantially compensates for the empty schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Names a specific verb+resource (fetch A-share K-line data) and even identifies the data source (Tencent) and its stability. It clearly differs in resource type from siblings like get_fund_flow or get_stock_news, though it never explicitly contrasts itself with them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No when-to-use or when-not-to-use guidance, and no alternative tools are named despite the sibling set containing other market-data endpoints. The '腾讯源,稳定' note hints a source trade-off exists but never says what to choose instead or when.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_limit_down_poolA
跌停池。date 可选,格式 YYYYMMDD,缺省为最近交易日。
| Name | Required | Description | Default |
|---|---|---|---|
| date | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It does disclose one behavioral trait beyond structured fields — that an omitted date resolves to the most recent trading day — but says nothing about it being a read-only query, any auth requirements, rate limits, or result size.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences, resource first and the parameter clarification second. Nothing is padded and everything present is actionable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With only one optional parameter, an output schema present, and full parameter semantics documented, the definition is nearly sufficient to invoke correctly. The remaining gap is the absence of any routing hint versus the limit-up sibling, which the name largely resolves anyway.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, and the schema's default for date is an empty string with no explanation. The description supplies the missing meaning: the parameter is optional, uses the YYYYMMDD format, and an empty/default value resolves to the latest trading day — the essential facts an agent needs to format the call.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
"跌停池" identifies the resource and, by contrast with the sibling get_limit_up_pool, implies it returns the limit-down pool. However it is essentially a restatement of the tool name with no verb or explicit scope statement, so the agent must infer that this is a read/query operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by stating that date is optional and defaults to the most recent trading day, which tells the agent the tool works without arguments. It never states when to prefer this over get_limit_up_pool or other market-data siblings, so guidance is only implied.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_limit_up_poolB
涨停池:代码/名称/连板数/炸板次数/封板资金/所属行业等。 date 可选,格式 YYYYMMDD,缺省为最近交易日。
| Name | Required | Description | Default |
|---|---|---|---|
| date | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden, and it does disclose a concrete behavioral trait — that date is optional and defaults to the most recent trading day. It does not cover data freshness guarantees, rate limits, market scope (e.g. which exchange), or empty-result behavior, which leaves notable gaps for a data-fetch tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short lines, front-loaded with the resource and fields followed by the one parameter's contract; every clause earns its place. The only minor friction is the mixed Chinese/English with a Latin 'date' token embedded mid-sentence.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be re-explained, and the single parameter is fully specified. The remaining gap is the absence of any when-to-use or sibling-routing guidance; for a simple read tool this is close to complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% for the single 'date' parameter, so the description must compensate, and it does: it states the parameter is optional, gives the exact YYYYMMDD format, and specifies the default (most recent trading day). This is meaningfully more than the bare string schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first clause names the resource (涨停池 / limit-up pool) and enumerates the returned fields (code, name, consecutive-board count, board-break count, sealing funds, industry), which pins down the tool's purpose precisely. It does not use an explicit verb, but the semantic domain is unambiguous and implicitly distinct from the sibling get_limit_down_pool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no statement of when to use this tool versus alternatives such as get_limit_down_pool, get_kline, or get_fund_flow, nor any prerequisites or exclusions. Usage must be inferred entirely from the tool name and field list.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_stock_newsB
个股新闻资讯(东财):标题/摘要/发布时间/来源/链接。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| symbol | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. It does disclose the data source (东财) and the shape of the returned content, but says nothing about authentication, rate limits, caching/freshness, or how far back news is retrieved. An output schema exists, so return structure is covered elsewhere.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One compact sentence with the resource and return fields front-loaded; no filler. It is arguably too terse, but nothing is wasted.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter read tool with an output schema, the description covers the resource, source, and result fields adequately. The gap is the undocumented required 'symbol' format and 'limit' behavior, which leaves an agent guessing on invocation details.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% for both parameters, so the description must compensate, and it does not. It never explains the expected symbol format (e.g., bare code vs. exchange-prefixed) nor the meaning/effect of the 'limit' parameter despite its default of 20.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb+resource (individual stock news from East Money) and even enumerates the returned fields (title/summary/publish time/source/link), so the agent knows exactly what it fetches. It does not explicitly contrast with siblings, but none of get_kline/get_fund_flow/get_index_spot overlap with news, so differentiation is implicit.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no statement of when to use this tool, no prerequisites, and no named alternatives. Usage is only inferable from the tool name and the word 'news' in the description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.0- First observed
get_fund_flow - First observed
get_index_spot - First observed
get_kline - First observed
get_limit_down_pool - First observed
get_limit_up_pool - First observed
get_stock_news
TDQS
Scored across 6 tools
Each tool targets a clearly distinct data type: K-line history, limit-up pool, limit-down pool, per-stock fund flow, index spot quotes, and stock news. The two pool tools are near-twins but their names and descriptions make the up/down distinction unambiguous.
All six tools follow a uniform get_<noun> snake_case pattern (get_kline, get_limit_up_pool, get_fund_flow, get_index_spot, get_stock_news). No mixed conventions or inconsistent verb styles.
Six tools is well-scoped for an A-share market-data server, with each tool covering a distinct data category and no filler or redundant endpoints.
The surface covers K-lines, limit pools, fund flow, index quotes, and news, which supports most common A-share research workflows. However, there is no per-stock real-time quote tool (only index spot) and no fundamentals/symbol-search, which agents must work around via daily K-line data.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
China A-share market data for research, backtesting and AI agents via MCP.
Provide access to Chinese stock market data including historical prices, real-time data, news, and…
Read-only China A-share data for AI agents: market, limit-up, capital flow and disclosures.
MCP server giving AI agents one-connection access to China A-share market intelligence: financials,
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to query real-time A-share stock data, including quotes, fund flows, sector flows, and K-line history, without needing an API key.57MIT
- AlicenseAqualityBmaintenanceProvides access to Chinese A-share market financial data, including historical K-line, real-time quotes, financial statements, shareholder information, and technical indicators, via MCP protocol.12693MIT
- FlicenseNot gradedqualityCmaintenanceMCP server adapter that exposes A-share stock data tools, prompts, and resources via FastMCP, enabling querying of stocks, K-lines, financials, sectors, and market hot spots through natural language.-
- AlicenseNot gradedqualityBmaintenanceGives Claude Code A-share market data capabilities (real-time quotes, history, ETF, sectors, etc.) via Sina and East Money APIs, with zero C dependencies.3MIT