finance-data-mcp

finance-data-mcp

Unified financial data access for US, A-share, HK stocks, and FX rates with automatic fallback across multiple data sources.

Category
Visit Server

README

finance-data-mcp

A Model Context Protocol (MCP) server that provides unified financial data access across multiple markets and data sources.

Features

  • πŸ‡ΊπŸ‡Έ US / ETF: Alpha Vantage (primary) β†’ yfinance (fallback)
  • πŸ‡¨πŸ‡³ A-share: Tushare (primary) β†’ AKShare (fallback) β†’ yfinance
  • πŸ‡­πŸ‡° HK stocks: AKShare (primary) β†’ yfinance (fallback)
  • πŸ’± FX rates: exchangerate-api β†’ AKShare β†’ Alpha Vantage β†’ yfinance
  • πŸ”„ Automatic fallback across data sources on failure
  • πŸ”‘ Multi-key rotation for Alpha Vantage (extends daily quota)
  • 🌐 Proxy support for AKShare (useful when running overseas)

MCP Tools

Tool Description
get_stock_price Real-time stock price with market routing
get_financial_report Income statement, balance sheet, cash flow
get_financial_summary PE, PB, ROE, market cap, EPS, etc.
get_fx_rate Currency exchange rates

Quick Start

1. Install dependencies

pip install -r requirements.txt

Note: Not all data sources are required. Install only what you need:

  • akshare β€” for A-share and HK stocks
  • tushare β€” for A-share (needs token, no IP restriction)
  • yfinance β€” for all markets (fallback, no key needed)
  • requests β€” required for Alpha Vantage

2. Configure environment

cp .env.example .env
# Edit .env with your API keys

3. Run the server

python finance_data_server.py

The server runs in stdio mode (standard MCP transport).

4. Configure in your MCP client

Example configuration for MCP clients:

{
  "mcpServers": {
    "finance-data": {
      "command": "python",
      "args": ["/path/to/finance-data-mcp/finance_data_server.py"],
      "env": {}
    }
  }
}

Environment Variables

Variable Required Description
ALPHAVANTAGE_API_KEYS For US stocks Comma-separated Alpha Vantage API keys
TUSHARE_TOKEN For A-share Tushare Pro API token
AKSHARE_PROXY Optional HTTP proxy for AKShare (format: http://user:pass@host:port)

Architecture

finance_data_server.py          # MCP Server entry point + MarketRouter
β”œβ”€β”€ datasources/
β”‚   β”œβ”€β”€ alpha_vantage_adapter.py  # US/ETF stocks (Alpha Vantage API)
β”‚   β”œβ”€β”€ akshare_adapter.py        # A-share / HK stocks (AKShare + East Money)
β”‚   β”œβ”€β”€ tushare_adapter.py        # A-share stocks (Tushare Pro API)
β”‚   └── yfinance_adapter.py       # All markets fallback (Yahoo Finance)
β”œβ”€β”€ alpha_vantage_client.py       # Alpha Vantage HTTP client
└── alpha_vantage_rate_limiter.py # Per-key rate limiting with persistence

Data Flow

MCP Client Request
       β”‚
       β–Ό
  MarketRouter (routes by market type)
       β”‚
       β”œβ”€ US/ETF ──→ AlphaVantage β†’ yfinance
       β”œβ”€ A-share ──→ Tushare β†’ AKShare β†’ yfinance
       └─ HK ──────→ AKShare β†’ yfinance

Standardized Output

All adapters return data in a unified format:

Price Response

{
  "symbol": "AAPL",
  "market": "US",
  "price": 185.50,
  "change": 2.30,
  "change_pct": 1.25,
  "volume": 52340000,
  "high": 186.20,
  "low": 183.10,
  "open": 183.80,
  "previous_close": 183.20,
  "currency": "USD",
  "source": "alpha_vantage"
}

Financial Report Response

{
  "symbol": "AAPL",
  "market": "US",
  "report_type": "income_statement",
  "period": "annual",
  "data": [
    {
      "period": "2024-09-30",
      "revenue": 391035000000,
      "net_income": 93736000000,
      "eps_basic": 6.11
    }
  ],
  "count": 5,
  "source": "alpha_vantage"
}

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured