Skip to main content
Glama
mcp-finnhub

mcp-finnhub

by cfdude

mcp-finnhub

Python 3.11+ License: MIT MCP

Model Context Protocol (MCP) server providing comprehensive access to Finnhub financial market data API. Built for AI assistants like Claude Desktop to seamlessly access real-time market data, technical indicators, fundamentals, and alternative data.

Features

  • 15 MCP Tools covering 100+ Finnhub API endpoints

  • Real-time market data: Quotes, candles, tick data, BBO

  • Technical analysis: 50+ indicators, patterns, support/resistance

  • Fundamentals: Financials, earnings, dividends, metrics

  • Alternative data: ESG scores, social sentiment, supply chain

  • Multi-asset support: Stocks, crypto, forex, ETFs, bonds

  • Project-based storage with automatic CSV/JSON exports

  • Background job processing for large datasets

  • Smart output handling with token estimation

  • Configurable tools - enable only what you need

  • AI-friendly errors - Structured error responses with guidance

  • Built-in help - Every tool supports operation="help" for discovery

Related MCP server: massive-mcp

Quick Start

Prerequisites

Installation

Option 1: Install from PyPI (coming soon)

pip install mcp-finnhub

Option 2: Install from source

git clone https://github.com/cfdude/mcp-finnhub.git
cd mcp-finnhub
pip install -e .

Configuration

  1. Create a .env file in your project root:

# Required
FINNHUB_API_KEY=your_api_key_here
FINNHUB_STORAGE_DIR=/path/to/storage

# Optional - Tool configuration
FINNHUB_ENABLE_TECHNICAL_ANALYSIS=true
FINNHUB_ENABLE_STOCK_MARKET_DATA=true
FINNHUB_ENABLE_NEWS_SENTIMENT=true
# ... enable/disable other tools as needed

# Optional - Performance tuning
FINNHUB_RATE_LIMIT_RPM=300  # Requests per minute (30 free, 300 premium)
FINNHUB_REQUEST_TIMEOUT=30  # Request timeout in seconds
FINNHUB_SAFE_TOKEN_LIMIT=75000  # Conservative token limit
  1. Configure Claude Desktop to use mcp-finnhub by adding to claude_desktop_config.json:

{
  "mcpServers": {
    "finnhub": {
      "command": "mcp-finnhub",
      "env": {
        "FINNHUB_API_KEY": "your_api_key_here",
        "FINNHUB_STORAGE_DIR": "/Users/yourname/finnhub-data"
      }
    }
  }
}
  1. Restart Claude Desktop

First Query

Ask Claude:

"Get me the latest quote for AAPL"

Claude will use the finnhub_stock_market_data tool with the get_quote operation to fetch Apple's real-time stock quote.

Available Tools

Core Trading & Analysis (3 tools)

  • finnhub_stock_market_data - Quotes, candles, tick data, BBO, market status

  • finnhub_technical_analysis - 50+ indicators (RSI, MACD, SMA), patterns, signals

  • finnhub_news_sentiment - Company news, market news, sentiment scores

Fundamentals & Analysis (5 tools)

  • finnhub_stock_fundamentals - Financials, earnings, dividends, metrics

  • finnhub_stock_estimates - Revenue/EPS estimates, price targets

  • finnhub_stock_ownership - Insider trades, institutional holdings

  • finnhub_alternative_data - ESG scores, social sentiment, supply chain

  • finnhub_sec_filings - SEC filings, earnings transcripts

Multi-Asset Data (4 tools)

  • finnhub_crypto_data - Crypto exchanges, symbols, profiles, candles

  • finnhub_forex_data - Forex rates, candles, exchanges

  • finnhub_calendar_data - IPO calendar, earnings calendar, economic events

  • finnhub_market_events - Market holidays, analyst upgrades/downgrades

Management Tools (3 tools)

  • finnhub_project_create - Create project workspaces

  • finnhub_project_list - List all projects with statistics

  • finnhub_job_status - Check background job status

Example Workflows

Technical Analysis Workflow

User: "Analyze TSLA using RSI and MACD indicators"

Claude uses:
1. finnhub_technical_analysis → get_indicator (operation=get_indicator, symbol=TSLA, indicator=rsi)
2. finnhub_technical_analysis → get_indicator (operation=get_indicator, symbol=TSLA, indicator=macd)
3. Analyzes both indicators and provides trading insights

