Finnhub Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.2.0更新於 Oct 30, 2026

Real-time US-equity quotes, company fundamentals, earnings, analyst trends, and news via Finnhub.

已驗證STDIO僅桌面金融資料與分析

概覽

AI 產生的概覽

Finnhub 行情資料伺服器:讓助理查詢美股代號、即時報價、公司基本面、財報、分析師評等與財經新聞。

可以做什麼
  • 把公司名稱或部分代號解析成美股代號,優先回傳可能屬於美股的結果
  • 取得即時報價並附上市場狀態,休市時明確標示為前收盤價
  • 一次呼叫取得公司簡介、主要基本面指標與同產業公司
  • 查詢歷史財報的實際與預期每股盈餘及意外幅度,或未來財報行事曆
  • 取得某檔股票在指定日期區間的新闻,或依類別取得大盤新聞
  • 讀取每月分析師強力買進/買進/持有/賣出/強力賣出的數量,並提供新聞類別參考資源
適用情境
適合在回答市場問題時需要美股即時價格、基本面、財報或分析師看法的情境,也適合產出必須說明價格是即時或前收盤的公司與財報簡報。
執行需求
透過 npx(需 Node.js)或 Docker 在本機執行,也可使用 Streamable HTTP。需要免費的 Finnhub API 金鑰,放在 FINNHUB_API_KEY,缺少時伺服器無法啟動。選用變數涵蓋傳輸方式、HTTP 主機/連接埠/路徑、驗證模式、日誌等級、儲存與 OpenTelemetry。需要能連線到 Finnhub API 的網路。
安裝前請注意
Finnhub API 金鑰會以 token 查詢參數送出,請勿放入共用設定或日誌。免費方案僅限個人使用,將 Finnhub 資料轉發或分享給第三方需取得書面同意。涵蓋範圍限於美股與免費方案,國際或付費代號會回傳 not_us_or_paid。啟用 LOG_TOOL_FAILURE_PAYLOADS 會記錄失敗呼叫的參數與結果,且自由文字中的機密不會被遮蔽。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Finnhub Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@cyanheads/finnhub-mcp-server

Real-time US-equity quotes, company fundamentals, earnings, analyst trends, and financial news via Finnhub. STDIO or Streamable HTTP.

6 Tools • 2 Resources


Overview

Real-time US stock data from Finnhub: quotes, company fundamentals, earnings, analyst recommendations, and financial news. Look up a company by name, then pull live pricing, valuation, or news for it.

Ticker inputs are trimmed and uppercased; punctuation such as BRK.B is preserved. Earnings calendar filters may be omitted or blank for market-wide results; earnings history and company news require a nonblank symbol. Search queries retain their original spelling, and market news ignores symbol.

Tools

ToolDescription
finnhub_search_symbolsResolve a company name or partial ticker to stock symbols, best likely-US match first. The entry point for every other tool.
finnhub_get_quoteReal-time price quote for one US symbol, paired with live market-status so the response states whether the price is live or the prior close, including the returned session and named holiday.
finnhub_get_companyFull company context in one call — profile, headline fundamentals (P/E, EPS, margins, growth), and sector peers.
finnhub_get_earningsEarnings in two modes: a symbol's past quarters with actual-vs-estimate surprises (history), or upcoming releases in a date window with an optional symbol filter (calendar).
finnhub_get_newsFinancial news in two modes: recent articles for one symbol over a date range (company), or broad market headlines by category (market).
finnhub_get_recommendationsAnalyst recommendation trends for one US symbol — strong-buy / buy / hold / sell / strong-sell counts per month, newest first.

Resources

ResourceDescription
finnhub://news-categoriesThe four valid market-news categories (general, forex, crypto, merger) with one-line descriptions.
skill://finnhub-guide/SKILL.mdAgent guide for company and earnings briefings, security identity, quote freshness, and coverage gaps.

The news-category reference mirrors the category enum on finnhub_get_news. The finnhub guide also ships with plugin installs, npm, Docker, and the desktop bundle.

Capability reference

finnhub_search_symbols tool

  • Search by company name or ticker fragment with query (1–20 characters) and limit (1–50, default 10).
  • Returns likely-US Common Stock matches first, with an isLikelyUS symbol-format heuristic, total match count, and truncation disclosure. Quote and profile responses remain authoritative.

finnhub_get_quote tool

  • Requires symbol; returns current price, change, session open/high/low, previous close, and an ISO 8601 quote time.
  • priceIsLive distinguishes a live price from the prior close; marketOpen, session, and holiday are nullable when market status is unavailable. Unknown ticker → symbol_not_found; international or paid-only symbol → not_us_or_paid.

finnhub_get_company tool

  • Requires symbol; returns company profile, nullable headline fundamentals (P/E, EPS, 52-week range, beta, dividend yield, margins, growth, ROE), and sector peers.
  • Failed metrics or peers appear in partial; the profile determines symbol_not_found and not_us_or_paid errors.

finnhub_get_earnings tool

  • history requires symbol and returns past quarters' actual/estimate EPS and surprise, newest first. calendar accepts from / to (default today through +14 days) and an optional symbol, returning release dates, EPS/revenue estimates, and report times.
  • limit (1–100, default 50) caps rows with total and truncation disclosure. History without a symbol → missing_symbol; international or paid-only symbol → not_us_or_paid.

finnhub_get_news tool

  • company requires symbol and accepts a date range (default last 7 days). market uses category: general, forex, crypto, or merger (see finnhub://news-categories).
  • Returns headline, source, ISO 8601 datetime, summary, and URL, newest first. limit (1–100, default 15) caps articles with total and truncation disclosure; company mode without a symbol → missing_symbol, international or paid-only symbol → not_us_or_paid.

finnhub_get_recommendations tool

  • Per-month strong-buy / buy / hold / sell / strong-sell counts, newest first; history depth depends on Finnhub coverage.
  • limit (1–24, default 12) caps available rows; raising it cannot retrieve history absent from Finnhub. Reports total months and discloses truncation.
  • Empty result → no_coverage; it cannot distinguish an invalid symbol from a valid symbol without coverage. International or paid-only symbol → not_us_or_paid.

finnhub://news-categories resource

  • Returns the four valid finnhub_get_news market-mode categories (general, forex, crypto, merger) with one-line descriptions, as application/json
  • Convenience mirror — fully covered by the category enum's .describe() on finnhub_get_news, so tool-only clients lose nothing
  • Live data (quotes, news, earnings) is intentionally not exposed as a resource — it's time-sensitive, so freshness lives only in the tools

Features

The finnhub-guide skill helps agents combine tool results into company and earnings briefings while preserving dates, missing values, and endpoint coverage limits. MCP clients can discover it through skills/list or read its skill://finnhub-guide/SKILL.md resource.

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

Finnhub-specific:

  • Single rate-aware Finnhub client — token injected server-side (never a tool input), with timeout and retry calibrated to the 60 req/min free tier
  • Live market-status pairing on quotes so a closed-market price is reported as the prior close, never as live
  • Status classification at the service boundary: 403 → a clear not_us_or_paid domain error, 401 → loud configuration failure at first call (not "no data"), 429/5xx → retried
  • finnhub_get_company fans out profile + metrics + peers in parallel and degrades to partial results when a leg fails

Agent-friendly output:

  • Honest sparsity — every fundamental is nullable and absent values stay null; Finnhub's thinly-covered names are surfaced as-is, never zero-filled or fabricated
  • Two distinct "not available" signals — symbol_not_found (all-zero quote / empty profile sentinel) vs. not_us_or_paid (international or paid-only, HTTP 403). An empty profile can also reflect missing instrument coverage.
  • ETFs, funds, or trusts may lack company profiles, earnings history, or analyst recommendations. Empty responses retain ticker verification guidance and suggest finnhub_get_quote for price data without promising quote availability.
  • Typed error contracts with recovery hints on every failure, plus the isLikelyUS search heuristic so an agent can prioritize likely free-tier symbols
  • Capped lists report their total count and disclose truncation, so an agent knows when more data exists

Getting started

This server requires a free Finnhub API key (Dashboard → API key). The free tier covers US equities in real time at 60 req/min.

Each user must obtain their own API key. Use is subject to Finnhub's Terms of Service — the free tier is for personal use only, and redistributing or sharing access to Finnhub data with third parties requires written approval from Finnhub.

Add it to Claude Code:

sh
claude mcp add finnhub-mcp-server -e FINNHUB_API_KEY=your-api-key -- npx -y @cyanheads/finnhub-mcp-server

For other clients, add this to your MCP configuration file:

json
{  "mcpServers": {    "finnhub-mcp-server": {      "command": "npx",      "args": ["-y", "@cyanheads/finnhub-mcp-server"],      "env": { "FINNHUB_API_KEY": "your-api-key" }    }  }}

For Docker or a source build, see Running the server.

Configuration

All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:

VariableDescriptionDefault
FINNHUB_API_KEYRequired. Free Finnhub API key from finnhub.io/register. Sent as the token query param; the server fails to start without it.—
FINNHUB_BASE_URLFinnhub REST API base URL. Override for local testing or a proxy.https://finnhub.io/api/v1
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for the HTTP server.3010
MCP_HTTP_ENDPOINT_PATHHTTP endpoint path where the MCP server is mounted./mcp
MCP_SESSION_MODESession handling: auto, stateful, or stateless. The server declares stateless in src/index.ts, so an unset variable resolves there; .env.example and the Docker image set it explicitly too. An explicit environment value takes precedence.stateless
MCP_AUTH_MODEAuth mode: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (RFC 5424: debug, info, notice, warning, error).info
LOG_TOOL_FAILURE_PAYLOADSLog failed tool calls' arguments and results, redacted by key name and capped at LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES (default 16384). Secrets inside free-form values are not redacted.false
STORAGE_PROVIDER_TYPEStorage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1.in-memory
OTEL_ENABLEDEnable OpenTelemetry instrumentation (spans, metrics, completion logs).false
OTEL_EXPORTER_OTLP_ENDPOINTOTLP base URL for traces (/v1/traces) and metrics (/v1/metrics); signal-specific endpoints override it.—
OTEL_EXPORTER_OTLP_LOGS_ENDPOINTOpt-in OTLP log endpoint, used as-is. The base URL does not enable log export.—

See .env.example for the full list of optional overrides.

Running the server

Local development

Requires Bun v1.4.0 or higher (or Node.js v24+), and a free Finnhub API key.

sh
git clone https://github.com/cyanheads/finnhub-mcp-server.gitcd finnhub-mcp-serverbun installcp .env.example .env# Set FINNHUB_API_KEY in .env.
  • Build and run:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:stdio# orbun run start:http
  • Run checks and tests:

    sh
    bun run devcheck   # Lint, format, typecheck, securitybun run test       # Vitest test suitebun run lint:mcp   # Validate MCP definitions against spec

Docker

sh
docker run --rm -e FINNHUB_API_KEY=your-key -p 3010:3010 ghcr.io/cyanheads/finnhub-mcp-server:latest

The image defaults to HTTP transport, stateless session mode, and logs to /var/log/finnhub-mcp-server. For stdio, add -i -e MCP_TRANSPORT_TYPE=stdio to docker run. To build locally, run docker build -t finnhub-mcp-server .; OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools/resources and inits the Finnhub service.
src/configServer-specific environment variable parsing and validation with Zod.
src/mcp-server/toolsTool definitions (*.tool.ts). Six tools across symbols, quotes, company, earnings, news, and recommendations.
src/mcp-server/resourcesResource definitions (*.resource.ts). News-categories reference.
src/services/finnhubFinnhub REST client — auth, typed endpoint methods, retry, and HTTP-status classification.
skills/Published agent guide, also served as an MCP resource.
tests/Unit and integration tests mirroring src/.

Development guide

See CLAUDE.md / AGENTS.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging, ctx.state for tenant-scoped storage
  • Register new tools and resources via the barrels in src/mcp-server/*/definitions/index.ts
  • Wrap the Finnhub API: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

Apache-2.0 — see LICENSE for details.

來源:README.md,提交 82febe2

工具

6

finnhub_search_symbols

Finnhub Search Symbols

Resolve a company name or partial ticker to Finnhub stock symbols. The entry point for every other tool — users say "Microsoft", the rest of the surface needs "MSFT". Returns matched symbols with display symbol, description, and security type, best likely-US match first. Each result carries isLikelyUS, a symbol-format heuristic for likely free-tier availability; quote and profile responses remain authoritative.

輸入參數limitquery必填

finnhub_get_quote

Finnhub Get Quote

Real-time price quote for one US stock symbol: current, change, %change, open, high, low, previous close. Pairs the quote with live market-status so the response states whether the price is live or the prior close — never implies a stale price is live. Resolve a name to a symbol with finnhub_search_symbols first. International symbols (with an exchange suffix like ".TO") are not on the free tier and return a clear error.

輸入參數symbol必填

finnhub_get_company

Finnhub Get Company

Full company context for one US symbol in a single call: profile (name, exchange, industry, country, market cap, shares outstanding, IPO date, website, logo), headline fundamentals (P/E, EPS, 52-week range, beta, dividend yield, margins, growth), and sector peers. Combines three endpoints so "tell me about Apple" needs one tool call, not three. Resolve a company name with finnhub_search_symbols first. International symbols are not on the free tier.

輸入參數symbol必填

finnhub_get_earnings

Finnhub Get Earnings

Earnings data in two modes. 'history': a symbol's past quarters — actual vs. estimate EPS, surprise %, period (the surprise is the market-moving signal, surfaced prominently); requires `symbol`. 'calendar': upcoming releases in a date window — date, EPS/revenue estimates, symbol; uses `from`/`to` and optionally filters by `symbol`. Resolve a company name with finnhub_search_symbols first.

輸入參數tofrommode必填limitsymbol

finnhub_get_news

Finnhub Get News

Financial news in two modes. 'company': recent articles for one symbol over a date range — headline, source, datetime, summary, URL ("what's driving AAPL today?"); requires `symbol`. 'market': broad market headlines by category (general, forex, crypto, merger); uses `category`. Resolve a company name with finnhub_search_symbols first for company mode.

輸入參數tofrommode必填limitsymbolcategory

finnhub_get_recommendations

Finnhub Get Recommendations

Analyst recommendation trends for one US symbol: strong-buy / buy / hold / sell / strong-sell counts per month, newest first. The consensus view to pair with the live quote and fundamentals from finnhub_get_company. Resolve a company name with finnhub_search_symbols first.

輸入參數limitsymbol必填

版本歷史

4
  1. v0.2.0最新Oct 30, 2026
  2. v0.1.6Oct 7, 2026
  3. v0.1.5Sep 21, 2026
  4. v0.1.4Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分