stock-mcp
Stores and retrieves stock market data in a MySQL database, providing tools for querying quotes, historical K-line data, company profiles, financial statements, ratios, dividends, analyst forecasts, earnings, holders, news, and options chains.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@stock-mcpGet latest quote for AAPL"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
yahoo-stock-mcp
An MCP server (TypeScript / Node.js) that pulls comprehensive market data for stocks via Yahoo Finance and Investing.com (GraphQL + TVC), persists it to an external MySQL (configured via a YAHOO_STOCK_MCP_DATABASE_URL connection string, not bundled with the server), and queries it by ticker.
Architecturally the MCP server stays lightweight: it is only a thin query layer plus a sync trigger, while the database is a fully external dependency.
Install
npm install -g yahoo-stock-mcpRequires Node.js >= 20 and an external MySQL (see the .env config below).
Related MCP server: YFinance MCP Server
Quick start (npm global install)
The package already ships the compiled dist/ and the Go sidecar bin/gqlproxy, so no build step is needed — just use the yahoo-stock-mcp command:
# 0. CLI basics (no database needed)
yahoo-stock-mcp --version # print version
yahoo-stock-mcp --help # print usage (also: yahoo-stock-mcp help sync)
# 1. Configure the external MySQL connection (.env)
# YAHOO_STOCK_MCP_DATABASE_URL=mysql://user:pass@host:3306/yahoo_stock_mcp
# For a local dev database you can spin one up with deploy/docker-compose.mysql.yml:
# docker compose -f deploy/docker-compose.mysql.yml up -d
# 2. Initialise the schema in the configured database
yahoo-stock-mcp db:init
# 3. Full sync of one stock (pull history from 2000-01-01 + all fundamentals)
yahoo-stock-mcp sync --symbol NVDA --full
# Incremental sync afterwards (only new data)
yahoo-stock-mcp sync --symbol NVDA
# Incremental sync and also pull 15m bars (1m/5m/15m/30m/60m)
yahoo-stock-mcp sync --symbol NVDA --intraday 15m
# Sync every stored symbol
yahoo-stock-mcp sync --all --full
# Sync all GICS sector ETFs + constituents (sector rotation data)
yahoo-stock-mcp sync --sectors
# 4. Start the MCP server (stdio)
yahoo-stock-mcp serverCommand reference
Usage: yahoo-stock-mcp <command> [options]
Commands:
server Start the MCP server over stdio (default with no arguments)
db:init Create the MySQL schema in the configured database
sync Pull stock data from Yahoo Finance / Investing.com into MySQL
version Print the version number
help [command] Show general help, or help for a specific command
Options:
-h, --help Show this help
-v, --version Print the version numberRun yahoo-stock-mcp help sync (or yahoo-stock-mcp sync --help) for sync options.
--version / -v / version all print yahoo-stock-mcp <version>.
Run from source (development / contribution)
npm install
npm run build:all # TypeScript + Go sidecar
npm run server # stdio; use npm run sync -- ... or npm run dev for other commandsTests
# Requires a local MySQL (default 127.0.0.1:3306, see deploy/docker-compose.mysql.yml) with the schema initialised
npm run test:cli # CLI behaviour: version / help / unknown-command handling (no DB required)
npm run test:db # query layer: covers all query functions, LIMIT binding regression, edge params
npm run test:mcp # protocol layer: initialize/tools/list/tools/call end-to-end + stdin close exit
npm test # all threeTests use a dedicated ZZTEST symbol and clean up automatically, so they never touch real data.
MCP tools
Tool | Description |
| Full/incremental sync of one stock to MySQL |
| Search stored instruments by symbol/name |
| Latest quote + key metrics |
| Historical candles (1d/1wk/1mo) |
| Company profile |
| The three financial statements |
| Valuation / financial ratios |
| Dividend history & summary |
| Analyst consensus & price target |
| Earnings history & estimates |
| Institutional holders |
| News |
| Option chain snapshot (queried after being synced to DB) |
| Live option quotes straight from Yahoo (on demand, no local DB needed): underlying quote + optional expiry/strike/direction filters |
| Forward-looking event calendar: next earnings / call / ex-dividend / dividend dates (Yahoo |
| Insider trading: executive/director buys & sells, shares, amounts (Yahoo |
| Analyst upgrades/downgrades & target-price changes (Yahoo |
| Quarterly earnings estimate trend: EPS/revenue estimates, growth, 7/30/60/90-day revisions (Yahoo |
| Analyst rating trend (monthly strong buy/buy/hold/sell/strong sell) |
| Mutual fund ownership (Yahoo |
| Short-interest snapshot: shares short, short ratio, % of float (Yahoo |
| Ownership breakdown: insider/institutional %, institutional float, institutional count (Yahoo |
| Minute-level bars (1m/5m/15m/30m/60m, queried after being synced to DB) |
| Sector catalog: the 11 GICS sectors + SPY benchmark, mapped to SPDR sector ETFs |
| Sector rotation view: each sector's latest price + 1d/5d/20d change ranking vs SPY benchmark |
| Sector constituents (sector ETF |
| Sync all sector ETF quotes (~30 days of bars) and constituents |
Data sources
Yahoo Finance: bars (v8 chart), quoteSummary (needs cookie+crumb), options (v7), news (v1 search), fundamentals (fundamentals-timeseries, no auth)
Investing.com: GraphQL
gql.api.investing.com/graphql(quotes/statements/ratios/dividends/estimates/earnings/profile/executives/holders, no auth), TVC bars (carrier token)
Data checklist
For the "watch the market, position early" use case, the following dimensions are added on top of the per-stock fundamentals, all fetched from existing Yahoo quoteSummary / Investing GraphQL endpoints:
Dimension | Table | Source |
Forward-looking event calendar |
| Yahoo |
Insider transactions |
| Yahoo |
Analyst actions |
| Yahoo |
Earnings estimate trend |
| Yahoo |
Recommendation trend |
| Yahoo |
Fund holders |
| Yahoo |
Short interest |
| Yahoo |
Holder breakdown |
| Yahoo |
Minute bars |
| Yahoo chart v8 (1m/5m/15m/30m/60m) |
Sector catalog & rotation |
| GICS 11 sectors + SPY benchmark, sector ETF (XLC..XLU/SPY) quotes + |
Indices / ETFs / cross-assets (e.g.
^GSPC,^VIX,SPY,TLT) can be synced directly as symbols: Yahoo natively serves index quotes, and any Investing side failures are skipped automatically, so Yahoo data still lands in the DB.
Client integration (Claude Desktop / Cursor / Codex)
{
"mcpServers": {
"yahoo-stock-mcp": {
"command": "yahoo-stock-mcp",
"args": ["server"],
"env": {
"YAHOO_STOCK_MCP_DATABASE_URL": "mysql://user:pass@host:3306/yahoo_stock_mcp",
"YAHOO_STOCK_MCP_PROXY_URL": "http://127.0.0.1:17890"
}
}
}
}
commandrelies onyahoo-stock-mcpbeing on PATH (satisfied after a global npm install); if not globally installed, use the source path instead:node /path/to/yahoo-stock-mcp/dist/cli.js server. All config vars use theYAHOO_STOCK_MCP_prefix so they never collide with other apps'DATABASE_URL/PROXY_URL/USER_AGENT.
Notes
Full sync: pulls all daily bars from
YAHOO_STOCK_MCP_BARS_START_DATE(default2000-01-01) + all fundamentals + an options snapshot + news + the data checklist (events/insiders/analysts/earnings trend/short interest/funds, etc.).Incremental sync: only pulls new bars since
sync_state.last_bar_date, and refreshes quotes, ratios, estimates, news, the options snapshot and the data checklist.Minute bars:
--intraday <1m|5m|15m|30m|60m>pulls the last 7 days of minute bars intointraday_bars(idempotent upsert).Sectors:
sync --sectorssyncs the 11 GICS sector ETFs (XLC..XLU) + SPY benchmark quotes andtopHoldingsconstituents in one go;get_sector_performancereturns the rotation ranking.Options:
get_optionsreads the snapshot synced to the DB;get_option_quotefetches the latest quotes directly from Yahoo on demand (incl. underlying price, optional expiry, strike, and direction filters) — no prior sync required.All writes are idempotent upserts (
INSERT ... ON DUPLICATE KEY UPDATE) and can be re-run safely.Rate limiting is built in (default 300ms/request); Yahoo crumb cache 25 min, TVC token cache 25 min.
About investing.com's TLS interception
investing.com blocks Node.js requests via Cloudflare TLS fingerprinting (HTTP 403), while a Go client can access it normally. That's why the project bundles a tiny Go transport proxy cmd/gqlproxy (~200 lines, stdlib only):
npm run build:sidecar # produces bin/gqlproxyThe TS data-source layer tries Node fetch first, and automatically switches to that proxy on a 403 (with a persistent cookie session that handles the Cloudflare challenge). From networks that aren't fingerprint-blocked the proxy is unnecessary; set YAHOO_STOCK_MCP_INVESTING_TRANSPORT=node to force pure Node.
# Full build (TypeScript + Go sidecar)
npm run build:allEnvironment variables
Var | Default | Description |
| derived from | Full MySQL connection string, e.g. |
| 127.0.0.1/3306/stock/stock123/yahoo_stock_mcp | MySQL connection (used when |
| Chrome 148 UA | Request fingerprint |
| 300 | Per-request rate limit |
| none | HTTP(S) proxy for all Node fetch requests, e.g. |
| 2000-01-01 | Full-sync start date |
| yahoo | Bar source (yahoo/investing) |
| 20 | News count per fetch |
| auto | node / go / auto |
| .cache/gqlproxy_cookies.txt | sidecar cookie session file |
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceReal-time financial market data MCP server. Stocks, crypto, technicals, sentiment, FDA calendar. No API keys required.
- AlicenseNot gradedqualityCmaintenanceA comprehensive MCP server that provides seamless access to Yahoo Finance stock market data, enabling retrieval of real-time quotes, historical data, charts, financial summaries, and market searches.38ISC
- FlicenseNot gradedqualityDmaintenanceA lightweight MCP server for accessing Yahoo Finance data, providing stock prices, history, company information, and financial statements.
- 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.222MIT
Related MCP Connectors
Multi-tenant FastMCP server for Charles Schwab brokerage data, monetized via DPYC Tollbooth
7-factor stock scoring MCP server. US/HK/CN, 74 stocks. Free + Premium (USDC/Base). x402 ready.
Alpha Vantage MCP — Stock market data, fundamentals, and earnings
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jamespud/yahoo-stock-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server