
ttjslbz001/akshare_mcp_server 是从 https://github.com/ttjslbz001/akshare_mcp_server. 导入的 MCP 服务器候选
概览
ttjslbz001/akshare_mcp_server 是从 https://github.com/ttjslbz001/akshare_mcp_server. 导入的 MCP 服务器候选
概述(AI 翻译)
一台模型上下文协议(MCP)服务器,利用 AKShare 库提供财务数据分析功能。
特色
- 通过AKShare访问中国及全球金融市场数据
- 通过MCP协议与Claude Desktop集成
- 支持各种财务数据查询和分析
安装
使用紫外线(推荐)
使用 pip
用途
运行服务器
与Claude桌面集成
-
在您的Claude桌面配置中添加以下配置:
-
重启 Claude Desktop
-
从可用工具中选择 AKShare MCP 服务器
可用工具
AKShare MCP 服务器提供以下工具:
- 库存数据查询
- 基金数据查询
- 债券数据查询
- Futures 数据查询
- 外汇数据查询
- 宏观经济数据查询
- 还有更多…
添加新工具
要向MCP服务器添加新工具,请按照以下步骤操作:
-
**在
src/mcp_server_akshare/api.py**中添加新的API函数: -
**将新工具添加到
src/mcp_server_akshare/server.py中的枚举中: -
导入
src/mcp_server_akshare/server.py中的新函数: -
将工具定义添加到
handle_list_tools()函数:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 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
- 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": ""
}
}
}
- Restart Claude Desktop
- 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:
-
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 -
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" -
Import the new function in
src/mcp_server_akshare/server.py:from .api import ( # Existing imports... fetch_new_data_function, ) -
Add the tool definition to the
handle_list_tools()function:
安装
docker run -p 8000:8000 akshare-mcp-server配置
"mcpServers": {
"akshare-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/akshare_mcp_server",
"run",
"akshare-mcp"
],
"env": {
"AKSHARE_API_KEY": "<your_api_key_if_needed>"
}
}
}