Yahoo Finance MCP Server
by HarveyPrs
README.md
# Yahoo Finance MCP Server
Live company data and news inside Claude, by ticker. Python + official MCP SDK (FastMCP, stdio) + yfinance.
> **Building a new MCP server for a different site?** Start from
> [MCP_PLAYBOOK.md](MCP_PLAYBOOK.md) — a self-contained recipe (with the common
> failure modes) that uses this repo as the reference implementation.
## Tools
| Tool | What it returns |
|---|---|
| `get_quote(tickers)` | Price, day change, day/52w range, volume, market cap — accepts multiple tickers |
| `get_history(ticker, period, interval, start, end)` | OHLCV bars over a period or date range |
| `get_financials(ticker, statement, period)` | Condensed income / balance / cashflow, annual or quarterly, + Yahoo link |
| `get_profile(ticker)` | Sector, industry, description, employees, key stats |
| `get_valuation(tickers)` | P/E, fwd P/E, EV/EBITDA, EV/Rev, P/B, margins, growth, leverage — multi-ticker for comps |
| `get_analyst_view(ticker)` | Price targets, consensus, ratings breakdown, EPS/revenue estimates |
| `get_news(ticker, limit)` | Headlines with source, timestamp, link |
Non-US listings need the exchange suffix: `D05.SI` (SGX), `0700.HK` (HKEX), `7203.T` (Tokyo).
## Install
```
cd "D:\Documents\AI Automation\Claude Code Projects\Yahoo Finance"
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt
```
(Already done — the venv in this folder is ready.)
## Register in Claude Desktop
Add to `%APPDATA%\Claude\claude_desktop_config.json`, then restart Claude Desktop:
```json
{
"mcpServers": {
"yahoo-finance": {
"command": "D:\\Documents\\AI Automation\\Claude Code Projects\\Yahoo Finance\\.venv\\Scripts\\python.exe",
"args": ["D:\\Documents\\AI Automation\\Claude Code Projects\\Yahoo Finance\\server.py"]
}
}
}
```
## Register in Claude Code
```
claude mcp add yahoo-finance -s user -- "D:\Documents\AI Automation\Claude Code Projects\Yahoo Finance\.venv\Scripts\python.exe" "D:\Documents\AI Automation\Claude Code Projects\Yahoo Finance\server.py"
```
`-s user` makes it available in every project.
## Register in Claude chat (claude.ai) — custom connector
claude.ai only accepts **remote** servers, so the server must be hosted at a public
HTTPS URL. The same `server.py` serves this with the `--http` flag (Streamable HTTP
at `/mcp`).
Deploy free on Render (~10 min, one time):
1. Push this folder to a GitHub repo (`.venv` is gitignored).
2. At https://render.com → New → Web Service → connect the repo. `render.yaml` is
picked up automatically (build: `pip install -r requirements.txt`, start:
`python server.py --http`, free plan).
3. Copy the service URL, e.g. `https://yahoo-finance-mcp.onrender.com`.
Then in **any** Claude account: Settings → Connectors → **Add custom connector** →
paste `https://<your-service>.onrender.com/mcp` → Add (no authentication needed).
Notes:
- Render's free tier sleeps after ~15 min idle; the first tool call after a pause
takes ~30–60 s to cold-start, then it's fast.
- The endpoint has no auth — anyone with the URL can query it. It only serves
public market data, but don't post the URL anywhere.
- If tool calls fail from the cloud but work locally, Yahoo is rate-limiting the
host's IP — redeploy or upgrade the instance.
## Run manually (debugging)
```
.venv\Scripts\python.exe server.py # stdio (Claude Desktop / Code)
.venv\Scripts\python.exe server.py --http # Streamable HTTP on :8000/mcp (claude.ai)
```
Speaks MCP over stdin/stdout; logs go to stderr. Data is unofficial Yahoo Finance via yfinance — fine for screens and sanity checks, not a substitute for filings or CapIQ on anything that goes in a deliverable.
This server cannot be deployed
Maintenance
ActivityStale
ResponsivenessNo issues