Enables deployment of the MCP server to Railway's cloud platform with automatic Docker detection and provides a public URL for remote access
Stock Data MCP Server
A Model Context Protocol (MCP) server that provides real-time stock market data through Yahoo Finance without requiring an API key. Get quotes, historical data, company information, financial statements, and more.
Features
🔍 Real-time Stock Quotes - Current prices, changes, volume, and market data
📊 Historical Data - OHLCV data with customizable periods and intervals
🏢 Company Information - Detailed company profiles, sectors, and metrics
💰 Financial Statements - Income statements, balance sheets, and cash flow
🔎 Ticker Search - Find ticker symbols by company name
🆓 No API Key Required - Uses public Yahoo Finance data via yfinance
🚀 Railway Ready - Deploy to Railway.app with one click
Available Tools
1. get_stock_quote
Get current stock price and trading data.
Parameters:
symbol
(string, required): Stock ticker symbol (e.g., "AAPL", "MSFT")response_format
(string, optional): "markdown" or "json" (default: "markdown")
Example:
2. get_stock_info
Get comprehensive company information and metrics.
Parameters:
symbol
(string, required): Stock ticker symbolresponse_format
(string, optional): "markdown" or "json"
Example:
3. get_stock_history
Get historical price and volume data.
Parameters:
symbol
(string, required): Stock ticker symbolperiod
(string, optional): "1d", "5d", "1mo", "3mo", "6mo", "1y", "2y", "5y", "10y", "ytd", "max" (default: "1mo")interval
(string, optional): "1m", "5m", "1h", "1d", "1wk", "1mo", etc. (default: "1d")response_format
(string, optional): "markdown" or "json"
Example:
4. get_stock_financials
Get company financial statements.
Parameters:
symbol
(string, required): Stock ticker symbolstatement_type
(string, optional): "income", "balance", "cashflow" (default: "income")quarterly
(boolean, optional): true for quarterly, false for annual (default: false)response_format
(string, optional): "markdown" or "json"
Example:
5. search_ticker
Search for ticker symbols by company name.
Parameters:
query
(string, required): Company name or partial nameresponse_format
(string, optional): "markdown" or "json"
Example:
Local Development
Prerequisites
Python 3.11 or higher
pip
Installation
Clone this repository:
Install dependencies:
Run the server locally (stdio mode):
Testing with MCP Inspector
This opens a web interface where you can test all the tools interactively.
Railway Deployment
Quick Deploy
Push to GitHub:
Deploy to Railway:
Go to railway.app
Click "New Project" → "Deploy from GitHub repo"
Select your repository
Railway will automatically detect the Dockerfile and deploy
Get Your Server URL:
Once deployed, Railway provides a public URL like:
https://your-app.railway.app
Copy this URL for Claude Desktop configuration
Environment Variables
No environment variables required! This server doesn't need API keys because it uses public Yahoo Finance data.
Railway automatically sets the PORT
variable - don't override it.
Claude Desktop Integration
After deploying to Railway, add this to your Claude Desktop config:
Config location:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
Linux:
~/.config/Claude/claude_desktop_config.json
Configuration:
Replace your-app.railway.app
with your actual Railway URL.
Restart Claude Desktop after saving the configuration.
Docker Usage
Build the Image
Run Locally
Test the Server
Usage Examples
Get Apple Stock Quote
Request to Claude:
"What's the current price of Apple stock?"
Behind the scenes:
Claude calls get_stock_quote
with {"symbol": "AAPL"}
Analyze Tesla Financials
Request to Claude:
"Show me Tesla's latest income statement"
Behind the scenes:
Claude calls get_stock_financials
with {"symbol": "TSLA", "statement_type": "income"}
Compare Historical Performance
Request to Claude:
"Compare the 6-month performance of NVIDIA and AMD"
Behind the scenes:
Claude calls get_stock_history
multiple times and analyzes the data
Troubleshooting
"Unable to fetch data for symbol"
Verify the ticker symbol is correct
Use
search_ticker
to find the right symbolSome international stocks may not be available
Railway Deployment Issues
Check Railway logs in the dashboard
Verify the Dockerfile builds successfully locally
Ensure you're not setting the PORT environment variable manually
Claude Desktop Connection Issues
Verify the URL has no trailing slash
Confirm
transport
is set to"streamable-http"
Check Claude Desktop logs (Help → View Logs)
Restart Claude Desktop after config changes
Data Source
This server uses yfinance, an open-source library that retrieves data from Yahoo Finance. The data is provided for informational purposes only and should not be used for trading decisions without verification.
Data Limitations:
Real-time data may have a 15-20 minute delay
Some international stocks may have limited data
Historical data availability varies by symbol
Financial statements may not be available for all companies
Architecture
Transport: SSE (Server-Sent Events) for Railway, stdio for local development Framework: FastMCP (MCP Python SDK) Data Validation: Pydantic v2 Stock Data: yfinance (Yahoo Finance API wrapper)
License
MIT License - See LICENSE file for details
Contributing
Contributions welcome! Please:
Fork the repository
Create a feature branch
Make your changes
Submit a pull request
Support
For issues or questions:
Open an issue on GitHub
Check the MCP documentation
Review Railway's deployment guides
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Provides real-time stock market data through Yahoo Finance without requiring an API key. Get quotes, historical data, company information, financial statements, and ticker search capabilities.