Get the FREE Ultimate OpenClaw Setup Guide →

yfinance

Unofficial MCP server for Yahoo Finance stock data.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio onori-yfinance-mcp-server npx @onori/yfinance-mcp-server

How to use

The yfinance MCP server exposes a simple interface to fetch historical Yahoo Finance data via the getStockHistory tool. It runs as an MCP server instance that you can connect to with any MCP client. The primary capability is to request historical stock data for a given symbol over a specified period with a chosen data interval. The server is started via the npx command and uses the @onori/yfinance-mcp-server package to serve the endpoints. You can then issue MCP requests to get adjusted historical OHLCV data for symbols like AAPL, MSFT, or GOOGL over periods such as 1d, 1mo, 1y, or max, with intervals such as 1d, 1wk, or 1mo.

How to install

Prerequisites:

  • Node.js and npm installed on your machine (Node >= 16 is recommended)
  • Internet access to install npm packages

Installation steps:

  1. Install and run the MCP server via npx (no local install required):
npx @onori/yfinance-mcp-server
  1. If you prefer to install locally for development, you can install the package and run a local server (optional):
mkdir yfinance-mcp && cd yfinance-mcp
npm init -y
npm install @onori/yfinance-mcp-server

Then start the server (adjust the start script as needed by your setup):

npx @onori/yfinance-mcp-server
  1. Verify the server is running by connecting with an MCP client and issuing a getStockHistory request.

Additional notes:

  • The README example uses npx to fetch the MCP server package on demand; this is common for MCP server setups to avoid a global install.
  • If you prefer to pin a specific version, specify it in the command, e.g., npx @onori/yfinance-mcp-server@1.0.0.

Additional notes

Tips and considerations:

  • The server fetches data from Yahoo Finance via the yfinance library, which may be subject to rate limits or data availability changes. Plan for occasional API changes or data gaps.
  • Available parameters for getStockHistory: symbol (required), period (required), interval (optional). Common values: period: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max; interval: 1d, 1wk, 1mo.
  • When using MCP clients, ensure your requests follow the MCP protocol for payload structure and response handling.
  • If you need to customize behavior (e.g., default period or interval), you may extend or fork the MCP server package and adjust its configuration or code accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers