📈 StockMCP
A comprehensive Model Context Protocol (MCP) server for real-time stock market data using Yahoo Finance
接入你的智能体
從發布者安裝。不是 PlugMCP 端點。
遠端 URL 還是本機指令? 兩種安裝方式的差異
來自發布者
A comprehensive Model Context Protocol (MCP) server for real-time stock market data using Yahoo Finance
A Model Context Protocol (MCP) server providing real-time stock market data and financial analysis through Yahoo Finance API. Built with FastAPI and designed for AI applications requiring comprehensive financial data access
StockMCP provides a powerful, JSON-RPC 2.0 compliant interface for accessing comprehensive stock market data, built on the Model Context Protocol standard. Perfect for AI applications, financial analysis tools, and trading bots.
Use StockMCP immediately without any setup! We provide a free hosted endpoint at:
https://stockmcp.leoguerin.fr/mcpFor immediate access, use this configuration in your claude_desktop_config.json:
{
"mcpServers": {
"stock-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"https://stockmcp.leoguerin.fr/mcp",
"--header",
"--allow-http"
]
}
}
}
Configuration file locations:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\\Claude\\claude_desktop_config.json# Copy the example environment file
cp .env.example .env
# Edit .env and add your API key
ALPHAVANTAGE_KEY=your-actual-api-key-here
# Clone the repository
git clone https://github.com/yourusername/StockMCP.git
cd StockMCP
# Configure your API key (see API Key Setup above)
cp .env.example .env
# Edit .env with your Alpha Vantage API key
# Build and run with Docker
docker build -t stockmcp .
docker run -p 3001:3001 --env-file .env stockmcp
# Install dependencies with uv (fastest)
uv sync
# Or with pip
pip install -e .
# Configure your API key (see API Key Setup above)
cp .env.example .env
# Edit .env with your Alpha Vantage API key
# Run the server
python src/main.py
# Server runs on http://localhost:3001/mcp
Once your server is running, integrate it with MCP clients:
Edit the configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonAdd this configuration:
{
"mcpServers": {
"stock-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:3001/mcp",
"--header",
"--allow-http"
]
}
}
}
Add to your MCP configuration:
{
"stock-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:3001/mcp",
"--header",
"--allow-http"
]
}
}
For any MCP-compatible client, use:
http://localhost:3001/mcptools/list methodStockMCP implements the Model Context Protocol (MCP) for seamless integration with AI applications. Once running, the server provides:
http://localhost:3001/mcptools/list to get available toolstools/call to execute tools with parametersFor detailed API examples and JSON schemas, access the interactive documentation at http://localhost:3001/mcp/docs when the server is running.
StockMCP/
├── src/
│ ├── main.py # FastAPI server and endpoints
│ ├── models.py # Pydantic models for MCP and stock data
│ ├── mcp_handlers.py # MCP protocol request handlers
│ ├── tools.py # Tools package entry point
│ └── tools/ # Modular tools implementation
│ ├── market_data.py # Real-time quotes, history, fundamentals
│ ├── analysis.py # Forecasts and growth projections
│ └── registry.py # Tool registration and execution
├── tests/ # Comprehensive test suite (100 tests)
├── Dockerfile # Container configuration
├── pyproject.toml # Project dependencies and configuration
└── README.md # This file
# Run all tests
uv run pytest
# Run with verbose output
uv run pytest -v
# Run specific test file
uv run pytest tests/test_api.py
# Run with coverage
uv run pytest --cov=src
Core Dependencies:
Development Dependencies:
# Build the image
docker build -t stockmcp .
# Run the container
docker run -p 3001:3001 stockmcp
# Run in background
docker run -d -p 3001:3001 --name stockmcp-server stockmcp
The container exposes the API on port 3001 by default. You can customize this:
# Custom port mapping
docker run -p 8080:3001 stockmcp
# With environment variables
docker run -p 3001:3001 -e LOG_LEVEL=DEBUG stockmcp
The server can be configured through environment variables:
LOG_LEVEL - Logging level (DEBUG, INFO, WARNING, ERROR)HOST - Server host (default: 0.0.0.0)PORT - Server port (default: 3001)Primary Data Source: Yahoo Finance (yfinance)
Secondary Data Source: Alpha Vantage (optional)
Production Recommendations:
We welcome contributions! Here's how to get started:
git checkout -b feature/amazing-feature)uv run pytest)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for the financial data community by Léo Guerin
A Model Context Protocol (MCP) server providing real-time stock market data and financial analysis through Yahoo Finance API. Built with FastAPI and designed for AI applications requiring comprehens
總覽
A Model Context Protocol (MCP) server providing real-time stock market data and financial analysis through Yahoo Finance API. Built with FastAPI and designed for AI applications requiring comprehensive financial data access
工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
StockMCP 透過 stdio 在本機執行。
上次檢查時間:2026-10-27。 A Model Context Protocol (MCP) server providing real-time stock market data and financial analysis through Yahoo Finance API. Built with FastAPI and designed for AI applications requiring comprehensive financial data access