The MCP Stock Assistant server provides real-time and historical Chinese A-share stock market data through the East Money API, requiring no authentication.
Core Capabilities:
Real-time Stock Information - Retrieve current data including price, change percentage, P/E ratio, trading volume, turnover, turnover rate, and 5-level bid/ask spread data
Stock Search - Query stocks using 6-digit codes (e.g., 600519) or company names (e.g., 贵州茅台) with intelligent fuzzy matching
Historical K-line Data - Access daily, weekly, or monthly historical data for up to 500 days, including opening, closing, high, and low prices
Market Index Tracking - Monitor major indices including Shanghai Composite Index (上证指数) and Shenzhen Component Index (深证成指)
Multi-board Support - Coverage for all Chinese A-share markets including Shanghai Main Board (600, 601, 603, 605), STAR Market (688), Shenzhen Main Board (000), SME Board (002), and ChiNext (300, 301)
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Stock Assistantshow me the current price and change for Apple stock"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Stock Assistant
一个基于模型上下文协议 (MCP) 的股票信息服务器,使用东方财富API提供实时股票数据。
功能特性
📈 获取实时股票数据(支持股票代码或名称查询)
📊 获取股票历史K线数据(日K、周K、月K)
🏛️ 获取大盘指数信息(上证指数、深证成指)
💹 详细的买卖盘口信息
📋 支持中国A股市场(沪深两市)
🔍 智能股票搜索(支持股票名称模糊匹配)
安装说明
克隆仓库:
git clone <repository-url> cd mcp-stock安装依赖:
pnpm install构建项目:
pnpm run build
使用方法
配置MCP客户端
在Claude Desktop或其他MCP客户端的配置文件中添加以下配置:
{
"mcpServers": {
"mcp-stock": {
"command": "node",
"args": [
"/Users/zhangyanhua/Documents/augment-projects/mcp-stock/build/index.js" // 打包后的真实路径
]
}
}
}该服务器实现了模型上下文协议,可以与任何支持MCP的客户端配合使用,如Claude Desktop。
可用工具
服务器提供以下三个工具:
get-stock-info: 获取股票实时信息参数:
stock_code- 股票代码或名称(例如:600519 或 贵州茅台)
get-stock-history: 获取股票历史数据参数:
stock_code- 股票代码或名称period- 时间周期(1d=日K线, 1w=周K线, 1m=月K线,默认1d)days- 获取天数(1-500天,默认30天)
get-market-index: 获取大盘指数信息无参数,返回上证指数和深证成指的实时数据
使用示例
1. 获取股票实时信息
股票信息: 600519 (贵州茅台)
当前价格: 1756.00
跌幅: -0.85%
涨跌额: -15.00
开盘价: 1770.00
最高价: 1775.00
最低价: 1750.00
昨收价: 1771.00
成交量: 45678.00手
成交额: 8023456.00万
换手率: 0.36%
市盈率(动态): 35.2
振幅: 1.41%
更新时间: 15:00:00
买卖盘口:
卖5: 1758.00 / 120.00手
卖4: 1757.00 / 89.00手
卖3: 1756.50 / 156.00手
卖2: 1756.20 / 234.00手
卖1: 1756.00 / 67.00手
买1: 1755.80 / 145.00手
买2: 1755.50 / 78.00手
买3: 1755.20 / 203.00手
买4: 1755.00 / 167.00手
买5: 1754.80 / 89.00手2. 获取股票历史数据
📈 贵州茅台(600519) 历史数据 (最近10个交易日)
日期 开盘 收盘 最高 最低 成交量(手) 涨跌幅
─────────────────────────────────────────────────────────────────
2024-01-15 1770.00 1756.00 1775.00 1750.00 45678.00 📉-0.85%
2024-01-12 1780.00 1771.00 1785.00 1765.00 52341.00 📈+0.57%
...
📊 统计信息:
最高价: 1785.00
最低价: 1720.00
平均价: 1752.50
总成交量: 456789.00手3. 获取大盘指数信息
📊 大盘指数信息
指数名称 当前点位 涨跌幅 涨跌点 成交量(手) 成交额(万)
──────────────────────────────────────────────────────────────────
上证指数 2956.48 📉-0.42% -12.56 123456789.00 45678901.00
深证成指 9234.67 📉-0.38% -35.23 98765432.00 32109876.00
🕐 更新时间: 15:00:00股票代码格式
支持以下格式的股票查询:
按代码查询
沪市A股: 6位数字代码(如:
600519、601318、688981)深市A股: 6位数字代码(如:
000858、002415、300750)
按名称查询
股票全名: 如
贵州茅台、平安银行股票简称: 如
茅台、平安
代码规则
沪市主板: 600、601、603、605开头
科创板: 688开头
深市主板: 000开头
中小板: 002开头
创业板: 300、301开头
技术说明
📡 使用东方财富API获取实时股票数据
🔌 基于stdio传输协议,与MCP客户端完全兼容
🆓 无需API密钥,免费使用(可能存在频率限制)
🚀 支持智能搜索,可通过股票名称模糊匹配
📊 提供完整的技术指标和盘口数据
开源协议
ISC