- Yahoo Fianace MCP
Yahoo Fianace MCP
Yahoo Finance MCP
Provides a Model Context Protocol (MCP) server that exposes various functions from the yfinance library as individual tools.
Installation & Setup
This server is run directly from the cloned repository.
-
Install uv: If you don't have
uv, install it first:curl -LsSf https://astral.sh/uv/install.sh | sh -
Clone the repository:
git clone git@github.com:a05031113/yahoo-fianace-mcp.git cd yahoo-finance-mcp # Adjust if your directory name is different -
Setup the virtual environment:
uv venv source .venv/bin/activate # On macOS/Linux. Use relevant activate script for Windows. -
Install dependencies:
uv pip install -r requirements.txt
Run the MCP Server
The server uses stdio for communication. Run it directly using the Python interpreter from the activated virtual environment:
python main.py
The server will start, print logs to stderr, and listen for JSON-RPC requests on stdin.
Using Yahoo Finance MCP from Clients
You need to configure your MCP client (e.g., Cursor, Claude Desktop) to execute the main.py script.
Using from Cursor / Claude Desktop (via mcp.json)
- For project-only configuration: create a
.cursor/mcp.jsonfile in your project's root directory. - For global configuration: create or edit
~/.cursor/mcp.json(macOS/Linux) or%USERPROFILE%\.cursor\mcp.json(Windows).
Add the following configuration, making sure to use the correct absolute paths for your system:
{
"mcpServers": {
"yahoo_finance_engine": {
"command": "/Users/yanghaoyu/Documents/mcp/yahoo-finance/.venv/bin/python",
"args": [
"/Users/yanghaoyu/Documents/mcp/yahoo-finance/main.py"
],
"transport": "stdio",
"workingDirectory": "/Users/yanghaoyu/Documents/mcp/yahoo-finance"
}
// Add other servers here if needed
}
}
(Note: Ensure the paths in command, args, and workingDirectory are correct for the machine running the client/server.)
Development
Follow the steps in the Installation & Setup section above to prepare the development environment (clone, create/activate venv, install dependencies).
You can then run the server directly for testing:
python main.py
Check the output on stderr for logs and potential errors during startup or request handling.
Server Config
{
"mcpServers": {
"yahoo_finance_engine": {
"command": "/path/to/your/yahoo-finance/.venv/bin/python",
"args": [
"/path/to/your/yahoo-finance/main.py"
]
}
}
}