基于AKShare的强大金融数据MCP(模型上下文协议)服务器,提供AI助手全面的金融数据检索能力。
# 1. 克隆项目
git clone https://github.com/jadenmong/akshare-mcp-server.git
cd akshare-mcp-server
# 2. 安装Node.js依赖
npm install
# 3. 启动服务器(推荐HTTP版本 - 不需要Python依赖)
npm start
# 或启动Python版本(需要安装Python和akshare)
npm run start:python
HTTP版本(推荐):
Python版本:
在你的Claude Desktop配置文件中添加以下配置:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"akshare": {
"command": "node",
"args": ["E:\\akshare-mcp-server\\src\\server.js"],
"env": {},
"description": "AKShare金融数据MCP服务器"
}
}
}
注意:请更新路径 E:\\akshare-mcp-server\\src\\server.js 至您的实际项目路径。
get_stock_historical_data - 获取股票历史数据get_stock_realtime_data - 获取股票实时行情get_stock_list - 获取股票列表search_stock - 搜索股票信息get_fund_list - 获取基金列表get_futures_info - 获取期货市场数据get_economic_data - 获取宏观经济数据| 功能 | HTTP版本 | Python版本 |
|---|---|---|
| 股票历史数据 | ✅ | ✅ |
| 股票实时数据 | ✅ | ✅ |
| 股票列表 | ✅ | ✅ |
| 股票搜索 | ✅ | ❌ |
| 基金数据 | ✅ | ✅ |
| 期货数据 | ❌ | ✅ |
| 经济数据 | ❌ | ✅ |
akshare-mcp-server/
├── src/
│ ├── server.js # 基于Python的MCP服务器
│ ├── http-server.js # 基于HTTP的MCP服务器(推荐)
│ └── tools/ # 金融数据工具模块
├── test/
│ └── test_client.js # 测试客户端
├── requirements.txt # Python依赖
├── package.json # Node.js配置
├── README.md # 英文文档
├── README_CN.md # 中文文档
└── LICENSE # 开源许可证
{
"name": "get_stock_historical_data",
"arguments": {
"symbol": "000001",
"period": "daily",
"start_date": "20240101",
"end_date": "20240131",
"adjust": "qfq"
}
}
{
"name": "get_stock_realtime_data",
"arguments": {
"symbol": "000001"
}
}
{
"name": "get_stock_list",
"arguments": {
"market": "all"
}
}
{
"name": "get_fund_info",
"arguments": {
"symbol": "510050"
}
}
{
"name": "get_fund_list",
"arguments": {
"type": "etf"
}
}
{
"name": "get_futures_info",
"arguments": {
"symbol": "ag",
"exchange": "SHFE"
}
}
{
"name": "get_economic_data",
"arguments": {
"indicator": "GDP",
"start_date": "20240101",
"end_date": "20241231"
}
}
npm test
npm run dev
Node.js版本过低
错误:需要Node.js 18.0.0或更高版本
解决方案:升级Node.js至最新LTS版本
Python依赖安装失败
# 尝试使用国内镜像
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
Claude Desktop连接失败
数据检索失败
以详细日志启动服务器:
DEBUG=akshare:* npm start
本项目在MIT许可证下开源。
欢迎提交Issues和Pull Requests来改进这个项目!
如果在使用过程中遇到问题,请: