FinanceMCP-DCTHS MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "TUSHARE_TOKEN=${TUSHARE_TOKEN}" finance-mcp-dcths -- npx -y financemcp-dcths
Required:TUSHARE_TOKEN
README.md

Financial data server integrating Tushare API for market and sector analysis

FinanceMCP-DCTHS

基于 MCP 协议的金融数据服务器,集成 Tushare API,支持东财和同花顺数据源

📋 功能特性

🎯 六大板块分析工具

同花顺(THS)数据源
  1. 同花顺板块指数列表 (get_ths_index)

    • 获取同花顺概念和行业指数列表
    • 支持按指数代码、市场类型、指数类型查询
  2. 同花顺板块行情 (get_ths_daily)

    • 获取同花顺板块指数行情数据
    • 包含开盘价、收盘价、涨跌幅、成交量等
  3. 同花顺板块成分 (get_ths_member)

    • 获取同花顺概念板块成分股
    • 可查询板块包含的股票或股票所属板块
东方财富(DC)数据源
  1. 东财板块信息 (get_dc_index)

    • 获取东财概念板块每日数据
    • 包含领涨股、总市值、涨跌幅等信息
  2. 东财板块成分 (get_dc_member)

    • 获取东财板块成分股数据
    • 支持历史成分查询
  3. 东财板块行情 (get_dc_daily)

    • 获取东财板块行情数据
    • 支持概念板块、行业板块、地域板块

🔧 两种部署模式

特性 stdio 模式 HTTP 模式
适用场景 本地使用 服务器部署
启动方式 npx -y financemcp-dcths node build/httpServer.js
Token 配置 环境变量 环境变量 + HTTP Header
推荐用途 个人使用、快速测试 生产部署、多用户

🚀 快速开始

方式一:直接使用(推荐)⭐

无需安装,直接使用 npx:

npx -y financemcp-dcths

方式二:从源码构建

# 克隆仓库
git clone https://github.com/guangxiangdebizi/FinanceMCP-DCTHS.git
cd FinanceMCP-DCTHS

# 安装依赖
npm install

🔑 配置 Tushare Token

  1. 复制环境变量模板:
cp .env.example .env
  1. 编辑 .env 文件,填入你的 Tushare Token:
TUSHARE_TOKEN=你的tushare_token

获取 Token:访问 Tushare 官网 注册并获取免费 Token

🔨 构建项目

npm run build

▶️ 运行服务器

stdio 模式(推荐本地使用)⭐
npm run start:stdio

或通过 npx 直接运行:

npx -y financemcp-dcths
HTTP 模式(服务器部署)
npm run start:http

服务器将在 http://localhost:3000 启动

📱 客户端配置

⭐ stdio 模式配置(推荐)

在 Claude Desktop 配置文件中添加:

位置

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

配置内容

{
  "mcpServers": {
    "financemcp-dcths": {
      "command": "npx",
      "args": ["-y", "financemcp-dcths"],
      "env": {
        "TUSHARE_TOKEN": "你的tushare_token"
      }
    }
  }
}

🌐 HTTP 模式配置

{
  "mcpServers": {
    "financemcp-dcths": {
      "type": "streamableHttp",
      "url": "http://localhost:3000/mcp",
      "timeout": 600,
      "headers": {
        "X-Tushare-Token": "你的tushare_token"
      }
    }
  }
}

HTTP 模式支持三种 Token 传递方式:

  1. X-Tushare-Token 请求头(推荐)
  2. X-Api-Key 请求头
  3. Authorization: Bearer <token> 请求头

💡 使用示例

示例 1:查询同花顺概念板块列表

在 Claude 中输入:

查询所有同花顺概念指数

对应的 MCP 调用:

{
  "name": "get_ths_index",
  "arguments": {
    "type": "N"
  }
}

示例 2:查询东财板块今日数据

在 Claude 中输入:

查询东财人形机器人板块今天的数据

对应的 MCP 调用:

