Skip to main content
Glama

AKShare MCP Server

by ttjslbz001

AKShare MCP 服务器

使用 AKShare 库提供财务数据分析功能的模型上下文协议 (MCP) 服务器。

特征

  • 通过AKShare获取中国及全球金融市场数据
  • 通过 MCP 协议与 Claude Desktop 集成
  • 支持各类财务数据查询及分析

安装

使用 uv(推荐)

# 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 .

使用 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 .

用法

运行服务器

# Activate the virtual environment source venv/bin/activate # On Windows: venv\Scripts\activate # Run the server python run_server.py

与 Claude Desktop 集成

  1. 将以下配置添加到您的 Claude Desktop 配置中:
"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. 重启Claude桌面
  2. 从可用工具中选择 AKShare MCP 服务器

可用工具

AKShare MCP 服务器提供以下工具:

  • 股票数据查询
  • 基金数据查询
  • 债券数据查询
  • 期货数据查询
  • 外汇数据查询
  • 宏观经济数据查询
  • 还有更多...

添加新工具

要向 MCP 服务器添加新工具,请按照以下步骤操作:

  1. src/mcp_server_akshare/api.py中添加一个新的 API 函数
    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. 将新工具添加到src/mcp_server_akshare/server.py中的枚举中
    class AKShareTools(str, Enum): # Existing tools... NEW_TOOL_NAME = "new_tool_name"
  3. src/mcp_server_akshare/server.py中导入新函数
    from .api import ( # Existing imports... fetch_new_data_function, )
  4. 将工具定义添加到handle_list_tools()函数
    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. handle_call_tool()函数中添加工具处理程序
    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. 通过运行服务器并向新工具发出请求来测试新工具。

发展

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

Docker

您还可以使用 Docker 运行服务器:

# Build the Docker image docker build -t akshare-mcp-server . # Run the Docker container docker run -p 8000:8000 akshare-mcp-server

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

模型上下文协议服务器使 Claude Desktop 能够通过 AKShare 库访问和分析中国及全球金融市场数据。

  1. 特征
    1. 安装
      1. 使用 uv(推荐)
      2. 使用 pip
    2. 用法
      1. 运行服务器
      2. 与 Claude Desktop 集成
    3. 可用工具
      1. 添加新工具
        1. 发展
          1. Docker
            1. 执照

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                A collection of Model Context Protocol servers that enable Claude Desktop to provide development assistance capabilities with filesystem, Git, shell command, and web search functionality without incurring API usage costs.
                Last updated -
                2
                19
                TypeScript
                MIT License
                • Apple
              • -
                security
                F
                license
                -
                quality
                A modular, extensible Model Context Protocol server framework designed for Claude Desktop that uses convention-based automatic module discovery to easily extend AI application functionality without modifying core code.
                Last updated -
                3
                Python
              • A
                security
                A
                license
                A
                quality
                A Model Context Protocol server focused on China's A-share stock market that provides data on stocks, financials, market indices, and macroeconomic indicators.
                Last updated -
                27
                323
                Python
                MIT License
              • A
                security
                A
                license
                A
                quality
                A Model Context Protocol server that enables interaction with Polymarket prediction markets through Claude Desktop.
                Last updated -
                3
                Python
                MIT License
                • Apple

              View all related MCP servers

              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/ttjslbz001/akshare_mcp_server'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server