MCP Finnhub Server

MCP Finnhub Server

Provides comprehensive financial market data and news through the Finnhub API. Enables real-time stock quotes, company profiles, financial metrics, analyst recommendations, and market news access.

Category
访问服务器

README

MCP Finnhub Server

A comprehensive financial market data and news service powered by the Finnhub API. This MCP server provides real-time stock quotes, company profiles, financial metrics, analyst recommendations, and market news.

Features

  • get_market_news: Get latest market news by category (general, forex, crypto, merger)
  • get_stock_quote: Get real-time stock quotes with pricing and trading data
  • get_company_profile: Get detailed company information and profiles
  • get_basic_financials: Get key financial metrics and ratios
  • get_recommendation_trends: Get analyst recommendation trends and ratings

MCP Protocol Endpoints

  • GET /health - Health check endpoint
  • POST /mcp - Main MCP protocol endpoint for all tool interactions
  • Available tools accessible via MCP protocol:
    • get_market_news - Get latest market news by category
    • get_stock_quote - Get real-time stock quotes
    • get_company_profile - Get detailed company information
    • get_basic_financials - Get key financial metrics and ratios
    • get_recommendation_trends - Get analyst recommendation trends

Configuration

Required Environment Variables

  • FINNHUB_API_KEY - Your Finnhub API key (get one free at finnhub.io)

Optional Environment Variables

  • PORT - Server port (default: 8000)
  • HOST - Server host (default: 0.0.0.0)

Development

Requirements

  • Python 3.13+
  • FastMCP 2.11.2+
  • uv (for dependency management)
  • Finnhub API key

Setup

# Install dependencies
uv sync

# Set your API key
export FINNHUB_API_KEY="your_api_key_here"

# Run tests with proper async support
uv run pytest

# Run server locally (streamable-http transport)
uv run python server.py

The server will start on http://localhost:8000 using the streamable-http transport. All tool interactions must go through the MCP protocol endpoint at /mcp.

Docker Build & Push

Use the provided Makefile for common tasks:

# Run tests
make test

# Build Docker image
make build

# Push to registry (requires Docker Hub login)
make push

# Test, build, and push
make all

# Interactive version release
make release

Manual Docker commands:

# Build image
docker build -t nimbletools/mcp-finnhub .

# Run container with API key
docker run -e FINNHUB_API_KEY="your_api_key" -p 8000:8000 nimbletools/mcp-finnhub

# Push to Docker Hub
docker push nimbletools/mcp-finnhub

Usage Examples

All tool interactions must use the MCP protocol. Here are examples of proper MCP requests:

Initialize MCP Session

First, establish an MCP session to initialize the connection:

curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "capabilities": {},
      "clientInfo": {
        "name": "test-client",
        "version": "1.0.0"
      }
    }
  }'

List Available Tools

curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/list"
  }'

Get Market News

curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "get_market_news",
      "arguments": {
        "category": "general"
      }
    }
  }'

Get Stock Quote

curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "tools/call",
    "params": {
      "name": "get_stock_quote",
      "arguments": {
        "symbol": "AAPL"
      }
    }
  }'

Get Company Profile

curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 5,
    "method": "tools/call",
    "params": {
      "name": "get_company_profile",
      "arguments": {
        "symbol": "MSFT"
      }
    }
  }'

Note: Session management is required. You must initialize the MCP session before making tool calls. Each request should use unique id values to track responses properly.

Finnhub API

This server uses the Finnhub API to provide financial data. You'll need a free API key to use this service.

Free Tier Limits

  • 60 API calls/minute
  • Basic stock data, news, and company information
  • Real-time US stock prices

Premium Features

  • Higher rate limits
  • More historical data
  • Advanced financial metrics
  • Global market coverage

About

Part of the NimbleTools ecosystem. From the makers of NimbleBrain.

License

MIT License - see LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选