Skip to main content
Glama
a-share-mcp

a-share-mcp

by mazihua-lgtm

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)系接口间歇性限流断连,很多教程接口实际已死。本服务的选型来自长期实测:

工具

数据源

稳定性

get_kline K线(日/周/月,前/后复权)

腾讯 ifzq.gtimg.cn

★ 稳定,主力链路

get_limit_up_pool 涨停池(连板数/炸板/行业)

东财 via akshare

间歇限流,内置自动重试

get_limit_down_pool 跌停池

东财 via akshare

同上

get_fund_flow 个股逐日资金流

东财 via akshare

同上

get_index_spot 主要指数行情

东财 via akshare

同上

get_stock_news 个股新闻

东财 via akshare

同上

内置处理:

  • 股票代码自动归一(600519 / sh600519 / sz000001 均可,自动推断市场)

  • 东财接口连续失败自动重试,最终报错给出可行动提示而非裸异常

  • 绕开 akshare 涨跌停池函数"默认日期写死为 2024 年"的坑(自动回落到当天)

Related MCP server: Stock 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

参数

说明

get_kline

symbol, period=day, count=75, adjust=qfq

K线,period: day/week/month,adjust: qfq/hfq/none,count ≤ 800

get_limit_up_pool

date? (YYYYMMDD)

涨停池:连板数、炸板次数、封板资金、所属行业

get_limit_down_pool

date? (YYYYMMDD)

跌停池(仅最近 30 个交易日)

get_fund_flow

symbol, days=10

主力/超大单/大单/中单/小单逐日净流入

get_index_spot

—

上证/深证/创业板/沪深300 等实时行情

get_stock_news

symbol, limit=20

个股新闻:标题/摘要/时间/来源/链接

涨跌停池 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.py

Roadmap

  • 龙虎榜、板块资金流

  • 分钟级 K线

  • 可选 x402 按调用计费(配合 cashier-mcp)

License

MIT

Available Tools

6 tools
get_fund_flowC

个股逐日资金流:主力/超大单/大单/中单/小单净流入与占比。

Inputs: symbol (required), days. Returns: result

get_index_spotB

主要指数实时行情:上证指数/深证成指/创业板指/沪深300/中证500 等。

Inputs: no named parameters. Returns: result

get_klineB

获取A股K线(腾讯源,稳定)。symbol 支持 "600519"/"sh600519"/"sz000001"; period: day/week/month;adjust: qfq(前复权)/hfq(后复权)/none;count 1-800。

Inputs: symbol (required), count, adjust, period. Returns: result

get_limit_down_poolA

跌停池。date 可选,格式 YYYYMMDD,缺省为最近交易日。

Inputs: date. Returns: result

get_limit_up_poolB

涨停池:代码/名称/连板数/炸板次数/封板资金/所属行业等。 date 可选,格式 YYYYMMDD,缺省为最近交易日。

Inputs: date. Returns: result

get_stock_newsB

个股新闻资讯(东财):标题/摘要/发布时间/来源/链接。

Inputs: symbol (required), limit. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides read-only access to Chinese A-share stock market data such as quotes, K-lines, financials, capital flows, news, and research reports via a stdio MCP server for DeepSeek Harness and other MCP clients.
      2
      GPL 3.0
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents and backends to query and analyze A-share, US equity, ETF, index, and crypto market data, technical indicators, fundamentals, money flow, news, and filings through MCP tools or HTTP APIs. It also supports agent-friendly artifact outputs and CSV/JSON code-export workflows.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants and MCP-compatible clients to access real-time and historical market data across A-shares, Hong Kong, US equities, funds, futures, and options, along with technical indicators, sector analysis, screening, prompts, and resources.
      198 npm
      ISC
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents and backends to query A-share, US equity, ETF, index, and crypto market data, compute technical indicators, retrieve fundamentals, news, filings, money flow, and export CSV/JSON for code workflows through MCP tools and HTTP APIs.
      -