Yahoo Finance2

Finance and commerce

Unofficial API for Yahoo Finance with CLI, MCP and Agent Skill.

Your AI app calls the Yahoo Finance2 MCP server, which does the finance and commerce work and sends the result back to the chat.

About Yahoo Finance2

Yahoo Finance2 is a community MCP server from gadicc, filed in our directory under finance and commerce. Unofficial API for Yahoo Finance with CLI, MCP and Agent Skill.

Yahoo Finance2 runs on your own machine: your AI app starts it with the command npx -y yahoo-finance2 and talks to it over standard input and output.

At a glance

Publisher
gadicc (community)
Runs
Locally on your machine
Install from
Node.js package on npm: yahoo-finance2
Written in
HTML
License
MIT
GitHub stars
821

How to set up Yahoo Finance2

  1. Install Node.js on the machine that runs your AI app, because Yahoo Finance2 starts with npx and downloads its package on first run.
  2. Check the Yahoo Finance2 README for keys or settings; the registry lists none that Yahoo Finance2 requires.
  3. Add Yahoo Finance2 to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Yahoo Finance2 tools to confirm the connection.
  5. Run one read-only task with Yahoo Finance2 first, and keep your app asking before each tool call until the results look right.

Yahoo Finance2 compared with similar servers

  • Polymarket by caiovicentino has fewer GitHub stars than Yahoo Finance2 (764 against 821); both are community servers, and Polymarket runs as a remote server and Yahoo Finance2 runs on your own machine.
  • Kraken CLI by krakenfx has more GitHub stars than Yahoo Finance2 (833 against 821); both are community servers, and both run locally.
  • Maverick by wshobson has fewer GitHub stars than Yahoo Finance2 (737 against 821); both are community servers, and both run locally.

Before you connect Yahoo Finance2

  • Give Yahoo Finance2 its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Yahoo Finance2 tool call until you trust what it does with them.
  • Treat text that Yahoo Finance2 fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Yahoo Finance2 on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Yahoo Finance2

How marketing and sales teams put Yahoo Finance2 to work, by company size. Pick the size closest to yours and start Yahoo Finance2 on one use case.

Small business

  • A small business can ask Yahoo Finance2 which products and customers drive margin, then plan promotions around them.
  • Owners can use Yahoo Finance2 to check refunds, failed payments and churn reasons without opening three dashboards.
  • Yahoo Finance2 runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Ecommerce teams can connect Yahoo Finance2 to tie campaigns to orders and revenue, not just clicks.
  • Marketing and finance can use Yahoo Finance2 to check spend against budget each week and move money to what's working.
  • Start Yahoo Finance2 on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises should keep Yahoo Finance2 read-only for agents, with any money movement handled by people and existing approvals.
  • Large commerce teams can use Yahoo Finance2 to answer revenue questions by channel and region with figures finance signs off on.
  • Yahoo Finance2 is a community server, so have security review the code and pin a version before Yahoo Finance2 touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Yahoo Finance2 README

From gadicc/yahoo-finance2 on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

yahoo-finance2

Unofficial API for Yahoo Finance with CLI, MCP and Agent Skill.

Copyright (c) 2021 by Gadi Cohen and Pilwon Huh. MIT licensed.

You are reading the docs for v4, the current major version published as yahoo-finance2@latest. For the older v3 docs, click github.com/gadicc/yahoo-finance2/tree/3.x. Upgrading? See UPGRADING.

Live Demo on CodeSandbox (Updated 2024-06-17; NextJS with both RSC and Hook-Relay examples)

NB: Recently the repo was renamed from node-yahoo-finance2 to yahoo-finance2, and the following branches were named, master to main, and devel to dev. See UPGRADING.md#dev for the git commands to update your local installation.

Supported runtimes:

  • Bun: v1+.
  • Cloudflare: Modern releases, tested in CI via Workers Vitest under nodejs_compat.
  • Deno: v2+.
  • Node: v22+; v22 until 2027-04-30, v24 until 2028-04-30. Supported releases follow the Node.js release schedule.

Unofficial API

