📈 Finnhub MCP Server

A standard MCP server providing real-time stock quotes and news via Finnhub API, using JSON-RPC over SSE protocol.

What is MCP?

  • Model Context Protocol (MCP) is a standardized way to connect AI assistants with external tools and data
  • This server implements the standard MCP protocol (JSON-RPC over Server-Sent Events)
  • Compatible with MCP clients like Claude Desktop, Cursor IDE, and other MCP-enabled applications

How to Configure MCP Client

📥 Step 1: Clone Repository

git clone https://huggingface.co/spaces/JC321/MarketandStockMCP
cd MarketandStockMCP
pip install -r requirements.txt

🔑 Step 2: Get Finnhub API Key

⚙️ Step 3: Configure MCP Client

For Claude Desktop:

Edit configuration file:

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

Add this configuration:

{
  "mcpServers": {
    "finnhub": {
      "command": "python",
      "args": ["C:\\path\\to\\MarketandStockMCP\\mcp_server.py"],
      "env": {
        "FINNHUB_API_KEY": "your_finnhub_api_key_here"
      }
    }
  }
}

For Cursor IDE:

Add to MCP settings with the same JSON configuration above.

💡 Tip: Replace C:\\path\\to\\MarketandStockMCP\\mcp_server.py with your actual file path. Use double backslashes (\\) on Windows.

🚀 Step 4: Restart & Test

  • Restart your MCP client (Claude Desktop / Cursor)
  • Try asking: "What's the current price of Apple stock?"
  • The client will automatically call get_quote(symbol="AAPL")

Available Tools

  • get_quote(symbol: str) — Get real-time stock price, daily change, high, low, open, previous close
  • get_market_news(category: str, min_id: int) — Get latest market news by category (general/forex/crypto/merger)
  • get_company_news(symbol: str, from_date: str, to_date: str) — Get company-specific news within date range

Web UI Testing

  • Use the tabs above to test tools manually through the web interface
  • Health Check - Verify API connectivity
  • Tool Tabs - Test each tool with custom parameters
  • API Key Config - Configure API key for web testing (not needed for MCP client use)
💡 Note: This web UI is for testing only. For production use, connect via MCP client as described above.

Technical Details

  • Protocol: Standard MCP (Model Context Protocol)
  • Transport: JSON-RPC over Server-Sent Events (SSE)
  • Data Source: Finnhub API (docs)
  • Compatibility: All MCP-compliant clients
  • Rate Limits: ~60 requests/min (free tier)