Yahoo Finance MCP Server

Yahoo Finance MCP Server

Enables AI assistants to access Yahoo Finance data including stock information, news, price history, options, and earnings via MCP tools.

Category
Visit Server

README

Yahoo Finance MCP Server

Website Discord

๐Ÿ“ˆ A Model Context Protocol (MCP) server that lets your AI interact with Yahoo Finance - get comprehensive stock market data, news, financials, and more.

โœจ Features

  • ๐Ÿ“Š Stock Data - Get comprehensive ticker information including company details, financials, and trading metrics
  • ๐Ÿ“ฐ News Feed - Fetch recent news articles related to specific stock symbols
  • ๐Ÿ” Search - Find stocks, ETFs, and other financial instruments with news results
  • ๐Ÿ† Top Entities - Get top performing companies, ETFs, and mutual funds by sector
  • ๐Ÿ“ˆ Price History - Fetch historical price data with customizable periods and intervals
  • โšก Options Chain - Get option chain data for stocks including calls and puts
  • ๐Ÿ’ฐ Earnings - Access earnings data including upcoming earnings dates
  • ๐ŸŒ Proxy Support - Works with HTTP/HTTPS/SOCKS proxies
  • ๐Ÿš€ Fast & Async - Non-blocking operations using asyncio
  • ๐Ÿ”ง Easy Integration - Standard MCP protocol for AI assistants

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11 or higher
  • pip or uvx package manager
  • (Optional) Proxy server for better reliability

Installation

Using uvx (Recommended)

# Install with namespace
uvx yahoo-finance-server

Using pip

pip install yahoo-finance-server

From source

git clone https://github.com/AgentX-ai/AgentX-mcp-servers.git
cd AgentX-mcp-servers/yahoo_finance_server
pip install -e .

Configuration

Proxy Setup (Recommended)

For better reliability and to avoid rate limiting, set up a proxy:

# HTTP/HTTPS proxy
export PROXY_URL="http://proxy.example.com:8080"

# SOCKS proxy with auth
export PROXY_URL="socks5://user:pass@127.0.0.1:1080/"

Running the Server

# Basic run (stdio transport)
yahoo-finance-server

# Run with proxy
PROXY_URL="http://127.0.0.1:7890" yahoo-finance-server

# Run with HTTP transport
yahoo-finance-server --transport http --host localhost --port 3000

# Run with HTTP transport and proxy
PROXY_URL="http://127.0.0.1:7890" yahoo-finance-server --transport http --host 0.0.0.0 --port 8080
Transport Options

Stdio Transport (Default)

  • Best for development and AI assistant integration
  • Communication via stdin/stdout pipes
  • Usage: yahoo-finance-server or yahoo-finance-server --transport stdio

HTTP Transport

  • StreamableHttp transport (replaces deprecated SSE)
  • Allows web-based connections and remote access
  • Usage: yahoo-finance-server --transport http --host localhost --port 3000
  • Inspector URL: http://localhost:3000

๐Ÿ› ๏ธ API Reference

Available Tools

1. get-ticker-info

Get comprehensive stock information including company details, financials, and trading metrics.

{
  "name": "get-ticker-info",
  "arguments": {
    "symbol": "AAPL"
  }
}

2. get-ticker-news

Get recent news articles for a stock symbol.

{
  "name": "get-ticker-news",
  "arguments": {
    "symbol": "AAPL",
    "count": 10
  }
}

3. search

Search for stocks, ETFs, and other financial instruments with related news.

{
  "name": "search",
  "arguments": {
    "query": "Apple Inc",
    "count": 10
  }
}

4. get-top-entities

Get top performing entities in a sector.

{
  "name": "get-top-entities",
  "arguments": {
    "entity_type": "companies", // Options: "etfs", "mutual_funds", "companies", "growth_companies", "performing_companies"
    "sector": "technology", // See supported sectors below
    "count": 10
  }
}

Supported sectors:

  • basic-materials
  • communication-services
  • consumer-cyclical
  • consumer-defensive
  • energy
  • financial-services
  • healthcare
  • industrials
  • real-estate
  • technology
  • utilities

5. get-price-history

Get historical price data with customizable periods and intervals.

{
  "name": "get-price-history",
  "arguments": {
    "symbol": "AAPL",
    "period": "1y", // Options: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max
    "interval": "1d" // Options: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo
  }
}

6. ticker-option-chain

Get option chain data for stocks.

{
  "name": "ticker-option-chain",
  "arguments": {
    "symbol": "AAPL",
    "option_type": "call", // Options: "call", "put", "both"
    "date": "2024-01-19" // Optional: YYYY-MM-DD format
  }
}

7. ticker-earning

Get earnings data including historical and upcoming earnings.

{
  "name": "ticker-earning",
  "arguments": {
    "symbol": "AAPL",
    "period": "annual", // Options: "annual", "quarterly"
    "date": "2023-12-31" // Optional: YYYY-MM-DD format
  }
}

๐Ÿงช Testing

Using MCP Inspector

With Stdio Transport (Default)

npx @modelcontextprotocol/inspector yahoo-finance-server

With HTTP Transport

# Terminal 1: Start server with HTTP transport
yahoo-finance-server --transport http --host localhost --port 3000

# Terminal 2: Connect inspector to HTTP server
npx @modelcontextprotocol/inspector http://localhost:3000

Manual Testing

python -c "
import asyncio
from yahoo_finance_server.helper import get_ticker_info

async def test():
    info = await get_ticker_info('AAPL')
    print(f'โœ… Stock: {info[\"longName\"]}')

asyncio.run(test())
"

๐Ÿ“‹ Requirements

  • Python 3.11+
  • yfinance==0.2.62
  • requests>=2.31.0
  • pandas>=2.0.0
  • mcp>=1.9.3

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ”— Links


Made with โค๏ธ for the finance community

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