Get the FREE Ultimate OpenClaw Setup Guide →

stock

专业的金融市场数据 MCP 服务器 - 支持A股/美股/加密货币,原生 MCP 协议,AI Agent 友好

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio huweihua123-stock-mcp docker run -i huweihua123-stock-mcp \
  --env CACHE_TTL="3600" \
  --env HTTP_PROXY="http://127.0.0.1:7890" \
  --env REDIS_HOST="redis" \
  --env HTTPS_PROXY="http://127.0.0.1:7890" \
  --env NEWS_API_KEY="your_news_api_key_here" \
  --env CACHE_ENABLED="true" \
  --env TUSHARE_TOKEN="your_tushare_token_here" \
  --env TAVILY_API_KEY="your_avail_api_key_here" \
  --env FINNHUB_API_KEY="your_finnhub_key_here"

How to use

This Stock MCP Server aggregates stock data from multiple sources (AKShare, Tushare, yFinance, Finnhub) and augments it with AI-powered analysis and visualization features. It exposes a set of endpoints for historical prices, real-time quotes, fundamental data, macroeconomics, and calendar information, all wrapped with an API testing tool and a Swagger/OpenAPI interface for exploration. After starting the service with Docker, you can access an interactive API explorer at the provided docs URL and try out example queries to retrieve price history, news highlights, and AI-generated reports. The included AI capabilities cover sentiment analysis, deep research reports, and multilingual support to aid decision making.

How to install

Prerequisites:

  • Docker and Docker Compose installed on the host
  • Access to the required data/API tokens (TUSHARE_TOKEN, TAVILY_API_KEY, FINNHUB_API_KEY, NEWS_API_KEY)
  • Optional: Redis for caching

Installation steps:

  1. Clone the repository: git clone https://github.com/huweihua123/stock-mcp.git && cd stock-mcp

  2. Prepare environment variables: cp .env.example .env

    Edit .env to add TUSHARE_TOKEN and any optional keys

  3. Start the service with Docker Compose (recommended for quick start): docker-compose up -d

  4. Verify the service is running: docker ps curl http://localhost:9998/docs

  5. If you prefer a single Docker image approach (as an MCP server), start the container with appropriate image name and port mapping. Example: docker run -d --name stock-mcp -p 9998:9998 -e TUSHARE_TOKEN=your_token -e TAVILY_API_KEY=your_key huweihua123-stock-mcp

  6. Access the documentation and test UI at:

Note: If you use a proxy or require Redis caching, ensure Redis is available at the specified host (default redis) and that network access to external data sources is permitted.

Additional notes

Tips and common issues:

  • Ensure TUSHARE_TOKEN and API keys are valid; without tokens, data fetch may fail or return incomplete results.
  • If you experience slow responses, enable caching by setting CACHE_ENABLED=true and tune CACHE_TTL.
  • When using Docker, ensure port 9998 is not occupied by another service; adjust ports if needed.
  • The API supports all three markets (A-share, HK-share, US-share); use appropriate symbols (e.g., 600519 for A-shares, 0700 for HK, AAPL for US) in requests.
  • The built-in interface tester (docs) provides parameter presets; you can customize symbols and date ranges for quick experiments.

Related MCP Servers

Sponsor this space

Reach thousands of developers