Stock market data provider for Claude Desktop using MCP
What is twolven mcp stockflow
StockFlow MCP Server
A Model Context Protocol (MCP) server providing real-time stock data and options analysis through Yahoo Finance. Enables LLMs to access market data, analyze stocks, and evaluate options strategies.
Features
Stock Data
- Real-time stock prices and key metrics
- Historical price data with OHLC values
- Company fundamentals and financial statements
- Market indicators and ratios
Options Analysis
- Complete options chain data
- Greeks (delta, gamma, theta, vega)
- Volume and open interest tracking
- Options strategy analysis
Installation
# Install dependencies
pip install mcp yfinance
# Clone the repository
git clone https://github.com/twolven/stockflow
cd stockflow
Usage
- Clone the repository:
git clone https://github.com/twolven/mcp-stockflow.git
cd mcp-stockflow
- Install dependencies:
pip install -r requirements.txt
- Add to your Claude configuration:
In your
claude-desktop-config.json
, add the following to themcpServers
section:
{
"mcpServers": {
"stockflow": {
"command": "python",
"args": ["path/to/stockflow.py"]
}
}
}
Replace "path/to/stockflow.py" with the full path to where you saved the stockflow.py file.
Usage Prompt for Claude
When working with Claude, you can use this prompt to help it understand the available tools:
"I've enabled the stockflow tools which give you access to stock market data. You can use these three main functions:
get_stock_data
- Get comprehensive stock info:
{
"symbol": "AAPL",
"include_financials": true, # optional
"include_analysis": true, # optional
"include_calendar": true # optional
}
get_historical_data
- Get price history and technical indicators:
{
"symbol": "AAPL",
"period": "1y", # 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max
"interval": "1d", # 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo
"prepost": false # optional - include pre/post market data
}
get_options_chain
- Get options data:
{
"symbol": "AAPL",
"expiration_date": "2024-12-20", # optional - uses nearest date if not specified
"include_greeks": true # optional
}
All responses include current price data, error handling, and comprehensive market information."
Running the Server
python stockflow.py
Using with MCP Client
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
server_params = StdioServerParameters(
command="python",
args=["stockflow.py"]
)
async def run():
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Get current stock data
result = await session.call_tool(
"get-stock-data",
arguments={"symbol": "AAPL"}
)
# Get options chain
options = await session.call_tool(
"get-options-chain",
arguments={
"symbol": "AAPL",
"expiration_date": "2024-12-20"
}
)
if __name__ == "__main__":
import asyncio
asyncio.run(run())
Available Tools
-
get-stock-data
- Current price and volume
- Market cap and P/E ratio
- 52-week high/low
-
get-historical-data
- OHLC prices
- Configurable time periods
- Volume data
-
get-options-chain
- Calls and puts
- Strike prices
- Greeks and IV
- Volume and open interest
Available Resources
-
company-info://{symbol}
- Company description
- Sector and industry
- Employee count
- Website
-
financials://{symbol}
- Income statement
- Balance sheet
- Cash flow statement
Prompts
analyze-options
- Options strategy analysis
- Risk/reward evaluation
- Market condition assessment
Requirements
- Python 3.12+
- mcp
- yfinance
Limitations
- Data is sourced from Yahoo Finance and may have delays
- Options data availability depends on market hours
- Rate limits apply based on Yahoo Finance API restrictions
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Todd Wolven - (https://github.com/twolven)
Acknowledgments
Acknowledgments
- Built with the Model Context Protocol (MCP) by Anthropic
- Data provided by Yahoo Finance
- Developed for use with Anthropic's Claude
Leave a Comment
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
chrisdoc hevy mcp
sylphlab pdf reader mcp
An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.
aashari mcp server atlassian bitbucket
Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.
aashari mcp server atlassian confluence
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.
prisma prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Zzzccs123 mcp sentry
mcp sentry for typescript sdk
zhuzhoulin dify mcp server
zhongmingyuan mcp my mac
zhixiaoqiang desktop image manager mcp
MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)
zhixiaoqiang antd components mcp
An MCP service for Ant Design components query | 一个减少 Ant Design 组件代码生成幻觉的 MCP 服务,包含系统提示词、组件文档、API 文档、代码示例和更新日志查询
Submit Your MCP Server
Share your MCP server with the community
Submit Now