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.
- 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
GET /health- Health check endpointPOST /mcp- Main MCP protocol endpoint for all tool interactions- Available tools accessible via MCP protocol:
get_market_news- Get latest market news by categoryget_stock_quote- Get real-time stock quotesget_company_profile- Get detailed company informationget_basic_financials- Get key financial metrics and ratiosget_recommendation_trends- Get analyst recommendation trends
FINNHUB_API_KEY- Your Finnhub API key (get one free at finnhub.io)
PORT- Server port (default: 8000)HOST- Server host (default: 0.0.0.0)
- Python 3.13+
- FastMCP 2.11.2+
- uv (for dependency management)
- Finnhub API key
# 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.pyThe server will start on http://localhost:8000 using the streamable-http transport. All tool interactions must go through the MCP protocol endpoint at /mcp.
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 releaseManual 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-finnhubAll tool interactions must use the MCP protocol. Here are examples of proper MCP requests:
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"
}
}
}'curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}'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"
}
}
}'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"
}
}
}'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.
This server uses the Finnhub API to provide financial data. You'll need a free API key to use this service.
- 60 API calls/minute
- Basic stock data, news, and company information
- Real-time US stock prices
- Higher rate limits
- More historical data
- Advanced financial metrics
- Global market coverage
Part of the NimbleTools ecosystem. From the makers of NimbleBrain.
MIT License - see LICENSE for details.