Fundamental Research Workflow

User: "Research MSFT - get financials, earnings, and analyst estimates"

Claude uses:
1. finnhub_stock_fundamentals → get_basic_financials (operation=get_basic_financials, symbol=MSFT)
2. finnhub_stock_fundamentals → get_earnings (operation=get_earnings, symbol=MSFT)
3. finnhub_stock_estimates → get_earnings_estimates (operation=get_earnings_estimates, symbol=MSFT)
4. Summarizes financial health and analyst outlook

Multi-Asset Portfolio Workflow

User: "Create a project called 'my-portfolio', get quotes for AAPL, BTC-USD, and EUR/USD"

Claude uses:
1. finnhub_project_create → create (operation=create, project=my-portfolio)
2. finnhub_stock_market_data → get_quote (operation=get_quote, symbol=AAPL, project=my-portfolio)
3. finnhub_crypto_data → get_crypto_profile (operation=get_crypto_profile, symbol=BINANCE:BTCUSDT)
4. finnhub_forex_data → get_forex_rates (operation=get_forex_rates, base=EUR, project=my-portfolio)
5. All data saved to /storage/my-portfolio/ with CSV exports

Tool Configuration

Control which tools are available to reduce context window usage:

# Disable tools you don't need
FINNHUB_ENABLE_CRYPTO=false
FINNHUB_ENABLE_FOREX=false
FINNHUB_ENABLE_ALTERNATIVE_DATA=false

# Core tools (always recommended)
FINNHUB_ENABLE_STOCK_MARKET_DATA=true
FINNHUB_ENABLE_TECHNICAL_ANALYSIS=true
FINNHUB_ENABLE_NEWS_SENTIMENT=true

Rate Limits

  • Free tier: 60 requests/minute

  • Basic tier: 150 requests/minute ($49.99/month)

  • Premium tier: 300 requests/minute

  • Enterprise tier: Custom limits

mcp-finnhub automatically handles rate limiting with exponential backoff and retry logic.

AI Agent Features

Help/Discovery

Every tool supports operation="help" to discover available operations:

finnhub_stock_fundamentals(operation="help")
# Returns all operations with required/optional params and examples

Structured Errors

Errors return actionable JSON instead of stack traces:

{
  "error": "invalid_operation",
  "message": "Operation 'get_data' not found",
  "valid_operations": ["get_basic_financials", "get_dividends", ...],
  "tool": "finnhub_stock_fundamentals"
}

Storage Structure

Projects are stored in subdirectories:

FINNHUB_STORAGE_DIR/
├── my-portfolio/
│   ├── .project.json         # Project metadata
│   ├── candles/              # Historical price data
│   ├── quotes/               # Real-time quotes
│   ├── news/                 # News articles
│   ├── fundamentals/         # Financial data
│   ├── technical/            # Technical indicators
│   └── jobs/                 # Background job results
└── research-tech/
    └── ...

Development

Setup

# Clone repository
git clone https://github.com/cfdude/mcp-finnhub.git
cd mcp-finnhub

# Install with dev dependencies
uv sync --all-extras

# Run tests
uv run pytest --cov=mcp_finnhub --cov-report=term-missing

# Lint and format
uv run ruff check --fix .
uv run ruff format .

Running Locally

# Set environment variables
export FINNHUB_API_KEY=your_api_key
export FINNHUB_STORAGE_DIR=/tmp/finnhub-data

# Run with STDIO transport (default, for Claude Desktop)
mcp-finnhub

# Run with HTTP streaming (recommended for persistent/remote connections)
mcp-finnhub --transport http --port 8000

# Run with SSE transport (deprecated, use HTTP instead)
mcp-finnhub --transport sse --port 8000

# Custom host binding for network access
mcp-finnhub --transport http --host 0.0.0.0 --port 8125

Transport Options

Transport

Use Case

Command

stdio

Claude Desktop, local MCP clients

mcp-finnhub (default)

http

Remote connections, persistent server, Claude Code

mcp-finnhub --transport http --port 8000

sse

Legacy SSE clients (deprecated)

mcp-finnhub --transport sse --port 8000

Running as a Persistent Service

For HTTP transport, you can run the server as a background service:

# Using nohup (simple)
nohup mcp-finnhub --transport http --port 8000 > finnhub.log 2>&1 &

# Using systemd (Linux)
# See docs/DEPLOYMENT.md for service file examples

Testing with MCP Inspector

# Install MCP inspector
npm install -g @modelcontextprotocol/inspector

# Test the server
mcp-inspector mcp-finnhub

Architecture

  • FastMCP Server: Built on MCP SDK's FastMCP for multi-transport support

  • ServerContext: Dependency injection container managing client and utilities

  • Multi-Transport: STDIO (default), HTTP streaming, and SSE transports

  • Async Job Processing: Background workers for large dataset operations

  • Type Safety: Pydantic models for all API requests/responses

See ARCHITECTURE.md for detailed design documentation.

API Reference

See API.md for complete tool documentation with examples.

Troubleshooting

"Authentication failed" error

  • Verify your FINNHUB_API_KEY is correct

  • Check if your API key has expired

  • Ensure you haven't exceeded rate limits

"Tool not found" error

  • Check that the tool is enabled in your configuration

  • Verify tool names match exactly (case-sensitive)

Storage permission errors

  • Ensure FINNHUB_STORAGE_DIR exists and is writable

  • Check filesystem permissions

Rate limit errors

  • Reduce FINNHUB_RATE_LIMIT_RPM in your configuration

  • Upgrade to premium tier for higher limits

Contributing

Contributions welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Add tests for new functionality

  4. Ensure all tests pass

  5. Submit a pull request

License

MIT License - see LICENSE for details

Acknowledgments

Support


Made with ❤️ for the AI assistant ecosystem

Available Tools

15 tools
finnhub_alternative_dataC

ESG scores, social sentiment, supply chain, and patents.

Operations:

  • get_esg_scores: Get ESG (Environmental, Social, Governance) scores

  • get_social_sentiment: Get social media sentiment

  • get_supply_chain: Get supply chain relationships

  • get_patents: Get patent filings

Inputs: operation (required), symbol, project. Returns: result

finnhub_calendar_dataB

IPO calendar, earnings calendar, economic events, and FDA meetings.

Operations:

  • get_ipo_calendar: Get upcoming IPOs

  • get_earnings_calendar: Get earnings announcements

  • get_economic_calendar: Get economic events

  • get_fda_calendar: Get FDA advisory committee meetings

Inputs: operation (required), symbol, project, to_date, +1 more. Returns: result

finnhub_crypto_dataC

Cryptocurrency exchanges, symbols, profiles, and candles.

Operations:

  • get_crypto_exchanges: List crypto exchanges

  • get_crypto_symbols: List symbols for an exchange

  • get_crypto_profile: Get crypto profile (e.g., BTC)

  • get_crypto_candles: Get historical OHLCV candles

Inputs: operation (required), symbol, project, exchange, +3 more. Returns: result

finnhub_forex_dataB

Foreign exchange rates, symbols, and candles.

Operations:

  • get_forex_exchanges: List forex exchanges

  • get_forex_symbols: List symbols for an exchange

  • get_forex_rates: Get exchange rates for base currency

  • get_forex_candles: Get historical OHLCV candles

Inputs: operation (required), base, symbol, project, +4 more. Returns: result

finnhub_job_statusC

Check status of background jobs.

Operations:

  • get_status: Get status of a specific job

  • list_jobs: List all jobs

Inputs: operation (required), job_id. Returns: result

finnhub_market_eventsC

Market holidays, analyst upgrades/downgrades, and M&A activity.

Operations:

  • get_market_holidays: Get market holiday schedule

  • get_upgrade_downgrade: Get analyst rating changes

  • get_merger_acquisition: Get M&A activity

Inputs: operation (required), symbol, project, exchange. Returns: result

finnhub_news_sentimentC

Company news, market news, and sentiment analysis.

Operations:

  • get_company_news: Get news for a specific company

  • get_market_news: Get general market news

  • get_news_sentiment: Get sentiment analysis for news

  • get_insider_sentiment: Get insider sentiment data

Inputs: operation (required), symbol, project, to_date, +2 more. Returns: result

finnhub_project_createB

Create project workspaces for organizing data.

Operations:

  • create: Create a new project workspace

Inputs: operation (required), name, description. Returns: result

finnhub_project_listA

List all project workspaces with statistics.

Operations:

  • list: List all projects

Inputs: operation (required). Returns: result

finnhub_sec_filingsC

SEC filings, filing sentiment, and similarity analysis.