{
  "name": "get_dc_index",
  "arguments": {
    "name": "人形机器人",
    "trade_date": "20231201"
  }
}

示例 3:查询同花顺板块行情

在 Claude 中输入:

查询同花顺人工智能板块最近一周的行情

对应的 MCP 调用:

{
  "name": "get_ths_daily",
  "arguments": {
    "ts_code": "885823.TI",
    "start_date": "20231201",
    "end_date": "20231207"
  }
}

示例 4:查询板块成分股

在 Claude 中输入:

查询东财新能源汽车板块包含哪些股票

对应的 MCP 调用:

{
  "name": "get_dc_member",
  "arguments": {
    "ts_code": "BK0001.DC",
    "trade_date": "20231201"
  }
}

📚 API 参数说明

🔵 同花顺工具参数

get_ths_index - 板块指数列表
参数 类型 必填 说明
ts_code string 指数代码(如 885823.TI)
exchange string 市场类型:A-A股 HK-港股 US-美股
type string 指数类型:N-概念指数 I-行业指数 R-地域指数 等
get_ths_daily - 板块行情
参数 类型 必填 说明
ts_code string 指数代码(如 885823.TI)
trade_date string 交易日期(YYYYMMDD)
start_date string 开始日期
end_date string 结束日期
get_ths_member - 板块成分
参数 类型 必填 说明
ts_code string 板块指数代码(查询该板块的成分股)
con_code string 股票代码(查询该股票所属板块)

🟢 东方财富工具参数

get_dc_index - 板块信息
参数 类型 必填 说明
ts_code string 指数代码(支持多个,逗号分隔)
name string 板块名称(如:人形机器人)
trade_date string 交易日期(YYYYMMDD)
start_date string 开始日期
end_date string 结束日期
get_dc_member - 板块成分
参数 类型 必填 说明
ts_code string 板块指数代码
con_code string 成分股票代码
trade_date string 交易日期(支持历史查询)
get_dc_daily - 板块行情
参数 类型 必填 说明
ts_code string 板块代码(格式:xxxxx.DC)
trade_date string 交易日期(YYYYMMDD)
start_date string 开始日期
end_date string 结束日期
idx_type string 板块类型:概念板块、行业板块、地域板块

🔐 Token 安全建议

  • 本地开发:使用 .env 文件存储 Token(已在 .gitignore

Tools (6)

get_ths_indexGet Flush concept and industry index lists
get_ths_dailyGet Flush sector index market data
get_ths_memberGet Flush concept sector constituent stocks
get_dc_indexGet East Money concept sector daily data
get_dc_memberGet East Money sector constituent stock data
get_dc_dailyGet East Money sector market data

Environment Variables

TUSHARE_TOKENrequiredAPI token from Tushare to access financial data

Configuration

claude_desktop_config.json
{"mcpServers": {"financemcp-dcths": {"command": "npx", "args": ["-y", "financemcp-dcths"], "env": {"TUSHARE_TOKEN": "your_tushare_token"}}}}

Try it

List all available Flush concept indices.
Get the latest market data for the East Money humanoid robot sector.
Show me the constituent stocks for the New Energy Vehicle sector on East Money.
Retrieve the weekly market performance for the Flush AI sector index.

Frequently Asked Questions

What are the key features of FinanceMCP-DCTHS?

Integration with Tushare API for comprehensive financial data. Support for both Flush (THS) and East Money (DC) data sources. Query sector indexes, market trends, and constituent stock data. Supports both stdio and HTTP deployment modes.

What can I use FinanceMCP-DCTHS for?

Automated financial market research and sector analysis. Tracking performance of specific industry or concept blocks. Identifying constituent stocks within specific market sectors. Building custom financial dashboards using MCP-compatible clients.

How do I install FinanceMCP-DCTHS?

Install FinanceMCP-DCTHS by running: npx -y financemcp-dcths

What MCP clients work with FinanceMCP-DCTHS?

FinanceMCP-DCTHS works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep FinanceMCP-DCTHS docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare