Skip to main content

MCP server for FactorHub — China A-share market data for AI agents

Project description

FactorHub MCP Server

China A-share market data for AI agents. Query factor scores, market quotes, valuations, and run strategy backtests — all through the Model Context Protocol (MCP).

Features

Tool Description
list_factors 因子列表(分类、搜索)
get_factor_scores 因子评分指标(年化收益、夏普、IC等)
get_factor_nav 因子净值曲线
get_market_daily 个股日线行情(OHLCV)
get_index_daily 指数日线(上证、沪深300等)
get_valuation 估值指标(PE、PB、PS、股息率)
get_stock_info 个股基本信息
get_stock_list 股票筛选
get_trade_dates 交易日历
run_backtest 量化策略回测

Quick Start

1. Get an API Key

Sign up at factorhub.cn and generate your API key at the API Keys page. Free tier includes 10 API calls/day.

2. Install

pip install factorhub-mcp

Or install from source:

git clone https://github.com/michaelfeng/factorhub-mcp.git
cd factorhub-mcp
pip install -e .

3. Configure

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "factorhub": {
      "command": "factorhub-mcp",
      "env": {
        "FACTORHUB_API_KEY": "fh_your_api_key_here"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "factorhub": {
      "command": "factorhub-mcp",
      "env": {
        "FACTORHUB_API_KEY": "fh_your_api_key_here"
      }
    }
  }
}

OpenClaw

Copy openclaw/factorhub-skill.yaml to your OpenClaw skills directory, or add the MCP config directly:

providers:
  factorhub:
    type: mcp
    command: factorhub-mcp
    env:
      FACTORHUB_API_KEY: "fh_your_api_key_here"

Smithery

smithery badge

Install via Smithery for automatic setup.

Usage Examples

Once configured, ask your AI assistant:

  • "查看 FactorHub 有哪些因子"
  • "获取 ROE 因子的历史表现"
  • "帮我查一下贵州茅台最近一年的行情"
  • "用低估值策略回测沪深300成分股"
  • "对比动量因子和价值因子的夏普比率"

Pricing

Plan API Calls/Day Backtest/Day Price
Free 10 1 ¥0
Starter 50 5 ¥39/mo
Pro 200 20 ¥99/mo
Enterprise 1000 100 ¥299/mo

Upgrade at factorhub.cn/pricing.

Architecture

This MCP server is a thin client that calls the FactorHub public API. It does not access any database directly or contain proprietary logic.

AI Agent  →  MCP Protocol  →  factorhub-mcp  →  HTTPS  →  factorhub.cn/api/v1

Security

  • API key is stored in environment variables, never hardcoded
  • All communication uses HTTPS
  • No user data is stored locally
  • Rate limiting is enforced server-side

License

MIT

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

factorhub_mcp-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

factorhub_mcp-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file factorhub_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: factorhub_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for factorhub_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 45a90bf445f02bd0dd761c6d141c98a041dc850ff47497f37d46d7195bad19b9
MD5 c87c8140079b66243ef8e1c0e66d34f8
BLAKE2b-256 6b5816d5f8e3d69c5a346be39c55c935d63798a03b3e4bffa19ad9b7f65ef720

See more details on using hashes here.

File details

Details for the file factorhub_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: factorhub_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for factorhub_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bbe87dd8f6a5af784d8820a0b490bc4aa966c80b1894212550d1e18752936da
MD5 733f02719b54efddcfa602dd8bb7f52d
BLAKE2b-256 e3604b67c1aa7a1361e651097928484268b10ddc3131bb808f5fa80dd5eaa3a9

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