Skip to main content

AkShare MCP Server - 提供 AkShare 金融数据接口的 MCP 服务

Project description

AkShare MCP Server

提供 AkShare 金融数据接口的 MCP 服务。

版本更新

v1.1.0 (2025-01-02)

  • 🎉 重构工具接口:从 3 个工具简化为 2 个核心工具
  • 智能搜索search_functions 支持多关键词组合搜索
  • 📋 参数规范化:清晰展示参数类型、默认值、描述
  • 🔧 一步到位:可选 include_detail 直接获取完整函数信息
  • 🐛 修复日期序列化:自动处理 date/datetime 对象
  • 📚 改进文档:更详细的使用说明和示例

功能特性

  • 🔍 智能搜索 AkShare 函数(支持多关键词)
  • 📖 查看函数详细信息(参数类型、默认值、文档)
  • 🚀 执行函数获取金融数据
  • 💰 支持股票、基金、期货、宏观经济等 1000+ 数据接口

安装

pip install data-wise-akshare-mcp-server

使用方法

作为 MCP 服务器运行

uvx data-wise-akshare-mcp-server

在 Kiro 中配置

.kiro/settings/mcp.json 中添加:

{
  "mcpServers": {
    "akshare": {
      "command": "uvx",
      "args": ["data-wise-akshare-mcp-server"]
    }
  }
}

可用工具

1. search_functions - 智能搜索函数

搜索 AkShare 函数,支持多关键词组合搜索,可选返回详细信息。

参数:

  • keyword (可选): 搜索关键词,支持空格分隔多个关键词
    • 例如:"stock zh hist" 搜索 A股历史数据
  • limit (可选): 返回数量限制,默认 10
  • include_detail (可选): 是否返回详细信息,默认 False
    • False: 返回函数名和简短描述
    • True: 返回完整参数信息(类型、默认值、描述)

示例:

快速浏览:

{
  "keyword": "stock",
  "limit": 5,
  "include_detail": false
}

获取详细信息:

{
  "keyword": "stock zh hist",
  "limit": 3,
  "include_detail": true
}

搜索技巧:

  • 函数名中的下划线会被当作空格,所以 "stock hist" 可以匹配 stock_zh_a_hist
  • 多个关键词用空格分隔,会匹配同时包含所有关键词的函数
  • 常用搜索:
    • "stock zh spot" - A股实时行情
    • "fund etf" - ETF基金
    • "futures main" - 期货主力合约
    • "macro china gdp" - 中国GDP数据

2. execute_function - 执行函数

执行指定的 AkShare 函数并返回数据。

参数:

  • function_name (必需): 函数名(通过 search_functions 查找)
  • params (可选): 函数参数字典

示例:

无参数函数:

{
  "function_name": "macro_china_gdp",
  "params": {}
}

带参数函数:

{
  "function_name": "stock_zh_a_hist",
  "params": {
    "symbol": "000001",
    "period": "daily",
    "start_date": "20240101",
    "end_date": "20241231"
  }
}

使用流程

推荐流程(2步):

  1. 使用 search_functions 搜索并获取函数详情

    {
      "keyword": "stock zh hist",
      "include_detail": true
    }
    
  2. 使用 execute_function 执行函数获取数据

    {
      "function_name": "stock_zh_a_hist",
      "params": {"symbol": "000001"}
    }
    

常用函数示例

股票数据

  • stock_zh_a_spot_em: A股实时行情
  • stock_zh_a_hist: A股历史行情
  • stock_zh_a_daily: A股日线数据

基金数据

  • fund_open_fund_info_em: 开放式基金信息
  • fund_etf_spot_em: ETF实时行情

期货数据

  • futures_main_sina: 期货主力合约
  • futures_zh_spot: 期货实时行情

宏观经济

  • macro_china_cpi: 中国CPI数据
  • macro_china_ppi: 中国PPI数据
  • macro_china_gdp: 中国GDP数据

依赖

  • fastmcp >= 2.14.1
  • akshare >= 1.14.0

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data_wise_akshare_mcp_server-1.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

data_wise_akshare_mcp_server-1.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file data_wise_akshare_mcp_server-1.1.0.tar.gz.

File metadata

File hashes

Hashes for data_wise_akshare_mcp_server-1.1.0.tar.gz
Algorithm Hash digest
SHA256 54b0e72d02905aec57a9064423b1151dd5ef6719070e81300af39755a77c87f0
MD5 6bb7bdadbb9bc4a6db1afcc05d403a61
BLAKE2b-256 1f41e2e5d147228d79114074f4807095e61318d8cc69162daca3b6899e32d05b

See more details on using hashes here.

File details

Details for the file data_wise_akshare_mcp_server-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for data_wise_akshare_mcp_server-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85d93feccc4d3b107d01e38a53abc06e2a169ac6d0692e6d5c131cea7d78801b
MD5 57f3a988e3904cf6d4c5c689564bcc47
BLAKE2b-256 95b9d0c45bc7b3e2d860661e3334a8ad25b7dc79ac7432f526a36a2ca0ea2273

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page