AKShare MCP Server

AKShare MCP Server

Enables AI assistants to access comprehensive Chinese financial market data including stocks, funds, futures, and economic indicators via AKShare.

Category
Visit Server

README

AKShare MCP Server

English | δΈ­ζ–‡η‰ˆ

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:python

Version 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 path
  • Windows: use double backslashes \\, e.g., D:\\projects\\akshare-mcp-server\\src\\http-server.js
  • macOS/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 data
  • Real-time Quotes: get_stock_realtime_data - Get stock real-time quotes
  • Stock 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 test

Test 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

  1. Node.js Version Too Low

    Error: Node.js version 18.0.0 or higher required
    Solution: Upgrade Node.js to the latest LTS version
    
  2. Python Dependencies Installation Failed

    # Try using a domestic mirror
    pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
    
  3. Claude Desktop Connection Failed

    • Check if the configuration file path is correct (note Windows uses double backslashes)
    • Confirm that http-server.js or server.js file path exists
    • Restart the Claude Desktop application
    • Check Claude Desktop log output
  4. 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

🀝 Contributing

Welcome to submit Issues and Pull Requests to improve this project!

πŸ“ž Support

If you encounter issues during use, please:

  1. Check the Troubleshooting section of this documentation
  2. Submit an issue on GitHub Issues
  3. Consult the AKShare Official Documentation

πŸ“š Related Documentation

🌟 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured