πŸ’Ή MCP YFinance Stock Server

by Adity-star

55 502 downloads Not rated yet MIT

About

Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard

Details

License
MIT

Explore

- Retrieve real-time stock prices
- Manage a personal watchlist (add, view prices)
- Perform 1-month technical trend analysis (RSI, MACD, MAs)
- Generate comprehensive technical summaries with indicators
- Analyze trend shifts, patterns, and divergences
- Compare stock prices for relative performance analysis

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name πŸ’Ή MCP YFinance Stock Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

We use uv β€” a modern, ultra-fast Python package manager β€” to manage our project environment.

Run the following commands in your terminal:


curl -LsSf https://astral.sh/uv/install.sh | sh

uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate

Once your pyproject.toml is set up with dependencies, run:


Once your environment is ready, start the stock server:
bash
uv run main.py
``
πŸ§ͺ Want a quick test first?
Try checking the tools first:
`bash
python run test_server_fun.py
`

πŸ“„ Curious how the full server works?

Explore the source code here:

πŸ”— yf_server.py β€Ί GitHub


---

To integrate your YFinance MCP server, add the following entry to your mcp.config.json file:

`json
{
"mcpServers": {
"yfinance-price-tracker": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/YOUR/mcp-yfinance-server",
"run",
"main.py"
]
}
}
}
``
> ⚠️ Replace /ABSOLUTE/PATH/TO/... with actual file paths.
> πŸ’‘ Tip: Rename your server from crypto-price-tracker to yfinance-price-tracker for clarity.

---

add_to_watchlist

Add a stock ticker to your personal watchlist.

analyze_stock

Perform a 1-month technical trend analysis (RSI, MACD, MAs)..

get_technical_summary

Generate a comprehensive technical summary including indicators & signals..

get_watchlist_prices

Fetch the most recent prices for all watchlisted tickers.

get_trend_analysiss

Analyze recent trend shifts, patterns, and divergences..

get_stock_price

Retrieve the current price for a given ticker symbol.

get_volatility_analysis

Calculate historical volatility and ATR metrics..

compare_stocks

Compare two stock prices (useful for relative performance analysis).

The server exposes many tools for AI agents and CLI users.
Here are some important tools, check out the complete tools list here:

| Tool Name | Description |
|-------------------------------|-----------------------------------------------------------------------------|
| add_to_watchlist | Add a stock ticker to your personal watchlist. |
| analyze_stock |Perform a 1-month technical trend analysis (RSI, MACD, MAs).. |
| get_technical_summary |Generate a comprehensive technical summary including indicators & signals.. |
| get_watchlist_prices | Fetch the most recent prices for all watchlisted tickers. |
| get_trend_analysiss | Analyze recent trend shifts, patterns, and divergences.. |
| get_stock_price | Retrieve the current price for a given ticker symbol. |
| get_volatility_analysis | Calculate historical volatility and ATR metrics.. |
| compare_stocks | Compare two stock prices (useful for relative performance analysis). |


> βœ… Total: 18 powerful tools to analyze and monitor stocks with precision.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "\ud83d\udcb9 mcp yfinance stock server": {
            "mcp-yfinance-server": {
                "command": "uv",
                "args": [
                    "init"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-yfinance-server": {
        "command": "uv",
        "args": [
            "init"
        ]
    }
}
Python MCP License Listed on Spark Install via Spark This project sets up a stock Price server powered by the Yahoo Finance (YFinance) API and built for seamless integration with MCP (Model Control Protocol). It allows AI agents or clients to: - Retrieve real-time stock data - Manage a watchlist - Perform full stock analysis - Run full technical indicators - And much more image ---

πŸͺ™ Start Simple: Build a Crypto Price Tracker First

Before diving into the full-blown stock server, I recommend starting with this simple crypto tracker built with Python + MCP πŸ‘‡ πŸ”— GitHub Repo: https://github.com/Adity-star/mcp-crypto-server > You'll learn how to: > - Use MCP to expose crypto tools like get_price("BTC") > - Build an API with FastAPI > - Fetch real-time prices using the Alpaca API

πŸ”— Related Projects

Explore more of my work: - GenAI-Learnings: A deep dive into Generative AI concepts, tools, and projects. - LangChain-Mastery: Everything you need to master LangChain for building powerful LLM applications. - Complete Data Science: A deep dive into Data Science AI concepts, tools, and projects and all the material for learning and interview preparation. - Reinforcement-Learning: Hands-on experiments and theory in Reinforcement Learning. - CompleteRAG: End-to-end implementation of Retrieval-Augmented Generation (RAG) systems. ---

πŸ“ˆ Then Level Up: Build the yFinance Stock Server

Once you're familiar with the flow, move on to this more advanced stock tracker πŸ’Ή πŸ”— GitHub Repo: https://github.com/Adity-star/mcp-yfinance-server πŸ“ Detailed Blog: πŸ‘‰ How I Built My Own Stock Server with Python, yFinance, and a Touch of Nerdy Ambition > Includes: > - Watchlists > - Real-time(ish) price updates > - Technical summaries > - A full-featured dashboard > - Trend + momentum indicators > - Watchlist management ---

πŸ“¦ Step 1: Set Up the Environment (with uv)

We use uv β€” a modern, ultra-fast Python package manager β€” to manage our project environment.

πŸ› οΈ Installation & Setup

Run the following commands in your terminal: ```bash
No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about πŸ’Ή MCP YFinance Stock Server

Relevant YouTube tutorials, setups, and demos