Skip to main content

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

  1. Install Claude Desktop from https://claude.ai/download

  2. Open your Claude Desktop configuration:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  3. Add the following configuration:

{
  "mcpServers": {
    "yfinance": {
      "command": "uvx",
      "args": [
        "mcp-server-yfinance@latest"
      ]
    }
  }
}
  1. Restart Claude Desktop

Available Tools

  1. get_stock_info(ticker: str)

    • Get basic information about a stock
    • Example: get_stock_info("AAPL")
  2. 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
  3. get_recommendations(ticker: str)

    • Get analyst recommendations for a stock
  4. get_multiple_tickers(tickers: list[str], period: str = "1d")

    • Get data for multiple stocks at once
    • Example: get_multiple_tickers(["AAPL", "GOOGL"])
  5. 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

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a pull request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_yfinance-0.1.0.dev37.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_yfinance-0.1.0.dev37-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_yfinance-0.1.0.dev37.tar.gz.

File metadata

File hashes

Hashes for mcp_server_yfinance-0.1.0.dev37.tar.gz
Algorithm Hash digest
SHA256 c77afd711499739bc8f15bf93ff017fb1598256cc3e1fd503f462bd8142c2f16
MD5 525c69e80f1553ce7022a7cb55b951e1
BLAKE2b-256 04a07c18d026f5973828ef3622b0fc64cb8fb2f6e7ee424e733942b0ffd72838

See more details on using hashes here.

File details

Details for the file mcp_server_yfinance-0.1.0.dev37-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_yfinance-0.1.0.dev37-py3-none-any.whl
Algorithm Hash digest
SHA256 cc176c8dceed82f63a531c120e5b098d401deb4b34a20184d0b8a2628c5a577b
MD5 aefad7dc4cd41507e28f982656f995ec
BLAKE2b-256 9ce1ddf2934256cf3ac8b88499d3d2472f9f6e7e774d1e91765d15fc36c4618a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page