- Home
- MCP servers
- MCP YFinance Stock Server
MCP YFinance Stock Server
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"sauniket-mcp-yfinance-server": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/YOUR/mcp-yfinance-server",
"run",
"main.py"
]
}
}
}You can run a Python-based MCP server that leverages Yahoo Finance data to provide real-time stock quotes, watchlists, and comprehensive technical analyses. This server is designed to plug into your MCP-enabled clients or AI agents, delivering powerful market insights and easy data access.
How to use
Start by launching your MCP server locally, then connect your MCP client to request stock prices, add and view a watchlist, and run technical analyses. Use the available tools to fetch current prices, compare stocks, generate technical summaries, and visualize trends. You can perform actions like getting the current price for a ticker, updating your watchlist, and requesting detailed technical analyses that combine indicators such as RSI, MACD, and moving averages. Build dashboards or chat-enabled workflows that drive decision-making with up-to-date market signals.
How to install
Prerequisites: you need Python tooling and a modern Python package manager. You will also use a specialized MCP tool runner called uv to manage the project environment.
- Install uv
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
- Create and enter your project directory
# Create and navigate to your project directory
mkdir mcp-yfinance-server
cd mcp-yfinance-server
- Initialize the project
# Initialize a new project
uv init
- Create and activate the virtual environment
# Create and activate the virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install the project dependencies
# Install the project in editable mode
uv pip install -e .
Running the MCP Server
With the environment prepared, start the stock server using the following command.
uv run main.py
If you want to perform a quick self-test of the server tooling before full usage, run this test script.
python run test_server_fun.py
Configuration and startup details
Configure your MCP client to connect to the YFinance MCP server by defining the MCP server entry in your mcp.config.json. The example below shows how to register a local stdio server that runs with uv and points to your server entry point.
{
"mcpServers": {
"yfinance_price": {
"type": "stdio",
"name": "yfinance_price",
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/YOUR/mcp-yfinance-server",
"run",
"main.py"
]
}
}
}
Notes on server configuration and usage
Replace the directory path with the actual location of your MCP YFinance server project. This setup uses a local stdio server via uv, which allows you to start the server from your machine and connect via MCP clients or interfaces that support the MCP protocol.
Troubleshooting and tips
If you encounter issues starting the server, ensure the virtual environment is activated, dependencies are installed, and the Python path points to your project. Check that the main entry point (main.py) exists in your project directory and that the uv command has access to that file.
Available tools
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).
get_stock_history
Retrieve historical price data for a ticker over a specified period.