Stock
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.
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
Maintainer
Works with
Installation
Manual Installation
npx stock-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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)
Clone the repository
Clone the stock-mcp repository to your development machine.
git clone https://github.com/huweihua123/stock-mcp.git
cd stock-mcpConfigure 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=strongpasswordStart 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/docsOr 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 9898Connect 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.
Stock Alternatives — Similar Finance & Fintech Servers
Looking for alternatives to Stock? Here are other popular finance & fintech servers you can use with Claude, Cursor, and VS Code.
ValueCell
★ 10.7kValueCell is a community-driven, multi-agent platform for financial applications.
Vibe Trading
★ 8.1k'Vibe-Trading: Your Personal Trading Agent'
Quantdinger
★ 6.2kAI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading
TradingView
★ 2.8kReal-time crypto & stock screening, advanced technical indicators, Bollinger Bands intelligence, candlestick patterns + native Claude Desktop integration. Multi-exchange (Binance, KuCoin, Bybit+). Open-source AI trading infrastructure.
Financial Datasets
★ 2.1kProvides access to comprehensive financial data including income statements, balance sheets, cash flow statements, stock prices, company news, SEC filings, and cryptocurrency information with built-in financial ratio analysis.
Stripe
★ 1.6kThe Stripe Model Context Protocol server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.
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.
Set Up Stock in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.