Yahoo Finance MCP Server
A Model Context Protocol (MCP) server that provides real-time stock data, historical prices, news, and comparison features using Yahoo Finance data. Built following Dedalus Labs server guidelines with streamable HTTP transport as the primary method.
Features
Real-time Quotes: Get current stock prices and market data
Historical Data: Retrieve OHLCV data for any time range
News: Fetch latest news headlines for any ticker
Comparison: Compare multiple stocks side by side
Streamable HTTP Transport: Modern HTTP transport for production deployment
STDIO Transport: Development-friendly transport for local testing
Session Management: Proper session handling for HTTP connections
Health Checks: Built-in health monitoring endpoints
Architecture
This server follows the Dedalus Labs MCP Server Guidelines with:
Modular Architecture: Clear separation of concerns with dedicated modules
Streamable HTTP First: Modern HTTP transport as the primary interface
Type Safety: Full TypeScript coverage with proper interfaces
Production Ready: Built-in error handling, logging, and configuration management
Testable: Dependency injection and isolated components
Directory Structure
MCP Tools
1. get_quote
Get current price and market snapshot for a stock.
Parameters:
ticker(string, required): Stock ticker symbol (e.g., AAPL, GOOGL, MSFT)
Example:
Response:
2. get_historical_data
Get historical OHLCV data for a stock.
Parameters:
ticker(string, required): Stock ticker symbolrange(string, optional): Time range -1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max(default:1mo)interval(string, optional): Data interval -1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo(default:1d)
3. get_news
Get latest news headlines for a stock.
Parameters:
ticker(string, required): Stock ticker symbollimit(number, optional): Number of news items (1-50, default: 5)
4. compare_stocks
Compare multiple stocks side by side.
Parameters:
tickers(array, required): Array of stock ticker symbols (2-10 tickers)
Installation
Clone the repository:
Install dependencies:
Build the project:
Usage
STDIO Transport (Development)
For local development and testing:
HTTP Transport (Production)
For production deployment with streamable HTTP:
Command Line Options
Configuration
Environment Variables
PORT: HTTP server port (default: 8080)NODE_ENV: Set to 'production' for production mode
Client Configuration
For MCP clients, use this configuration:
For backward compatibility with SSE:
Testing
Run Comprehensive Tests
Health Monitoring
Development
Available Scripts
npm run build: Compile TypeScript to JavaScriptnpm run watch: Watch mode for developmentnpm start: Start HTTP servernpm run start:stdio: Start STDIO servernpm run dev: Build and start HTTP servernpm run dev:stdio: Build and start STDIO server
Project Structure
The server follows the Dedalus Labs guidelines with:
Modular Design: Each component has a specific responsibility
Transport Abstraction: Easy switching between HTTP and STDIO
Configuration Management: Environment-based configuration
Error Handling: Comprehensive error handling throughout
Type Safety: Full TypeScript coverage
Production Deployment
Docker Deployment
Environment Setup
Dependencies
@modelcontextprotocol/sdk: Official MCP SDK (v1.17.3+)
yahoo-finance2: Yahoo Finance API client
dotenv: Environment variable management
License
MIT License
Contributing
Fork the repository
Create a feature branch
Make your changes following the Dedalus Labs guidelines
Add tests if applicable
Submit a pull request
Support
For issues and questions, please open an issue on the GitHub repository.
References
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Provides real-time stock quotes, historical price data, financial news, and multi-stock comparisons using Yahoo Finance data. Enables users to access comprehensive financial market information through natural language queries.