Operations:

  • get_sec_filings: Get SEC filing history

  • get_filing_sentiment: Get sentiment analysis of a filing

  • get_similarity_index: Get filing similarity index

Inputs: operation (required), freq, symbol, project, +1 more. Returns: result

finnhub_stock_estimatesA

Analyst estimates for earnings, revenue, EBITDA, and price targets.

Operations:

  • get_earnings_estimates: Get analyst earnings estimates

  • get_revenue_estimates: Get analyst revenue estimates

  • get_ebitda_estimates: Get analyst EBITDA estimates

  • get_price_targets: Get analyst price targets (Premium)

  • get_recommendations: Get analyst recommendations

Inputs: operation (required), freq, symbol, project. Returns: result

finnhub_stock_fundamentalsA

Financial statements, earnings, dividends, and splits.

Operations:

  • get_basic_financials: Get key financial metrics

  • get_reported_financials: Get reported financial statements

  • get_sec_financials: Get SEC-reported financials

  • get_dividends: Get dividend history

  • get_splits: Get stock split history

  • get_revenue_breakdown: Get revenue by segment/geography

For get_basic_financials:

  • include_series: Include historical time series (default: False, saves ~100K+ tokens)

  • series_limit: Max periods per metric when include_series=True (e.g., 4 = last 4 periods)

Inputs: operation (required), freq, symbol, project, +4 more. Returns: result

finnhub_stock_market_dataC

Real-time quotes, historical candles, and company profiles.

Operations:

  • get_quote: Get real-time quote for a symbol

  • get_company_profile: Get company profile and details

  • get_market_status: Get market open/close status

  • search_symbols: Search for symbols by name

  • get_candles: Get historical OHLCV candles

  • get_symbols: List symbols for an exchange

  • get_financials: Get financial statements

  • get_earnings: Get earnings data

Inputs: operation (required), freq, query, symbol, +6 more. Returns: result

finnhub_stock_ownershipB

Insider trades, institutional ownership, and congressional trading.

Operations:

  • get_insider_transactions: Get insider trading activity

  • get_institutional_ownership: Get institutional holders

  • get_institutional_portfolio: Get institution's portfolio by CIK

  • get_congressional_trades: Get congressional trading activity

Inputs: operation (required), cik, symbol, project. Returns: result

finnhub_technical_analysisC

Technical indicators, patterns, and signals.

Operations:

  • scan_patterns: Scan for technical chart patterns

  • support_resistance: Get support and resistance levels

  • aggregate_signals: Get aggregated technical signals

  • get_indicator: Calculate specific technical indicator

Inputs: operation (required), symbol, project, indicator, +4 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 15 tools

    Disambiguation3/5

    The tool categories are mostly distinct, but overlap exists between finnhub_stock_market_data's get_financials/get_earnings and finnhub_stock_fundamentals or finnhub_stock_estimates, as well as between market_events analyst upgrades and estimates recommendations. This creates ambiguity for an agent selecting the appropriate tool.

    Naming Consistency5/5

    All 15 tools follow the consistent pattern 'finnhub_<domain>' using snake_case, such as finnhub_stock_estimates, finnhub_crypto_data, and finnhub_job_status. The naming is uniform and predictable.

    Tool Count4/5

    15 tools is at the upper bound of the ideal range but suits the broad scope of financial data covered (stocks, crypto, forex, news, fundamentals, estimates, etc.). Some tools like finnhub_project_create and finnhub_project_list are ancillary, but the count is reasonable.

    Completeness4/5

    The tool set provides comprehensive coverage of financial data: real-time quotes, candles, fundamentals, estimates, news, technical analysis, insider trading, crypto, forex, and calendars. Minor gaps include missing project delete/update operations and some redundant data retrieval paths (e.g., get_financials vs get_basic_financials).

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      Not graded
      maintenance
      An MCP server that enables Claude Desktop to access and analyze financial data through Yahoo Finance integration.
      1
      -
    • A
      license
      B
      quality
      C
      maintenance
      MCP server exposing Massive.com's REST Stocks API for querying stock market data via Claude Desktop/Code.
      31
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Node.js MCP server that wraps the Finnhub API to provide stock market data, technical analysis, news sentiment, and cryptocurrency market information.
      15
      117 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for stock prices, historical data, FX rates, and ticker search, powered by yfinance with no API key required. Designed for Claude Desktop.
      1
      Apache 2.0