YFinance Trader MCP server

Provides real-time stock market data and trading capabilities through yfinance, offering tools for retrieving quotes, company overviews, historical prices, symbol searches, analyst recommendations, and insider transactions.
Back to servers
Setup instructions
Provider
SaintDoresh
Release date
Apr 04, 2025
Language
Python
Stats
22 stars

The YFinance Trader MCP Tool provides real-time stock market data and trading capabilities for Claude Desktop, allowing you to access financial information directly through the Claude interface using the yfinance library.

Installation and Setup

Prerequisites

  • Python 3.10 or higher

Installing Dependencies

Install the required dependencies using pip:

pip install -r requirements.txt

Configuring Claude Desktop

  1. Add the following configuration to your Claude Desktop MCP settings:
{
  "mcpServers": {
    "yfinance-trader": {
      "command": "py",
      "args": ["-3.13", "path/to/your/main.py"]
    }
  }
}
  1. Replace path/to/your/main.py with the full absolute path to the main.py file
  2. Restart Claude Desktop if necessary

Available Tools and Usage

Get Stock Quote

Retrieves real-time stock quote information:

{
    "symbol": "AAPL",
    "price": 150.25,
    "change": 2.5,
    "changePercent": 1.67,
    "volume": 1234567,
    "timestamp": "2024-03-20T10:30:00"
}

Get Company Overview

Provides company information and key financial metrics:

{
    "name": "Apple Inc.",
    "sector": "Technology",
    "industry": "Consumer Electronics",
    "marketCap": 2500000000000,
    "peRatio": 25.4,
    "forwardPE": 24.2,
    "dividendYield": 0.65,
    "52WeekHigh": 182.94,
    "52WeekLow": 124.17
}

Get Time Series Daily

Retrieves historical daily price data:

{
    "symbol": "AAPL",
    "timeSeriesDaily": [
        {
            "date": "2024-03-20T00:00:00",
            "open": 150.25,
            "high": 152.30,
            "low": 149.80,
            "close": 151.75,
            "volume": 12345678
        }
        // ... more data points
    ]
}

Search Symbol

Searches for stocks and other securities:

{
    "results": [
        {
            "symbol": "AAPL",
            "name": "Apple Inc.",
            "type": "EQUITY",
            "exchange": "NASDAQ"
        }
        // ... more results
    ]
}

Get Recommendations

Retrieves analyst recommendations for a stock:

{
    "symbol": "AAPL",
    "recommendations": [
        {
            "period": "2024-03-15T00:00:00",
            "strongBuy": 15,
            "buy": 20,
            "hold": 8,
            "sell": 2,
            "strongSell": 0
        }
        // ... more periods
    ]
}

Get Insider Transactions

Provides insider trading information:

{
    "symbol": "AAPL",
    "transactions": [
        {
            "date": "2024-03-15T00:00:00",
            "insider": "John Doe",
            "position": "Director",
            "transactionType": "Buy",
            "shares": 1000,
            "value": 150250.00,
            "url": "https://finance.yahoo.com/...",
            "text": "Purchase of 1000 shares",
            "startDate": "2024-03-15",
            "ownership": "Direct"
        }
        // ... more transactions
    ]
}

Example Queries

You can ask Claude Desktop questions like:

  • "What is the current stock price and daily change for AAPL?"
  • "Can you give me a company overview for Microsoft (MSFT)?"
  • "Show me the historical price data for Tesla (TSLA) over the last 3 months."
  • "Search for stocks related to 'NVDA'."
  • "What are the analyst recommendations for Amazon (AMZN)?"
  • "Have there been any recent insider transactions for Google (GOOGL)?"

Cryptocurrency Support

Limited cryptocurrency data is available using special ticker formats:

  • BTC-USD for Bitcoin
  • ETH-USD for Ethereum
  • DOGE-USD for Dogecoin

Troubleshooting

If you encounter issues with the MCP server in Claude Desktop:

  1. Verify the server is running (you should see output when starting the script)
  2. Check that the path in your settings is correct and absolute
  3. Ensure Python 3.10+ is in your system PATH
  4. Confirm all dependencies are installed correctly
  5. Try restarting Claude Desktop
  6. Check logs for any error messages

For a more detailed guide, check out the tutorial on Medium: Using Claude Desktop with YFinance Trader MCP Tool to Access Real-Time Stock Market Data

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "yfinance-trader" '{"command":"py","args":["-3.13","path/to/your/main.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "yfinance-trader": {
            "command": "py",
            "args": [
                "-3.13",
                "path/to/your/main.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "yfinance-trader": {
            "command": "py",
            "args": [
                "-3.13",
                "path/to/your/main.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later