Stock Snapshot MCP

Stock Snapshot MCP

A minimal MCP server that provides stock snapshots including company metadata, latest quote, fundamentals, and daily price history via the Alpha Vantage API.

Category
Visit Server

README

πŸ“ˆ Stock Snapshot MCP

Python MCP AlphaVantage Claude Status License PyPI

A minimal, educational MCP server for stock snapshots using the free Alpha Vantage API.

Stock Snapshot MCP is a tiny, easy-to-read reference implementation of a
Model Context Protocol (MCP) server.

It exposes a single, clean tool: get_stock_snapshot(symbol, history_days=60)

This tool queries the free Alpha Vantage API and returns:

  • Company metadata (name, sector, industry, exchange, currency)
  • Latest quote (price, change, percent, previous close, volume)
  • Basic fundamentals (PE ratio, EPS, market cap, ROE, profit margin β€” if available)
  • Recent OHLCV price history (daily candles)

This project is ideal for:

  • People learning MCP through a small, realistic example
  • Developers building RAG-ready financial research agents
  • Students who want a simple MCP server to extend or customize
  • Anyone experimenting with Claude / ChatGPT MCP integrations
  • Mini-projects where clean, structured stock data is useful

Note: This project is not affiliated with Alpha Vantage.
It is designed solely as an educational reference.
Not for real trading or investment decisions.


✨ Features

  • πŸ“¦ Lightweight Python package (pip install stock-snapshot-mcp)
  • πŸ”Œ MCP server (stdio) compatible with Claude Desktop, ChatGPT MCP, and other tools
  • πŸ” Clean JSON output suitable for LLM reasoning & agent pipelines

βš™οΈ Installation

1. Install the package

pip install stock-snapshot-mcp

2. Set your Alpha Vantage API key

Create a .env file or export it:

export ALPHAVANTAGE_API_KEY=your_key_here

πŸ—£οΈ Example: Claude-Powered Stock Analysis Chatbot

This repository includes a simple but powerful example demonstrating how to combine:

  • stock_snapshot_mcp
  • Claude (Anthropic API)
  • Alpha Vantage data

to build a terminal-based stock analysis chatbot:

examples/claude_stock_chat.py

What this example does

  1. Fetches real market data
from stock_snapshot_mcp import get_stock_snapshot
  1. Sends the snapshot JSON to Claude
  2. Claude returns an educational, non-advisory analysis

The chatbot enforces strict safety rules:

  • No investment advice
  • No buy/sell/hold language
  • Educational tone only

Run the chatbot

export ANTHROPIC_API_KEY=your_claude_key
export ALPHAVANTAGE_API_KEY=your_alpha_vantage_key

python examples/claude_stock_chat.py

Example interaction:

Enter stock symbol: AAPL
What do you want to know? <user input>

Process Flow

sequenceDiagram
    participant U as User
    participant C as CLI Chat (claude_stock_chat.py)
    participant S as stock_snapshot_mcp
    participant A as Alpha Vantage API
    participant L as Claude (Anthropic API)

    U->>C: Enter ticker (e.g. AAPL) + question
    C->>S: get_stock_snapshot("AAPL", history_days=60)
    S->>A: HTTP request for quote, fundamentals, daily prices
    A-->>S: JSON responses (quote, overview, time series)
    S-->>C: Normalized snapshot dict (meta, quote, fundamentals, history)

    C->>L: Snapshot JSON + user question in prompt
    L-->>C: Educational explanation (no investment advice)

    C-->>U: Print explanation in terminal

πŸš€ Running the MCP server

πŸ§ͺ Testing locally (Python)

You can call the helper function directly:

from stock_snapshot_mcp import get_stock_snapshot
import asyncio

async def main():
    snap = await get_stock_snapshot("AAPL", history_days=5)
    print(snap)

asyncio.run(main())

πŸ§ͺ Example: manual MCP client

For debugging or learning MCP, you can run:

python examples/manual_mcp_client.py

πŸ–₯️ Using with Claude Desktop (example config)

Place this inside Claude’s configuration file:

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

Add:

{
  "mcpServers": {
    "stock-snapshot-mcp": {
      "command": "stock-snapshot-mcp",
      "env": {
        "ALPHAVANTAGE_API_KEY": "your_key_here"
      }
    }
  }
}

Restart Claude Desktop β†’ you should see Stock Snapshot MCP under "Connected Servers".

Then you can ask Claude:

Call get_stock_snapshot for AAPL and summarize the fundamentals.

πŸ“€ Using with ChatGPT MCP (OpenAI Desktop / browser)

Add a new MCP connection:

  • Command: stock-snapshot-mcp
  • Environment:
    • ALPHAVANTAGE_API_KEY=your_key_here And that’s it.

πŸ“š Tool Definition (JSON Schema)

get_stock_snapshot(
  symbol: string (required),
  history_days: integer (optional, 1–100, default: 60)
)

Output fields

{
  "symbol": "AAPL",
  "meta": {
    "name": "Apple Inc",
    "sector": "TECHNOLOGY",
    "industry": "CONSUMER ELECTRONICS",
    "currency": "USD",
    "exchange": "NASDAQ"
  },
  "quote": {
    "price": 278.78,
    "change": -1.92,
    "change_percent": -0.684,
    "previous_close": 280.7,
    "latest_trading_day": "2025-12-05",
    "volume": 47265845
  },
  "fundamentals": {
    "market_cap": 4137203794000,
    "pe_ratio_ttm": 37.32,
    "eps_ttm": 7.47,
    "roe_ttm": 1.714,
    "profit_margin": 0.269
  },
  "daily_history": [ ... ]
}

🧱 Project Structure

stock-snapshot-mcp/
β”‚
β”œβ”€β”€ dist/                              # Built distributions (wheel + sdist)
β”‚   β”œβ”€β”€ stock_snapshot_mcp-0.1.0.tar.gz
β”‚   └── stock_snapshot_mcp-0.1.0-py3-none-any.whl
β”‚
β”œβ”€β”€ examples/
β”‚   └── manual_mcp_client.py           # Human-readable demo MCP client
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ stock_snapshot_mcp/            # Actual Python package 
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ alpha_vantage_client.py    # Async Alpha Vantage helper functions
β”‚   β”‚   └── server.py                  # MCP stdio server entrypoint
β”‚   β”‚
β”‚   └── stock_snapshot_mcp.egg-info/   # Metadata created after build
β”‚
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_alpha_vantage_client.py   # Integration test for API wrapper
β”‚   └── test_mcp_server.py             # Full MCP stdio server end-to-end test
β”‚
β”œβ”€β”€ LICENSE
β”œβ”€β”€ pyproject.toml                     # Package config (build + metadata)
└── README.md


πŸ›‘ Disclaimer

This project:

  • is not affiliated with Alpha Vantage
  • is not financial advice
  • is provided for educational and research purposes only

πŸ“œ License

MIT License β€” free to use, modify, and learn from.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured