yahoo-finance-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
yahoo-finance-mcp
A remote MCP server that exposes Yahoo Finance data (via yfinance) to MCP clients such as Claude (claude.ai, Claude Desktop, Claude Code), ChatGPT connectors, and Notion custom agents.
24 tools covering quotes, price history, fundamentals, analyst data, holders, options, funds, screeners, sectors, market summaries, calendars, and live ticks
Streamable HTTP transport, stateless (scales to zero on Cloud Run)
OAuth 2.1 with a single pre-registered client (
client_id/client_secret), plus Basic auth and client credentials for non-OAuth clientsOne-command deploy to Google Cloud Run with the secret kept in Secret Manager
Yahoo Finance is the only data source. yfinance uses Yahoo's unofficial APIs, so endpoints can change or be rate-limited without notice. This project is not affiliated with Yahoo. Use it for personal purposes and respect Yahoo's terms of service.
Tools
Category | Tool | What it returns |
Prices |
| Price, change vs. previous close, day range, volume, 52-week range, market cap, moving averages, trading session times |
| Price and change for up to 50 symbols at once | |
| OHLCV history (1m to 3mo bars, pre/post market, adjusted or raw) | |
| One field (e.g. Close) for up to 20 symbols as a date × symbol table | |
| Subscribes to Yahoo's real-time WebSocket stream for a few seconds and returns the latest tick per symbol | |
Company |
| Profile, sector/industry, officers, valuation ratios, margins |
| Income statement, balance sheet, cash flow (yearly, quarterly, TTM) | |
| Market cap, EV, P/E, forward P/E, PEG, P/S, P/B, EV/Revenue, EV/EBITDA over time | |
| Next earnings date and estimates, EPS estimate / actual / surprise history | |
| Price targets, rating distribution, upgrades/downgrades, EPS and revenue estimates, EPS trend and revisions, growth estimates | |
| Major holders breakdown, top institutions and mutual funds, insider transactions and roster | |
| Dividend, split, and capital-gain distribution history (newest first) | |
| Shares outstanding over time (monthly changes) | |
| SEC filings (US companies) | |
| ETF / mutual fund overview, expenses, asset allocation, top holdings, sector weights, bond ratings | |
| Related news articles | |
| Calls and puts for an expiration, optionally trimmed to strikes around the spot price | |
Discovery |
| Find tickers by name (English), optionally filtered by asset type, with research headlines |
| Yahoo's screener: 19 predefined screens or custom filters (equity / fund / ETF), with paging | |
| Valid screener fields and enum values (regions, sectors, exchanges) | |
| Sector / industry overview, top companies, top ETFs and funds, research reports | |
Market |
| Regional summaries (US, Asia, Europe, UK, US Treasury yields, currencies, commodities, crypto) and market open/close status |
| Earnings, economic events, IPOs, and stock splits calendars |
Ticker examples: AAPL, 7203.T (Tokyo), ^N225, ^GSPC, USDJPY=X, CL=F, BTC-USD.
Data quality notes
Previous close. Change and change % are computed from Yahoo's chart metadata (
previousClose), not fromfast_info.previousClose, which is often off by a day.Market summary.
yfinance.Market.summarykeys results by exchange code, so items on the same exchange overwrite each other (e.g. only 1 of 6 currencies survives). This server calls the same Yahoo endpoint directly and keeps every item.Response size. Option chains are trimmed to strikes near the spot price. Price history drops all-zero dividend/split columns and rounds prices. Long lists are capped and report
truncated.Errors. Every tool returns a readable message to the client, e.g. "symbol not found, use
search_symbols" or the list of valid expirations. MCP SDK 2.x would otherwise hide the cause.
Yahoo Finance features intentionally not exposed
Feature | Reason |
ESG scores ( | Yahoo currently returns empty data for every symbol tested |
| Discontinued by Yahoo (returns |
News tabs ( | Every tab returns empty; |
ISIN ( | yfinance fetches it from Business Insider, not Yahoo, and returns wrong values for non-US listings |
| Not implemented in yfinance |
Data that Yahoo Finance does not provide (for example Japanese government bond yields) is out of scope.
Related MCP server: Financial Modeling Prep MCP Server
Authentication
Only one pre-registered client is accepted. It is configured with OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET. Dynamic client registration is disabled.
Method | Use it for | How it works |
OAuth authorization code + PKCE | Claude.ai / Claude Desktop custom connectors, Claude Code ( | Enter the client ID and secret in the client. A browser window opens and is approved automatically. Access tokens last 1 hour; refresh tokens last 30 days |
Basic auth | Clients that only support static headers or username/password |
|
Client credentials | Scripts, other agents, automation tools |
|
Long-lived API key | Clients that only accept a bearer token |
|
Design notes:
Stateless tokens. Tokens are HS256-signed JWTs, so the server keeps no state and works across multiple instances.
Revocation. Rotating
OAUTH_CLIENT_SECRETinvalidates every issued token and API key, unless you setOAUTH_SIGNING_KEYseparately.No consent screen. The authorization endpoint issues a code without asking. That is safe here because exchanging the code requires both the client secret and the PKCE verifier.
Allowed redirect URIs. Claude (
https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback), Notion (https://app.notion.com/workflows/mcp/oauth/callback), ChatGPT (https://chatgpt.com/connector_platform_oauth_redirect), and loopback addresses (http://localhost:*,http://127.0.0.1:*). Add more withOAUTH_REDIRECT_URIS(comma-separated).Discovery. Metadata is served at
/.well-known/oauth-protected-resource(RFC 9728) and/.well-known/oauth-authorization-server(RFC 8414). A 401 response includesWWW-Authenticate: Bearer resource_metadata=....
Configuration
Variable | Required | Description |
| yes | Client ID of the single allowed client |
| yes | Client secret, at least 32 characters ( |
| no | Public origin used as the OAuth issuer and resource. If unset, it is derived from the request |
| no | Extra allowed redirect URIs, comma-separated |
| no | JWT signing key. If unset, it is derived from the client secret |
| no | Listen address (default |
See .env.example. Keep real values in .env, which is excluded by .gitignore, .dockerignore, and .gcloudignore.
Quick start (local)
Requires Python 3.12+ and uv.
cp .env.example .env
# set OAUTH_CLIENT_SECRET in .env, e.g. with: openssl rand -hex 32
set -a; . ./.env; set +a
uv run python server.py # MCP endpoint: http://localhost:8080/mcpTry it with curl:
TOKEN=$(curl -s -u "$OAUTH_CLIENT_ID:$OAUTH_CLIENT_SECRET" -d grant_type=client_credentials \
http://localhost:8080/token | jq -r .access_token)
curl -s http://localhost:8080/mcp \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_quote","arguments":{"symbol":"AAPL"}}}'Tests
uv run pytest # offline: tools with a stubbed yfinance, auth flows, HTTP transport
uv run pytest -m live # smoke tests against the real Yahoo Finance APIThe offline suite includes an end-to-end OAuth test using the MCP Python SDK's own OAuth client: discovery, authorization, token exchange, and tool calls.
Deploy to Google Cloud Run
Requires the gcloud CLI, logged in to a project with billing enabled.
./deploy.sh
# Override defaults with environment variables:
# PROJECT (gcloud's current project), REGION (asia-northeast1), SERVICE (yahoo-finance-mcp),
# CLIENT_ID (yahoo-finance-mcp), SECRET (yahoo-finance-mcp-client-secret), SA_NAME (yahoo-finance-mcp)The script does the following:
Enables the required APIs: Run, Cloud Build, Artifact Registry, Secret Manager, and IAM.
Creates a dedicated runtime service account that can read only this one secret.
Generates a client secret in Secret Manager on the first run. The value is never printed or written to disk.
Builds the container from source and deploys it with
min-instances 0, so it costs nothing while idle.Pins
PUBLIC_BASE_URLto the deterministic service URL,https://<service>-<project-number>.<region>.run.app.
Read the secret back when you need it for a client:
gcloud secrets versions access latest --secret yahoo-finance-mcp-client-secretCloud Run reserves paths ending inz (such as /healthz), so the health check lives at /health.
Connecting clients
In the examples below, $URL is your service URL and $SECRET is the client secret.
Claude.ai / Claude Desktop
Settings → Connectors → Add custom connector
URL:
$URL/mcpAdvanced settings → OAuth Client ID:
yahoo-finance-mcp, OAuth Client Secret:$SECRET
Click Connect. The connector becomes available in Claude Desktop and mobile on the same account.
Claude Code
MCP_CLIENT_SECRET=$SECRET claude mcp add --transport http -s user yahoo-finance "$URL/mcp" \
--client-id yahoo-finance-mcp --client-secret --callback-port 33418
# Then run /mcp in Claude Code → yahoo-finance → AuthenticateWithout a browser, use Basic auth instead:
claude mcp add --transport http -s user yahoo-finance "$URL/mcp" \
--header "Authorization: Basic $(printf 'yahoo-finance-mcp:%s' "$SECRET" | base64)"Notion custom agents
You need a Business or Enterprise plan. A workspace admin must turn on Enable custom MCP servers under Settings → Connections.
Then open Agent settings → Tools & Access → Add connection → Custom MCP server, and set the URL to $URL/mcp. Pick one of these:
OAuth (recommended). Authentication = OAuth. Under Advanced settings, set OAuth client ID to
yahoo-finance-mcpand OAuth client secret to$SECRET.Basic. Username =
yahoo-finance-mcp, password =$SECRET.
ChatGPT
Add a custom connector (Settings → Connectors, developer mode) with:
MCP server URL:
$URL/mcpAuthentication: OAuth, with client ID
yahoo-finance-mcpand client secret$SECRET
ChatGPT redirects to https://chatgpt.com/connector_platform_oauth_redirect, which is allowed by default.
Anything else
Any MCP client that supports Streamable HTTP can connect, using either OAuth, Basic auth, or a bearer token from POST /token (see the curl example above).
Rotating the secret
openssl rand -hex 32 | tr -d '\n' | \
gcloud secrets versions add yahoo-finance-mcp-client-secret --data-file=-
./deploy.sh # the new revision picks up the new secret; all old tokens become invalidThen update the secret in every client.
Project layout
server.py MCP server and the 24 tools
auth.py OAuth 2.1 authorization server, auth middleware, API key CLI
deploy.sh Cloud Run deployment
Dockerfile Container image (uv, Python 3.12, non-root)
tests/ Offline and live test suites
.env.example Configuration template (no real values)License
Acknowledgements
yfinance by Ran Aroussi and contributors
Related MCP Connectors
Financial data MCP server for Claude, ChatGPT, Cursor and Codex. Real-time stock quotes, financial statements, options flow, SEC filings, insider trades, 13F holdings, macro data and market news from gloom.sh, the open-source Bloomberg Terminal alternative.
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Your agent needs markets — prices and fundamentals for listed companies, the filings behind them, crypto, and what the prediction markets put the odds at. **What you can ask for** • "Pull this company's income statement, cash flow and balance sheet for the last 8 quarters." • "What did insiders buy or sell, and when?" • "Snapshot prices for these 50 tickers, then the OHLC history for the three that moved." • "What are the current odds on this event across Kalshi and Polymarket?" • "Screen for companies matching these financial criteria." **How to use it** Point any MCP client at https://mcp.aisa.one/finance/mcp and sign in with OAuth — there is no key to create or paste. 49 tools: prices and snapshots, income statements, balance sheets and cash flows, metrics and ratios, earnings and analyst estimates, filings and line-item search, insider trades, macro interest rates, news, a screener; CoinGecko spot prices, market tables, OHLC, per-venue tickers and trending; Kalshi and Polymarket markets and trades; plus EDINET filings for Japan. **Why this rather than the source** Equities, crypto and event markets behind one account, so a cross-asset question is one conversation. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Read the number here, then ask the same agent what X is saying about the ticker today — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/marketpulse/mcp · /crypto-market-data/mcp · /prediction-market-data/mcp · /stock-pulse/mcp for one slice each.
Research US-listed companies and funds with the StockPortfolio.pro MCP server. Tools cover SEC filing-grounded financials, filing timelines, company comparisons, watchlist screens, fund profiles, and cited filing questions. Filed figures include their fiscal period and EDGAR source URL; missing filing data is returned as null. Public tools work without authentication; optional API-key or OAuth access is supported. US-listed, USD-reporting companies only. Keyless access includes 3 free AI questions per rolling 30-day window. To get more now, choose the Dev plan ($19.99/month, 200 credits) at https://www.stockportfolio.pro/register?plan=dev, then follow https://www.stockportfolio.pro/docs/api-mcp to connect with OAuth or an API key. Or wait for the free allowance to renew.
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP server that exposes Yahoo Finance data through tools for searching instruments, fetching quotes, history, company info, financials, dividends, news, recommendations, and options. Enables AI assistants to answer market-data questions using natural language.24376 PyPI1MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access and analyze financial data, stock information, company fundamentals, and market insights through a standardized MCP interface. It provides 250+ tools across categories such as financial statements, quotes, technical indicators, ETFs, crypto, forex, commodities, economics, and SEC filings.601 npmApache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access and analyze financial data, stock information, company fundamentals, and market insights through 250+ tools covering equities, ETFs, crypto, forex, commodities, economics, and more. Supports dynamic or static toolsets over HTTP/SSE for integration with MCP clients.601 npmApache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access and analyze financial data, stock information, company fundamentals, and market insights through 250+ tools spanning stocks, ETFs, crypto, forex, commodities, and economics. Supports dynamic, static, or full toolset loading over HTTP/SSE for Claude and other MCP clients.601 npmApache 2.0