Stock

v1.0.0Finance & Fintechstable

Provides real-time stock data and AI-powered analysis for A-shares, Hong Kong stocks, and US stocks. Features sentiment analysis of financial news, deep research reports, and comprehensive market data through multiple integrated data sources.

ai-stock-analysisaksharecrypto-tradingfastmcpfinancial-data
Share:
150
Stars
0
Downloads
0
Weekly
0/5

What is Stock?

Stock is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to provides real-time stock data and ai-powered analysis for a-shares, hong kong stocks, and us stocks. features sentiment analysis of financial news, deep research reports, and comprehensive market data...

Provides real-time stock data and AI-powered analysis for A-shares, Hong Kong stocks, and US stocks. Features sentiment analysis of financial news, deep research reports, and comprehensive market data through multiple integrated data sources.

This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Provides real-time stock data and AI-powered analysis for A-

Use Cases

Provides real-time stock data and AI-powered analysis for A-shares, Hong Kong st
huweihua123

Maintainer

LicenseISC License
Languagepython
Versionv1.0.0
UpdatedMay 20, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx stock-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Stock

Stock MCP Server is a Python-based MCP server providing AI agents with real-time and historical market data, technical analysis indicators, fundamental research, and AI-powered sentiment analysis for A-shares, Hong Kong stocks, US equities, ETFs, and cryptocurrencies through a unified interface backed by sources like Tushare, AKShare, Yahoo Finance, Finnhub, and EDGAR. It runs as a FastAPI/uvicorn service with PostgreSQL for data persistence and exposes tools for K-line data, RSI/MACD/Bollinger Bands calculations, candlestick pattern recognition, money flow analysis, and financial news aggregation. Traders, quants, and developers integrate it with Claude or Cursor to perform natural-language financial research and analysis without writing custom data pipeline code.

Prerequisites

  • Python 3.10 or later, with uv package manager, OR Docker and Docker Compose
  • PostgreSQL database (provided via Docker Compose, or connect your own)
  • Tushare API token (TUSHARE_TOKEN) for A-share and Chinese market data
  • Finnhub API key (FINNHUB_API_KEY) for US market data
  • Tavily API key (TAVILY_API_KEY) for AI-powered news aggregation (optional)
1

Clone the repository

Clone the stock-mcp repository to your development machine.

git clone https://github.com/huweihua123/stock-mcp.git
cd stock-mcp
2

Configure environment variables

Copy the example .env file and fill in your API keys and database credentials.

cp .env.example .env
# Edit .env and set:
# TUSHARE_TOKEN=your_tushare_token
# FINNHUB_API_KEY=your_finnhub_key
# TAVILY_API_KEY=your_tavily_key   # optional, for news
# STOCK_MCP_AUTH_MODE=none          # or token / jwt
# DOCKER_POSTGRES_PASSWORD=strongpassword
3

Start the server with Docker Compose (recommended)

Docker Compose starts both the MCP server and a PostgreSQL instance pre-configured to avoid port conflicts.

docker compose up -d --build
# Server starts on http://127.0.0.1:9898
# Health check: http://127.0.0.1:9898/health
# API docs: http://127.0.0.1:9898/docs
4

Or run locally with uv

Use uv sync to install dependencies and start the server directly without Docker.

uv sync --dev
export STOCK_MCP_AUTH_MODE=none
uv run python -m uvicorn src.server.app:app --host 127.0.0.1 --port 9898
5

Connect your MCP client to the server endpoint

Add the Stock MCP server to your Claude Desktop or Cursor configuration using the HTTP transport.

{
  "mcpServers": {
    "stock-mcp": {
      "type": "http",
      "url": "http://127.0.0.1:9898/mcp"
    }
  }
}

Stock Examples

Client configuration

Claude Desktop configuration for a locally running Stock MCP Server with no authentication (suitable for local development).

{
  "mcpServers": {
    "stock-mcp": {
      "type": "http",
      "url": "http://127.0.0.1:9898/mcp"
    }
  }
}

Prompts to try

Real-world financial research queries that map to the server's tools for price data, technical indicators, fundamentals, and news.

- "Get the daily K-line data for Kweichow Moutai (SSE:600519) for the past 6 months"
- "Calculate RSI, MACD, and Bollinger Bands for Apple (AAPL) over the last 3 months"
- "Identify candlestick patterns in the recent price action for BYD (SZE:002594)"
- "Show money flow analysis for the semiconductor sector ETF (SSE:512480) this week"
- "Summarise the latest financial news about Tesla (TSLA) and give a sentiment score"
- "Fetch the latest SEC 10-K filing summary for Microsoft (MSFT)"

Troubleshooting Stock

Tushare API returns empty data or permission errors

Tushare requires a registered account and a token with sufficient points for the data you are requesting. Some endpoints (e.g. real-time quotes) require a higher-tier account. Verify your TUSHARE_TOKEN is correct and check your Tushare account's permission level at tushare.pro.

Docker Compose fails with a PostgreSQL port conflict

The Docker setup uses port 15432 (not the default 5432) to avoid conflicts with a local PostgreSQL installation. If 15432 is also in use, change DOCKER_POSTGRES_PORT in your .env file and update DATABASE_URL accordingly.

MCP endpoint returns 401 when auth mode is set to token

Set STOCK_MCP_STATIC_BEARER_TOKEN in your .env file and pass it in your MCP client config as: Authorization: Bearer <token>. For local development, set STOCK_MCP_AUTH_MODE=none to disable authentication entirely.

Frequently Asked Questions about Stock

What is Stock?

Stock is a Model Context Protocol (MCP) server that provides real-time stock data and ai-powered analysis for a-shares, hong kong stocks, and us stocks. features sentiment analysis of financial news, deep research reports, and comprehensive market data through multiple integrated data sources. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Stock?

Follow the installation instructions on the Stock GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Stock?

Stock works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Stock free to use?

Yes, Stock is open source and available under the ISC License license. You can use it freely in both personal and commercial projects.

Browse More Finance & Fintech MCP Servers

Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "stock-mcp-server": { "command": "npx", "args": ["-y", "stock-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Stock?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides