YA

Yahoo Finance MCP Server: Stocks, News, Financials

Query Yahoo Finance via MCP server for real-time stocks, news, financials, and proxy support.

Overview

The Yahoo Finance MCP Server is a lightweight HTTP service that exposes Yahoo Finance data (real-time stock quotes, company news, and financial statements) through the Model Context Protocol (MCP). It acts as a bridge between LLM agents or other MCP-aware systems and Yahoo Finance, returning structured, contextual data that can be injected into prompts or used by tool-enabled agents.

This server is useful when you need programmatic access to financial context without embedding web scraping logic in your application or agent. It supports proxies, configurable timeouts, and returns data in a format tailored for consumption by LLMs or any client implementing MCP.

Features

  • Real-time stock quotes (prices, change, volume)
  • Company news and headlines
  • Financials (income statement, balance sheet, cash flow summaries)
  • Symbol search / lookup
  • MCP-compliant HTTP API for easy integration with LLM agents
  • Proxy support (HTTP/HTTPS) and configurable network options
  • Docker and local Node.js installation options
  • Minimal configuration; logs and telemetry-friendly

Installation / Configuration

Clone and run locally with Node.js:

git clone https://github.com/AgentX-ai/yahoo-finance-server.git
cd yahoo-finance-server
npm install
npm start

Environment variables (example .env):

# Port to listen on
PORT=8080

# Optional HTTP/HTTPS proxy: http://proxy.example:3128
HTTP_PROXY=http://proxy.example:3128
HTTPS_PROXY=http://proxy.example:3128

# Logging level (info, debug, warn)
LOG_LEVEL=info

# Request timeout (ms)
REQUEST_TIMEOUT=10000

Run with Docker:

docker build -t yahoo-finance-mcp .
docker run -p 8080:8080 \
  -e PORT=8080 \
  -e HTTP_PROXY=http://proxy.example:3128 \
  yahoo-finance-mcp

Notes:

  • Set HTTP_PROXY/HTTPS_PROXY to route requests through corporate proxies or capture traffic.
  • REQUEST_TIMEOUT helps prevent long-running external calls; adjust to suit your application SLAs.

Available Tools / Resources

The server exposes a set of MCP-capable tools (logical operations) returning structured JSON context. Typical tool names and their responsibilities:

Tool namePurpose
get_quoteFetch latest quote data for a symbol (price, change, volume, timestamp)
get_newsFetch recent news headlines and summaries for a company or symbol
get_financialsRetrieve financial statement summaries (income, balance, cash flow)
search_symbolsFind matching symbols / tickers for a query string
raw_fetchLow-level fetch for custom queries or debugging (if enabled)

Each tool returns standardized fields (symbol, fetched_at, source) to make downstream prompt injection and tool selection predictable.

Resources:

  • GitHub repository: https://github.com/AgentX-ai/yahoo-finance-server
  • Configure proxy using HTTP_PROXY / HTTPS_PROXY environment variables

Example: Calling the MCP Endpoint

The server implements the MCP HTTP endpoint (default path /mcp). Clients send a JSON request describing the desired tool and arguments. Example curl request to ask for a quote:

curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "get_quote",
    "args": {
      "symbol": "AAPL"
    }
  }'

Typical response (truncated):

{
  "tool": "get_quote",
  "symbol": "AAPL",
  "fetched_at": "2026-04-10T12:34:56Z",
  "price": 173.21,
  "change": -1.32,
  "percent_change": -0.76,
  "volume": 34200000,
  "source": "yahoo-finance"
}

For news:

curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "get_news",
    "args": {
      "symbol": "TSLA",
      "limit": 5
    }
  }'

Use Cases

  • LLM agent augmentation: Provide current stock prices and recent news as contextual tools to enable finance-aware responses (e.g., advise on market conditions).
  • Trading dashboards: Enrich UI widgets with MCP-provided structured data for price updates and headline feeds without building scraping logic.
  • Research and reporting: Periodically fetch financial summaries for automated reports or watchlists.
  • Data enrichment for compliance: Attach fetched financial context to transaction logs or compliance workflows.
  • Prototyping and testing: Quickly bootstrap tools that require market context while developing ML/agent workflows.

Example: An agent asks for “latest AAPL price and top headline.” The agent calls get_quote then get_news, the server returns concise, structured context the agent can use to craft an answer.

Tips & Best Practices

  • Cache responses where appropriate to reduce external requests and stay within informal rate limits.
  • Use the proxy settings to route requests through a controlled network path in production.
  • Sanitize and validate symbol inputs (search_symbols) before invoking data-heavy calls.
  • Monitor logs (LOG_LEVEL) and REQUEST_TIMEOUT to detect upstream changes or Yahoo Finance layout/response issues.

For implementation details, API specifics, and advanced configuration, see the project repository on GitHub: https://github.com/AgentX-ai/yahoo-finance-server