This project is neither created nor endorsed by Yahoo Inc. Yahoo does not provide any official API to developers, nor makes any guarantees regarding service availability or API consistency. In practice however, the open source community has kept this project (and it's predecessor) working well since 2013.

Nevertheless, we make no guarantees and you use this package at your own risk. The developers (and obviously Yahoo) cannot be held responsible for any losses you may incur as a result of using this service. Use of this package is considered acknowledgement and acceptance of these terms and of its license.

Quickstart

CLI (Command line interface)

$ npx yahoo-finance2 --help
$ npx yahoo-finance2 search AMZN
$ npx yahoo-finance2 quoteSummary GOOGL
$ npx yahoo-finance2 quoteSummary NVDA '{"modules":["assetProfile", "secFilings"]}'

# or install it
$ npm install -g yahoo-finance2
$ yahoo-finance search MSFT '{ "someOption": true }'

See the CLI docs for stdout/stderr behavior and exit codes.

See the MCP docs to expose yahoo-finance2 tools to MCP clients such as Codex, Claude, Cursor, and VS Code.

Importing

// or: const YahooFinance = require("yahoo-finance2").default;
import YahooFinance from "yahoo-finance2";

const yahooFinance = new YahooFinance();

const results = await yahooFinance.search("Apple");

const quote = await yahooFinance.quote('AAPL');
const { regularMarketPrice as price, currency } = quote;

Available modules: chart, fundamentalsTimeSeries, historical, insights, options, quote, quoteSummary (submodules: assetProfile, balanceSheetHistory, balanceSheetHistoryQuarterly, calendarEvents, cashflowStatementHistory, cashflowStatementHistoryQuarterly, defaultKeyStatistics, earnings, earningsHistory, earningsTrend, financialData, fundOwnership, fundPerformance, fundProfile, incomeStatementHistory, incomeStatementHistoryQuarterly, indexTrend, industryTrend, insiderHolders, insiderTransactions, institutionOwnership, majorDirectHolders, majorHoldersBreakdown, netSharePurchaseActivity, price, quoteType, recommendationTrend, secFilings, sectorTrend, summaryDetail, summaryProfile, symbol, topHoldings, upgradeDowngradeHistory), recommendationsBySymbol, screener, search, trendingSymbols.

Extras: quoteCombine.

See the Explanatatory Documentation and Full API Documentation.

Particularly, make sure to read the notes there on ERROR HANDLING. Be aware that if a stock gets delisted, Yahoo removes all related data, including historical (and chart) data from periods before the delisting occurred (i.e. queries that worked before will start failing, and there is no way to retrieve this data again).

Agent Skill

This repo ships an Agent Skills-compatible skill at skills/yahoo-finance2. Install it for compatible agents with:

npx skills add gadicc/yahoo-finance2

The npm package also includes the skill under skills/yahoo-finance2 for tools that sync skills from installed packages.

(Optional) TypeScript Love

Working with yahoo-finance2 is a joy if you're using TypeScript (but you don't have to), with type checking and auto completion:

Try it yourself on our Live CodeSandbox.

Using in the Browser

It's not possible to run this in the browser, due to CORS and cookie issues. You should execute calls on a server or in a serverless or edge function, and pass this data to the browser as required. See the CodeSandbox above for examples. Use React Server Components, trpc, or other strategies to maintain types.

Related Projects

  • 📈 Ghostfolio - mature, open-source Wealth Management & longtime supporter.

  • 🛠️ StockQuotes.MCP - AI MCP Server to fetch real time financial data.

  • ⚡ live-quotes - Demo to showcase running yahoo-finance2 in cloudflare workers with live quotes.

  • 🦊 Foliofox - Open-source portfolio tracker with an AI financial advisor.

Want your project listed? Open a PR to add it here.

Contributing

Pull Requests welcome! Read CONTRIBUTING.md and join our list of heroes:

Credits

  • Massive thanks to @pilwon for the original node-yahoo-finance and for all our prior collaborations on this and other projects 🙏

  • Special mention goes out to pudgereyem and PythonCreator27 who made significant contributions in the very early days of this project.

Questions about Yahoo Finance2

What is the Yahoo Finance2 MCP server?

Unofficial API for Yahoo Finance with CLI, MCP and Agent Skill. Yahoo Finance2 is maintained by gadicc on GitHub at gadicc/yahoo-finance2, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Yahoo Finance2 MCP server?

Add Yahoo Finance2 to your AI app's MCP config with the command npx -y yahoo-finance2. In Claude Code, run claude mcp add --transport stdio yahoo-finance2 -- npx -y yahoo-finance2. To run Yahoo Finance2 this way you need Node.js installed.

Does Yahoo Finance2 need an API key?

The registry lists no required keys for Yahoo Finance2. Check the Yahoo Finance2 README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Yahoo Finance2 an official MCP server?

No. Yahoo Finance2 is a community server maintained by gadicc. Community servers can be excellent; read the code and the open issues before you give Yahoo Finance2 access to company data.

What license is Yahoo Finance2 under?

Yahoo Finance2 is released under the MIT license, according to its GitHub repository. The license covers the code of Yahoo Finance2; the service it connects to has its own terms.