yf-financial-data-interface
A Model Context Protocol (MCP) endpoint offering extensive quantitative and qualitative investment data sourced exclusively from the Yahoo Finance platform. It facilitates retrieval of stock performance metrics, corporate structural details, statutory financial filings, derivatives pricing information, and pertinent market commentary for rigorous investment appraisal and thorough market scrutiny.
Author

hwangwoohyun-nav
Quick Info
Actions
Tags
Yahoo Finance MCP Server
This is a Model Context Protocol (MCP) server that provides comprehensive financial data from Yahoo Finance. It allows you to retrieve detailed information about stocks, including historical prices, company information, financial statements, options data, and market news.
Demo
MCP Tools
The server exposes the following tools through the Model Context Protocol:
Stock Information
| Tool | Description |
|---|---|
get_historical_stock_prices |
Obtain time-series Open-High-Low-Close-Volume data for a security across user-defined temporal spans and granularities |
get_stock_info |
Retrieve holistic security data encompassing current valuation, fundamental ratios, and corporate metadata |
get_yahoo_finance_news |
Fetch the most recent journalistic reports pertaining to a specific equity |
get_stock_actions |
Access historical records detailing corporate dividend distributions and stock split events |
Financial Statements
| Tool | Description |
|---|---|
get_financial_statement |
Extract formal financial disclosures: Profit/Loss, Balance Sheet summary, or Cash Flow report (yearly or quarterly frequency) |
get_holder_info |
Query data concerning principal shareholders, institutional ownership concentrations, mutual fund positions, or executive transaction logs |
Options Data
| Tool | Description |
|---|---|
get_option_expiration_dates |
List all available maturity dates for associated derivative contracts |
get_option_chain |
Retrieve the full listing of derivative contracts (puts/calls) for a selected maturity date and instrument type |
Analyst Information
| Tool | Description |
|---|---|
get_recommendations |
Access documented professional analyst ratings, including documented rating revisions or downgrades/upgrades history |
Real-World Use Cases
With this MCP server, you can use Claude to:
Stock Analysis
- Price Analysis: "Display the past six months of daily historical stock quotations for ticker AAPL."
- Financial Health: "Retrieve the most recent quarterly statement of financial position for the entity Microsoft."
- Performance Metrics: "What are the essential quantitative measures available for Tesla via the stock information utility?"
- Trend Analysis: "Execute a comparative review of the quarterly income statements for both Amazon and Google."
- Cash Flow Analysis: "Present the yearly statement of cash flows for the entity NVIDIA."
Market Research
- News Analysis: "Source the newest published reports concerning Meta Platforms."
- Institutional Activity: "Detail the entities holding significant shares of Apple stock."
- Insider Trading: "What transactions have company insiders recently executed for Tesla?"
- Options Analysis: "Fetch the derivative contract listings for ticker SPY expiring on 2024-06-21, focusing only on call options."
- Analyst Coverage: "Summarize the official analyst ratings assigned to Amazon over the preceding three calendar months."
Investment Research
- "Develop a thorough assessment of Microsoft's fiscal solidity utilizing their most recently reported quarterly financial submissions."
- "Cross-reference the history of dividend payouts and stock restructuring events for Coca-Cola against PepsiCo."
- "Investigate and document the temporal shifts in ownership concentration for Tesla over the preceding year."
- "Generate a structured report detailing the recent derivative market dynamics for Apple stock contracts maturing in the next 30 days."
- "Provide a concise summary of the latest professional analyst endorsements and devaluations within the technology sector, limited to the past six months."
Requirements
- Python version 3.11 or later required
- Dependencies specified in
pyproject.toml, including: - mcp
- yfinance
- pandas
- pydantic
- supplementary packages for data transformation processes
Setup
-
Copy the repository contents: bash git clone https://github.com/Alex2Yang97/yahoo-finance-mcp.git cd yahoo-finance-mcp
-
Establish and activate a segregated execution environment, then load necessary libraries: bash uv venv source .venv/bin/activate # For Windows systems: .venv\Scripts\activate uv pip install -e .
Usage
Development Mode
To initiate testing of the service using the MCP Inspector utility, execute the following command:
bash uv run server.py
This action launches the backend and enables interaction with all exposed functionalities.
Integration with Claude for Desktop
To link this service with the local Claude application:
- Install the Claude Desktop application on your local computing station.
- Install VS Code on your local computing station. Then, execute the subsequent command to invoke the configuration file
claude_desktop_config.json: - MacOS:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json -
Windows:
code $env:AppData\Claude\claude_desktop_config.json -
Modify the configuration file for Claude Desktop, employing the structure below:
-
macOS:
{ "mcpServers": { "yfinance": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/yahoo-finance-mcp", "run", "server.py" ] } } }
-
Windows:
{ "mcpServers": { "yfinance": { "command": "uv", "args": [ "--directory", "C:\ABSOLUTE\PATH\TO\PARENT\FOLDER\yahoo-finance-mcp", "run", "server.py" ] } } }
-
Crucial Instruction: The full path to the
uvexecutable might need explicit specification within thecommandfield. Determine this path by executingwhich uv(on Unix-like systems) orwhere uv(on Windows). -
Relaunch the Claude Desktop application to apply the settings.
License
MIT
WIKIPEDIA: XMLHttpRequest (XHR) is an API in the form of a JavaScript object whose methods transmit HTTP requests from a web browser to a web server. The methods allow a browser-based application to send requests to the server after page loading is complete, and receive information back. XMLHttpRequest is a component of Ajax programming. Prior to Ajax, hyperlinks and form submissions were the primary mechanisms for interacting with the server, often replacing the current page with another one.
== History == The concept behind XMLHttpRequest was conceived in 2000 by the developers of Microsoft Outlook. The concept was then implemented within the Internet Explorer 5 browser (1999). However, the original syntax did not use the XMLHttpRequest identifier. Instead, the developers used the identifiers ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of Internet Explorer 7 (2006), all browsers support the XMLHttpRequest identifier. The XMLHttpRequest identifier is now the de facto standard in all the major browsers, including Mozilla's Gecko layout engine (2002), Safari 1.2 (2004) and Opera 8.0 (2005).
=== Standards === The World Wide Web Consortium (W3C) published a Working Draft specification for the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C published the Working Draft Level 2 specification. Level 2 added methods to monitor event progress, allow cross-site requests, and handle byte streams. At the end of 2011, the Level 2 specification was absorbed into the original specification. At the end of 2012, the WHATWG took over development and maintains a living document using Web IDL.
== Usage == Generally, sending a request with XMLHttpRequest has several programming steps.
Create an XMLHttpRequest object by calling a constructor: Call the "open" method to specify the request type, identify the relevant resource, and select synchronous or asynchronous operation: For an asynchronous request, set a listener that will be notified when the request's state changes: Initiate the request by calling the "send" method: Respond to state changes in the event listener. If the server sends response data, by default it is captured in the "responseText" property. When the object stops processing the response, it changes to state 4, the "done" state. Aside from these general steps, XMLHttpRequest has many options to control how the request is sent and how the response is processed. Custom header fields can be added to the request to indicate how the server should fulfill it, and data can be uploaded to the server by providing it in the "send" call. The response can be parsed from the JSON format into a readily usable JavaScript object, or processed gradually as it arrives rather than waiting for the entire text. The request can be aborted prematurely or set to fail if not completed in a specified amount of time.
== Cross-domain requests ==
In the early development of the World Wide Web, it was found possible to brea
