AKShare MCP Server

AKShare MCP Server

A Model Context Protocol server that enables Claude Desktop to access and analyze Chinese and global financial market data through the AKShare library.

ttjslbz001

Finance
Research & Data
Visit Server

README

AKShare MCP Server

A Model Context Protocol (MCP) server that provides financial data analysis capabilities using the AKShare library.

Features

  • Access to Chinese and global financial market data through AKShare
  • Integration with Claude Desktop via MCP protocol
  • Support for various financial data queries and analysis

Installation

Using uv (recommended)

# Clone the repository
git clone https://github.com/yourusername/akshare_mcp_server.git
cd akshare_mcp_server

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies with uv
uv pip install -e .

Using pip

# Clone the repository
git clone https://github.com/yourusername/akshare_mcp_server.git
cd akshare_mcp_server

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e .

Usage

Running the server

# Activate the virtual environment
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Run the server
python run_server.py

Integrating with Claude Desktop

  1. Add the following configuration to your Claude Desktop configuration:
"mcpServers": {
    "akshare-mcp": {
        "command": "uv",
        "args": [
            "--directory",
            "/path/to/akshare_mcp_server",
            "run",
            "akshare-mcp"
        ],
        "env": {
            "AKSHARE_API_KEY": "<your_api_key_if_needed>"
        }
    }
}
  1. Restart Claude Desktop
  2. Select the AKShare MCP server from the available tools

Available Tools

The AKShare MCP server provides the following tools:

  • Stock data queries
  • Fund data queries
  • Bond data queries
  • Futures data queries
  • Forex data queries
  • Macroeconomic data queries
  • And more...

Adding a New Tool

To add a new tool to the MCP server, follow these steps:

  1. Add a new API function in src/mcp_server_akshare/api.py:

    async def fetch_new_data_function(param1: str, param2: str = "default") -> List[Dict[str, Any]]:
        """
        Fetch new data type.
        
        Args:
            param1: Description of param1
            param2: Description of param2
        """
        try:
            df = ak.akshare_function_name(param1=param1, param2=param2)
            return dataframe_to_dict(df)
        except Exception as e:
            logger.error(f"Error fetching new data: {e}")
            raise
    
  2. Add the new tool to the enum in src/mcp_server_akshare/server.py:

    class AKShareTools(str, Enum):
        # Existing tools...
        NEW_TOOL_NAME = "new_tool_name"
    
  3. Import the new function in src/mcp_server_akshare/server.py:

    from .api import (
        # Existing imports...
        fetch_new_data_function,
    )
    
  4. Add the tool definition to the handle_list_tools() function:

    types.Tool(
        name=AKShareTools.NEW_TOOL_NAME.value,
        description="Description of the new tool",
        inputSchema={
            "type": "object",
            "properties": {
                "param1": {"type": "string", "description": "Description of param1"},
                "param2": {"type": "string", "description": "Description of param2"},
            },
            "required": ["param1"],  # List required parameters
        },
    ),
    
  5. Add the tool handler in the handle_call_tool() function:

    case AKShareTools.NEW_TOOL_NAME.value:
        param1 = arguments.get("param1")
        if not param1:
            raise ValueError("Missing required argument: param1")
        
        param2 = arguments.get("param2", "default")
        
        result = await fetch_new_data_function(
            param1=param1,
            param2=param2,
        )
    
  6. Test the new tool by running the server and making a request to the new tool.

Development

# Install development dependencies
uv pip install -e ".[dev]"

# Run tests
pytest

Docker

You can also run the server using Docker:

# Build the Docker image
docker build -t akshare-mcp-server .

# Run the Docker container
docker run -p 8000:8000 akshare-mcp-server

License

MIT

Recommended Servers

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.

Featured
TypeScript
MCP PubMed Search

MCP PubMed Search

Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.

Featured
Python
dbt Semantic Layer MCP Server

dbt Semantic Layer MCP Server

A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.

Featured
TypeScript
mixpanel

mixpanel

Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Featured
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python
chromia-mcp

chromia-mcp

Enables AI to interact with Chromia Wallet for sending $CHR transactions.

Official
Local
TypeScript
TripleWhale MCP Server

TripleWhale MCP Server

An implementation of Model Context Protocol (MCP) that allows users to interact with TripleWhale's e-commerce analytics platform using natural language queries through Claude Desktop.

Official
Local
TypeScript
Adamik MCP Server

Adamik MCP Server

Enables read and write interactions with 60+ blockchain networks through Claude Desktop, providing a standardized multi-chain API for transaction management, account insights, staking, and token interactions.

Official
Local
TypeScript
Open-Ledger-MCP-Server

Open-Ledger-MCP-Server

A Model Context Protocol (MCP) server implementation for the OpenLedger API. This server provides structured context to AI models according to the MCP specification.

Official
TypeScript
Nefino MCP Server

Nefino MCP Server

Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.

Official
Python