Stock Data MCP Server

April 8, 2025 ยท View on GitHub

This MCP server provides stock market data using the Finnhub API. It allows LLMs like Claude to access stock quotes, company profiles, and search for stock symbols.

Features

  • Get real-time stock quotes and prices
  • Access company profiles and information
  • Search for stock symbols by name or ticker
  • Caching to prevent API rate limit issues

Setup

  1. Install the required dependencies:

    pip install mcp finnhub-python python-dotenv
    
  2. Get a Finnhub API key:

  3. Configure your .env file:

    FINNHUB_API_KEY="your_finnhub_api_key_here"
    

Running the Server

Development Mode with MCP Inspector

Test your server with the MCP Inspector:

mcp dev stock_server.py

Integration with Claude Desktop

Install the server in Claude Desktop:

mcp install stock_server.py --name "Stock Data"

Or add it to your claude_desktop_config.json file manually:

{
  "mcpServers": {
    "stock-data": {
      "command": "python",
      "args": ["/path/to/stock_server.py"],
      "env": {
        "FINNHUB_API_KEY": "your_finnhub_api_key_here"
      }
    }
  }
}

Usage Examples

Once connected to an LLM, you can ask questions like:

  • "What's the current stock price of AAPL?"
  • "Give me information about Microsoft's stock"
  • "Search for stocks related to electric vehicles"
  • "Show me the company profile for TSLA"

Limitations

  • The free Finnhub API has rate limits (60 calls/minute)
  • Only US stock market data is supported in the current implementation
  • Company data might not be available for all symbols