MCP server for yfinance
Project description
MCP Server YFinance
A Model Context Protocol (MCP) server that provides stock market data using YFinance.
Features
- Get basic stock information (price, market cap, sector, etc.)
- Fetch historical price data with customizable periods
- Retrieve analyst recommendations
- Download data for multiple stocks simultaneously
- Access dividend history
Usage
This MCP server can be used with various LLM applications that support the Model Context Protocol:
- Claude Desktop: Anthropic's desktop application for Claude
- Cursor: AI-powered code editor with MCP support
- Custom MCP clients: Any application implementing the MCP client specification
Usage with Claude Desktop
-
Install Claude Desktop from https://claude.ai/download
-
Open your Claude Desktop configuration:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the following configuration:
{
"mcpServers": {
"yfinance": {
"command": "uvx",
"args": [
"mcp-server-yfinance@latest"
]
}
}
}
- Restart Claude Desktop
Usage with VS Code
For quick installation, use one of the one-click installation buttons below:
For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open Settings (JSON).
Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.
Note that the
mcpkey is not needed in the.vscode/mcp.jsonfile.
UVX
{
"mcp": {
"servers": {
"yfinance": {
"command": "uvx",
"args": [
"mcp-server-yfinance@latest"
]
}
}
}
}
Available Tools
-
get_stock_info(ticker: str)- Get basic information about a stock
- Example:
get_stock_info("AAPL")
-
get_historical_data(ticker: str, period: str = "1mo", interval: str = "1d")- Get historical price data
- Periods: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max
- Intervals: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo
-
get_recommendations(ticker: str)- Get analyst recommendations for a stock
-
get_multiple_tickers(tickers: list[str], period: str = "1d")- Get data for multiple stocks at once
- Example:
get_multiple_tickers(["AAPL", "GOOGL"])
-
get_dividends(ticker: str)- Get dividend history for a stock
Development
To test the MCP server locally, install the uvx and npx and run the following command:
npx @modelcontextprotocol/inspector uvx mcp-server-yfinance@latest
This command will start the MCP server and open the MCP Inspector in your default web browser. You can then interact with the server and test its functionality.
License
AGPLv3+ License - see LICENSE for details.
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a pull request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_yfinance-0.1.0.dev38.tar.gz.
File metadata
- Download URL: mcp_server_yfinance-0.1.0.dev38.tar.gz
- Upload date:
- Size: 39.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d84b7c4888db69725ba369620897f722407647bcafd697e1c766ec9dad3a47d5
|
|
| MD5 |
33f967c6b37b1e060dbc80a5c1d20d86
|
|
| BLAKE2b-256 |
9f31864c83328e9864c64e88aea6e55c7410ea7f9c58fbfdd703eb279cf961f0
|
File details
Details for the file mcp_server_yfinance-0.1.0.dev38-py3-none-any.whl.
File metadata
- Download URL: mcp_server_yfinance-0.1.0.dev38-py3-none-any.whl
- Upload date:
- Size: 38.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62628f9f85c69f64f2da531147cad6e4e3679ca706da588f1fc4a7726d78f9d3
|
|
| MD5 |
22a084a351990f4bcb5ac395ecdb269f
|
|
| BLAKE2b-256 |
f76716ad946f7ecbf487f8331425185fdaffa163f57c6a8c13986431d52b8ce7
|