Access Real-Time Stock Data and Analysis
MCP YFinance Stock Server gives agents real-time stock prices, watchlist management, and full technical/volatility analysis tools.
1.0.0Add to Favorites
Why it matters
Integrate with Yahoo Finance to provide AI agents with real-time stock prices, watchlist management, and comprehensive technical analysis tools.
Outcomes
What it gets done
Retrieve current stock prices for any ticker.
Manage and retrieve prices for a custom stock watchlist.
Perform technical analysis including RSI, MACD, and MA.
Analyze stock trends and calculate volatility metrics.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-yfinance | bash Capabilities
Tools your agent gets
Add a stock ticker to your personal watchlist
Perform monthly technical analysis of trends (RSI, MACD, MA)
Create a comprehensive technical summary with indicators and signals
Get current prices for all tickers in your watchlist
Analyze recent trend changes, patterns, and divergences
Get the current price for a specified ticker symbol
Calculate historical volatility and ATR metrics
Compare prices of two stocks for relative performance analysis
Overview
yfinance MCP Server
MCP YFinance Stock Server exposes stock price, watchlist, and technical analysis tools to an AI agent, built on the Yahoo Finance API. It covers price lookups, comparisons, watchlist management, RSI/MACD trend analysis, and volatility/ATR risk metrics among its 18 tools. Use it when an agent needs live stock data plus derived technical or volatility analysis, or when Claude Desktop should chart the results directly. Prices are described by the project as real-time(ish), not guaranteed sub-second.
What it does
MCP YFinance Stock Server is a stock price server built on the Yahoo Finance (YFinance) API for MCP clients. It lets an AI agent retrieve real-time stock data, manage a personal watchlist, run full stock and technical analysis, and pull technical indicators, exposed through tools including get_stock_price (current price for a ticker), compare_stocks (compare two stocks for relative performance), add_to_watchlist and get_watchlist_prices (manage and fetch prices for a watchlist), analyze_stock (a one-month technical trend analysis covering RSI, MACD, and moving averages), get_technical_summary (a comprehensive summary combining indicators and signals), get_trend_analysiss (recent trend shifts, patterns, and divergences), and get_volatility_analysis (historical volatility and ATR metrics) - the project's own tool reference lists these among 18 tools total, with the README's example queries also naming a get_stock_history tool for pulling historical price data.
When to use - and when NOT to
Use it when an agent needs live or recent stock data plus derived analysis - technical indicators, trend detection, volatility or risk metrics, or side-by-side comparisons - rather than raw price lookups alone, or when you want Claude Desktop to fetch data and render it as a chart directly in the conversation. It's well suited to building a stock-tracking bot or financial dashboard incrementally, since the watchlist tools let you build up a tracked set of tickers over multiple calls. Skip it if you need guaranteed real-time, sub-second market data - the project itself describes prices as "real-time(ish)" - or if you'd rather start with something simpler first: the author explicitly recommends trying a companion crypto price tracker project before this fuller stock server, to learn the MCP plus FastAPI pattern on a smaller surface first.
Capabilities
- Real-time(ish) stock price lookups and multi-stock comparisons via
get_stock_priceandcompare_stocks. - Watchlist management: add tickers with
add_to_watchlistand fetch current prices for the whole list withget_watchlist_prices. - Technical analysis:
analyze_stockruns a one-month trend analysis (RSI, MACD, moving averages),get_technical_summaryproduces a combined indicators-and-signals summary, andget_trend_analysisssurfaces trend shifts and divergences. - Risk assessment via
get_volatility_analysis, calculating historical volatility and ATR metrics. - An interactive MCP Server Inspector (
mcp dev source/yf_server.py) to browse available tools and resources, test input/output per tool, and monitor real-time responses during development. - Claude Desktop can fetch data through the server and render it as a chart directly in the conversation, per the project's example queries.
How to install
Set up the environment with uv:
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create and navigate to your project directory
mkdir mcp-yfinance-server
cd mcp-yfinance-server
# Initialize a new project
uv init
# Create and activate the virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
Then, once pyproject.toml has its dependencies, install the project (uv pip install -e .) and start the server with uv run main.py. To wire it into an MCP client, add an entry to mcp.config.json:
{
"mcpServers": {
"yfinance-price-tracker": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/YOUR/mcp-yfinance-server",
"run",
"main.py"
]
}
}
}
Replace the placeholder path with the actual project directory, then restart Claude Desktop (or any MCP-based client) to load the new tools.
Who it's for
Developers and traders building a stock-tracking bot or financial dashboard who want technical analysis, trend detection, and volatility metrics available to an AI agent alongside basic price and watchlist tools, especially anyone already comfortable with the MCP and uv workflow from a smaller companion project. Licensed under MIT.
Source README
πΉ MCP YFinance Stock Server
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
πͺ 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:
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create and navigate to your project directory
mkdir mcp-yfinance-server
cd mcp-yfinance-server
# Initialize a new project
uv init
# Create and activate the virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
π₯ Install the project
Once your pyproject.toml is set up with dependencies, run:
# Run
uv pip install -e .
π Step 2: Running the MCP Server
Once your environment is ready, start the stock server:
uv run main.py
π§ͺ Want a quick test first?
Try checking the tools first:
python run test_server_fun.py
π Curious how the full server works?
Explore the source code here:
π οΈ MCP Tool Reference
The server exposes many tools for AI agents and CLI users.
Here are some important tools, check out the complete tools list here:
π¦ Tool List
| 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.
π§ Use Cases
These tools are ideal for:
- π Dynamic watchlist management
- π Trend and momentum detection
- π Deep-dive technical analysis for investment decisions
- β οΈ Volatility-based risk assessment
- π€ Powering stock-focused autonomous agents or dashboards
βοΈ Keep this reference handy for building intelligent financial applications with the MCP server.
π Step 3: Inspecting the MCP Server
Easily explore and test your MCP tools using the MCP Server Inspector.
Run the following command in your terminal:
$ mcp dev source/yf_server.py
This launches an interactive UI to:
- π§° View all available tools and resources
- π₯ Test input/output for each tool
- π‘ Monitor real-time responses from your server
βοΈ Step 4: Configure Your MCP Server
To integrate your YFinance MCP server, add the following entry to your mcp.config.json file:
{
"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.
π Step 5: Restart Claude Desktop
Restart Claude Desktop (or any interface that uses MCP) to reload and activate your new YFinance tools.
This ensures the updated MCP configuration is recognized and all stock tracking tools are
ready to use.
β Step 6: Testing the MCP Server with Claude Desktop
- With everything installed and configured, you're ready to test your MCP server in Claude Desktop.
Use these example queries to test your MCP YFinance Server in action:
"Compare the stock prices of Tesla and Apple."
β π§ Usescompare_stocks
"Get the historical data for Tesla over the past month."
β π Usesget_stock_history
"Add Apple, Tesla, and Reliance to my watchlist."
β π Usesadd_to_watchlist
"Show me a chart of Appleβs stock over the last 30 days."
β πΌοΈ Claude can fetch + visualize data using your server
π· Sample Chart:
πΌ view Screenshot
π Live Claude Site:
Open Demo on Claude.site
π§ͺ These tests ensure your MCP integration is working end-to-end-from data retrieval to real-time analysis and visualization.
π Results
βοΈ Outcomes You Can Expect
| Feature | Outcome |
|---|---|
| β Stock Analysis | Analyse stock giving price, OHLC, returns, volume, insights and data. |
| π Technical Analysis | Access indicators like RSI, MACD, MA, and a complete technical summary. |
| π Volatility Reports | Analyze stock risk with ATR and volatility metrics. |
| π Trend Analysis | Detect trend shifts and divergence using price movement analysis. |
| π§ Visualisations | 18+ tools ready to power AI agents or dashboards to visualise stock. |
| π Technical Charts | Analyse and monitor technical indicators for stocks in real-time. |
| πΌοΈ Visual Insights | Generate charts and visual summaries with Claude Desktop. |
π Ready to build your stock-tracking bot or intelligent financial dashboard? This project has all the core pieces.
π« Feedback & Contributions
Contributions are welcome! Whether you're fixing bugs, adding features, or improving documentation, your help makes this project better.
π Reporting Issues
If you encounter bugs or have suggestions, please open an issue in the Issues section. Be sure to include:
- β Steps to reproduce (if applicable)
- π Expected vs. actual behavior
- π· Screenshots or error logs (if relevant)
π¬ Submit a Pull Request
Have a fix or improvement? Head over to the Pull Requests section and submit your PR. Weβll review and merge it ASAP!
π¬ Spread the Word
If this project saved you from API rate limits or overpriced SaaS tools...
- π Star the repo
- π΄ Fork it and build your own crypto/stock tool
- π² Tag me on X @AdityaAkuskar - Iβd love to see what you build!
- π Connect with me on LinkedIn
π License
π Letβs build better tools together.
If youβd like a tweet thread, carousel, or launch post for this - Iβve got your back π
FAQ
Common questions
Trust
How it checks out
Discussion
Questions & comments Β· 0
Sign In Sign in to leave a comment.
