AKShare MCP Server
AKShare MCP Server
A financial data MCP (Model Context Protocol) server based on AKShare, providing Claude and other AI assistants with comprehensive Chinese financial market data retrieval capabilities. Supports stocks, funds, futures, economic indicators, and more.
π Quick Start
Prerequisites
Node.js: 18.0.0 or higher
Python: 3.8 or higher (only required for Python version)
Installation
# 1. Clone the project
git clone https://github.com/jadenmong/akshare-mcp-server.git
cd akshare-mcp-server
# 2. Install Node.js dependencies
npm install
# 3. Start the server (HTTP version, recommended - no Python dependencies)
npm start
# Or start Python version (requires Python and akshare installation)
npm run start:pythonVersion Information
The project provides two MCP server implementations:
HTTP Version (Recommended):
β Zero Python dependencies, ready to use
β Based on AKShare HTTP API, stable and reliable
β Built-in fallback data ensures service availability
β Simple deployment, fast startup
Python Version:
β Direct AKShare library calls, richer data
β Supports more data types (futures, economic indicators)
β Requires local Python 3.8+ environment
β Requires akshare library installation
βοΈ Configuration
Claude Desktop Configuration
Add the following configuration to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
HTTP Version Configuration (Recommended):
{
"mcpServers": {
"akshare": {
"command": "node",
"args": ["<your-project-path>/src/http-server.js"],
"description": "AKShare Financial Data MCP Server (HTTP)"
}
}
}Python Version Configuration:
{
"mcpServers": {
"akshare": {
"command": "node",
"args": ["<your-project-path>/src/server.js"],
"description": "AKShare Financial Data MCP Server (Python)"
}
}
}Note:
Replace
<your-project-path>with your actual absolute pathWindows: use double backslashes
\\, e.g.,D:\\projects\\akshare-mcp-server\\src\\http-server.jsmacOS/Linux: use forward slashes
/, e.g.,/home/user/akshare-mcp-server/src/http-server.js
π Available Tools
π Stock Data (HTTP + Python Versions)
Historical Data:
get_stock_historical_data- Get stock historical dataReal-time Quotes:
get_stock_realtime_data- Get stock real-time quotesStock List:
get_stock_list- Get stock list
π Search Tools (HTTP Version New)
Stock Search:
search_stock- Search stock information
π° Fund Data (HTTP + Python Versions)
Fund List:
get_fund_list- Get fund list
π Futures Data (Python Version Only)
Futures Information:
get_futures_info- Get futures market data
π Economic Data (Python Version Only)
Economic Indicators:
get_economic_data- Get macroeconomic data
Version Comparison
Feature | HTTP Version | Python Version |
Stock Historical Data | β | β |
Stock Real-time Data | β | β |
Stock List | β | β |
Stock Search | β | β |
Fund Data | β | β |
Futures Data | β | β |
Economic Data | β | β |
ποΈ Project Structure
akshare-mcp-server/
βββ src/
β βββ http-server.js # HTTP version MCP server (recommended)
β βββ server.js # Python version MCP server
β βββ tools/ # Financial data tool modules
β β βββ stock_tools.js # Stock data tools
β β βββ fund_tools.js # Fund data tools
β β βββ futures_tools.js # Futures data tools
β β βββ economic_tools.js # Economic data tools
β βββ utils/
β βββ toolHelpers.js # Tool helper functions
βββ test/
β βββ test.js # Automated test suite
βββ python_bridge.py # Python bridge script
βββ requirements.txt # Python dependencies
βββ package.json # Node.js configuration
βββ README.md # English documentation
βββ README_CN.md # Chinese documentation
βββ LICENSE # MIT Licenseπ Usage Examples
Stock Data Examples
Get Stock Historical Data
{
"name": "get_stock_historical_data",
"arguments": {
"symbol": "000001",
"period": "daily",
"start_date": "20240101",
"end_date": "20240131",
"adjust": "qfq"
}
}Get Stock Real-time Quotes
{
"name": "get_stock_realtime_data",
"arguments": {
"symbol": "000001"
}
}Get Stock List
{
"name": "get_stock_list",
"arguments": {
"market": "all"
}
}Fund Data Examples
Get Fund Information
{
"name": "get_fund_info",
"arguments": {
"symbol": "510050"
}
}Get Fund List
{
"name": "get_fund_list",
"arguments": {
"type": "etf"
}
}Futures Data Examples
Get Futures Information
{
"name": "get_futures_info",
"arguments": {
"symbol": "ag",
"exchange": "SHFE"
}
}Economic Data Examples
Get Economic Indicators
{
"name": "get_economic_data",
"arguments": {
"indicator": "GDP",
"start_date": "20240101",
"end_date": "20241231"
}
}π§ Development and Testing
Run Tests
The project includes a comprehensive automated test suite for both versions:
npm testTest coverage includes:
Tool list retrieval
Stock historical data queries
Stock real-time quotes
Stock list retrieval
Fund data queries
Futures data queries (Python version)
Economic data queries (Python version)
Development Mode (with auto-restart)
# HTTP version development mode
npm run dev
# Python version development mode
npm run dev:pythonπ Troubleshooting
Common Issues
Node.js Version Too Low
Error: Node.js version 18.0.0 or higher required Solution: Upgrade Node.js to the latest LTS versionPython Dependencies Installation Failed
# Try using a domestic mirror pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/Claude Desktop Connection Failed
Check if the configuration file path is correct (note Windows uses double backslashes)
Confirm that
http-server.jsorserver.jsfile path existsRestart the Claude Desktop application
Check Claude Desktop log output
Data Retrieval Failed
Check network connection
HTTP version: Confirm access to AKShare HTTP API
Python version: Confirm akshare library is installed (
pip list | grep akshare)Check server log output for errors
Debug Mode
Start the server with detailed logging:
DEBUG=akshare:* npm startπ§ Technical Features
β‘ High Performance: Node.js async processing with concurrent request support
π‘οΈ Type Safety: Strict parameter validation and type checking using Zod
π Python Bridge: Secure AKShare Python library calls via subprocess
π§ Modular Design: Tools organized by financial product category for easy maintenance
π Data Standardization: Unified JSON data format and error handling
π Easy to Extend: Simple tool definition and addition mechanism for rapid integration
π Dual Implementation: HTTP and Python versions for different use cases
β Comprehensive Testing: Automated test suite ensures code quality
π License
This project is open source under the MIT License.
π Acknowledgments
AKShare - Powerful financial data API library
Model Context Protocol - Standardized tool interface protocol
π€ Contributing
Welcome to submit Issues and Pull Requests to improve this project!
π Support
If you encounter issues during use, please:
Check the Troubleshooting section of this documentation
Submit an issue on GitHub Issues
Consult the AKShare Official Documentation
π Related Documentation
English Documentation: README.md (this document)
Chinese Documentation: README_CN.md
AKShare Documentation: AKShare Official Docs
MCP Protocol: Model Context Protocol
π Roadmap
Support more financial data types (bonds, forex, cryptocurrency)
Add data caching mechanism for better performance
Support custom data source configuration
Provide Docker image for simplified deployment
Add data visualization tool integration
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/jadenmong/akshare-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server