StockMCP: an MCP server for stock market data

StockMCP: an MCP server for stock market data

stockmcp•byleogue

StockMCP is a JSON-RPC 2.0 compliant Model Context Protocol server that provides access to stock market data, built on Yahoo Finance data sources.

License: MIT License•Runtime: Awaiting documentation review•Category: finance crypto

WHAT IT DOES

  • •Provides tools for real-time quotes, fundamentals, price history, dividends and corporate actions, analyst forecasts, and growth projections.
  • •Exposes a JSON-RPC 2.0 over HTTP endpoint with tools/list discovery and tools/call execution.
  • •Uses Yahoo Finance as its primary free data source, with optional Alpha Vantage as a secondary source for enhanced earnings estimates and forecasts.

BEST FOR

  • •AI applications and financial analysis tools that need stock market data through MCP.
  • •Users who want to connect immediately to a hosted stock data MCP endpoint without setup.

ABOUT STOCKMCP

StockMCP: an MCP server for stock market data is cataloged as an MCP server attributed to leogue. StockMCP is a JSON-RPC 2.0 compliant Model Context Protocol server that provides access to stock market data, built on Yahoo Finance data sources. It is categorized under finance crypto. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for StockMCP: an MCP server for stock market data are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Does StockMCP require an API key to use the hosted endpoint?

No. The free hosted endpoint requires no API key; Alpha Vantage is only an optional secondary source for extended features.

What transport and protocol does StockMCP use?

It serves the Model Context Protocol over HTTP using JSON-RPC 2.0.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 376842e3ffb7 · 采集于 2026-11-13 11:16:14 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

📈 StockMCP

A comprehensive Model Context Protocol (MCP) server for real-time stock market data using Yahoo Finance

Python 3.10+ FastAPI License: MIT Tests

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.

🌐 Free Hosted Endpoint

Use StockMCP immediately without any setup! We provide a free hosted endpoint at:

  • Endpoint: https://stockmcp.leoguerin.fr/mcp
  • No API key required - Just add to your MCP client configuration

Claude Desktop Configuration

For 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:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\\Claude\\claude_desktop_config.json

🛠️ Available Tools

Tool NameDescription
get_realtime_quoteRetrieve current market data including price, volume, market cap, and key financial ratios
get_fundamentalsAccess comprehensive financial statements (income, balance sheet, cash flow) and calculated ratios
get_price_historyGet historical OHLCV data with optional total return calculation including reinvested dividends
get_dividends_and_actionsAnalyze dividend payment history and corporate actions with quality metrics and consistency scoring
get_analyst_forecastsGet analyst price targets, consensus ratings (Buy/Hold/Sell), and EPS forecasts from professional analysts
get_growth_projectionsForward growth projections for revenue, earnings (EPS), and free cash flow with 1-year, 3-year, and 5-year CAGR estimates

🚀 Quick Start

API Key Setup

  1. Get a free Alpha Vantage API key: Visit https://www.alphavantage.co/support/#api-key
  2. Configure environment:
    # 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

Local Development

# 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

MCP Client Integration

Once your server is running, integrate it with MCP clients:

Claude Desktop

Edit the configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add this configuration:

{
  "mcpServers": {
    "stock-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:3001/mcp",
        "--header",
        "--allow-http"
      ]
    }
  }
}

Cursor

Add to your MCP configuration:

{
  "stock-mcp": {
    "command": "npx",
    "args": [
      "mcp-remote",
      "http://localhost:3001/mcp",
      "--header",
      "--allow-http"
    ]
  }
}

Other MCP Clients

For any MCP-compatible client, use:

  • Endpoint: http://localhost:3001/mcp
  • Protocol: JSON-RPC 2.0 over HTTP
  • Tools: Available via tools/list method

🔗 Usage

StockMCP implements the Model Context Protocol (MCP) for seamless integration with AI applications. Once running, the server provides:

  • Endpoint: http://localhost:3001/mcp
  • Protocol: JSON-RPC 2.0 over HTTP
  • Discovery: Use tools/list to get available tools
  • Execution: Use tools/call to execute tools with parameters

For detailed API examples and JSON schemas, access the interactive documentation at http://localhost:3001/mcp/docs when the server is running.

🛠️ Development

Project Structure

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

Running Tests

# 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

Dependencies

Core Dependencies:

  • FastAPI - Modern web framework for APIs
  • Pydantic - Data validation using Python type hints
  • yfinance - Yahoo Finance data retrieval (primary data source)
  • pandas - Data manipulation and analysis
  • scipy - Scientific computing (required by yfinance)

Development Dependencies:

  • pytest - Testing framework
  • httpx - HTTP client for testing
  • pytest-mock - Mocking utilities

🐳 Docker Deployment

Build and Run

# 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

Environment Configuration

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

🔧 Configuration

Server Configuration

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)

API Limits & Data Sources

Primary Data Source: Yahoo Finance (yfinance)

  • Free tier with reasonable rate limits
  • Real-time and historical data
  • No API key required for basic usage

Secondary Data Source: Alpha Vantage (optional)

  • Enhanced earnings estimates and forecasts
  • Requires free API key for extended features
  • Graceful fallback when unavailable

Production Recommendations:

  • Implement request caching
  • Add retry logic with exponential backoff
  • Monitor API usage patterns
  • Consider data source redundancy

🤝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with proper tests
  4. Run the test suite (uv run pytest)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Guidelines

  • Type Hints - All functions should have proper type annotations
  • Tests - New features must include comprehensive tests
  • Documentation - Update README and docstrings for any API changes
  • Code Style - Follow PEP 8 and use meaningful variable names

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Yahoo Finance - For providing free stock market data
  • Model Context Protocol - For the excellent protocol specification
  • FastAPI - For the amazing web framework
  • Pydantic - For robust data validation

📞 Support

  • 🐛 Bug Reports - Open an issue
  • 💡 Feature Requests - Start a discussion
  • 📖 Documentation - Check our comprehensive API docs
  • 💬 Community - Join our discussions for help and ideas

Made with ❤️ for the financial data community by Léo Guerin

⭐ Star this repo | 🍴 Fork it | 📖 Docs

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for StockMCP: an MCP server for stock market data from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/stockmcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related finance crypto MCP Servers

Alternative and complementary servers in the same category

View all in finance crypto →
USA Spending MCP Server
usaspending-mcp-server•thsmale

A stateless streamable HTTP MCP server for interacting with the official source of government spending data.

Repository stats unavailable
Finance & Analytics
Fortnox MCP server — More AI
more-ai-chatgpt-claude-mcp-fortnox•amor3

A hosted, remote MCP server for Fortnox that lets AI assistants answer questions from a company's bookkeeping and propose changes for approval before writing them.

0
Finance & Analytics

OptimistFi is a read-only remote MCP server that provides perpetual futures market data, perps prop firm rules and pricing, and US equity investment research.

Repository stats unavailable
Finance & Analytics