Access Yahoo Finance Stock Data
An async MCP server exposing Yahoo Finance stock data, news, price history, options chains, and earnings to AI assistants.
1.0.0Add to Favorites
Why it matters
Integrate your AI with Yahoo Finance to access comprehensive stock market data, including financial metrics, news, price history, and earnings reports.
Outcomes
What it gets done
Retrieve detailed stock information and financial metrics.
Fetch recent news articles and search for financial instruments.
Access historical price data and option chain information.
Get earnings reports and top companies by sector.
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Retrieve comprehensive stock information including company details, financial metrics, and trading metrics
Fetch recent news articles for a given stock symbol
Search for stocks, ETFs, and other financial instruments with associated news results
Retrieve top companies in a sector including companies, ETFs, and mutual funds
Retrieve historical price data with customizable periods and intervals
Retrieve option chain data for stocks including call and put options
Retrieve earnings data including historical and upcoming earnings reports
Overview
Yahoo Finance MCP Server
An async MCP server exposing Yahoo Finance data through seven tools: ticker info, news, search, sector leaders, price history, options chains, and earnings, over stdio or HTTP transport. Use it when an AI assistant needs real stock market data grounded in Yahoo Finance; a proxy is recommended for reliability under heavier use.
What it does
This MCP server lets an AI assistant interact with Yahoo Finance data through seven tools. get-ticker-info returns comprehensive stock information (company details, financials, trading metrics) for a symbol like AAPL. get-ticker-news fetches recent news articles for a symbol, with a configurable article count. search finds stocks, ETFs, and other financial instruments along with related news. get-top-entities returns top-performing companies, ETFs, or mutual funds for a given entity type (etfs, mutual_funds, companies, growth_companies, performing_companies) within a sector (basic-materials, communication-services, consumer-cyclical, consumer-defensive, energy, financial-services, healthcare, industrials, real-estate, technology, or utilities). get-price-history returns historical price data with a customizable period (1d through max, including ytd) and interval (from 1m up to 3mo). ticker-option-chain returns options chain data for calls, puts, or both, optionally filtered to a specific expiration date. ticker-earning returns annual or quarterly earnings data, including upcoming earnings dates.
Operations run asynchronously (non-blocking, via asyncio), and the server supports HTTP/HTTPS/SOCKS proxies to improve reliability and avoid rate limiting from Yahoo Finance.
When to use - and when NOT to
Use it when an AI assistant needs to answer questions grounded in real stock market data - quotes and company financials, recent news, sector leaders, historical prices, options chains, or earnings dates - through the standard MCP protocol. It depends on Yahoo Finance's own data and rate limits, so for reliability under heavier use a proxy is recommended.
Capabilities
The server runs over stdio transport by default (best for local AI-assistant integration), or over StreamableHttp transport for web-based or remote connections (--transport http --host <host> --port <port>), which replaces the deprecated SSE transport. It can be tested directly with the MCP Inspector, either against the stdio server or against a running HTTP instance, and the underlying tools can also be exercised directly from Python, for example calling get_ticker_info('AAPL') from yahoo_finance_server.helper in an async script to confirm the data comes back correctly before wiring it into a client.
How to install
# Install with namespace
uvx yahoo-finance-server
or via pip:
pip install yahoo-finance-server
It requires Python 3.11+, and pins yfinance==0.2.62, requests>=2.31.0, pandas>=2.0.0, and mcp>=1.9.3. For better reliability, configure a proxy with PROXY_URL (an HTTP/HTTPS or authenticated SOCKS5 URL) before running yahoo-finance-server.
Who it's for
Developers building AI assistants or agents that need grounded, real-time-ish stock market data - quotes, news, price history, options, and earnings - without hand-rolling a Yahoo Finance client, and who want the flexibility to run the server locally over stdio during development or expose it over HTTP for a remote or web-based integration. Licensed MIT.
Source README
Yahoo Finance MCP Server
๐ 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-serveroryahoo-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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
๐ License
MIT License - see LICENSE file for details.
๐ Links
- Homepage: GitHub Repository
- Issues: Report Issues
- MCP Documentation: Model Context Protocol
Made with โค๏ธ for the finance community
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.