Learn how to set up a yfinance MCP server for financial data access in Claude Desktop
The yfinance MCP Server serves as an integral part of the Model Context Protocol (MCP) infrastructure, specifically designed to integrate financial data sources with AI applications such as Claude Desktop. This server utilizes the yfinance library to fetch and deliver real-time and historical stock market information, enhancing the capabilities of AI-driven decision-making processes.
The core feature of this MCP Server is its ability to seamlessly interface between AI applications like Claude Desktop and external data sources, leveraging the power of the yfinance library. Key features include:
The yfinance MCP Server operates on a client-server architecture where the server acts as an intermediary between AI applications and data repositories. The server implements the Model Context Protocol to enable secure and efficient data exchange, adhering to best practices outlined by Anthropic.
graph TD
A[AI Application] -->|MCP Client| B[MCP Server]
B --> C[yfinance API]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#fff6d9
style D fill:#e8f5e8
graph TD
R[Real-Time Data] --> Y[yfinance API]
H[Historical Data] --> Y
Y --> A[AI Application Interface]
A --> B[MCP Protocol]
B --> C[Databases/External APIs]
To set up the yfinance MCP Server, follow these steps:
Install Required Software and Libraries:
Clone the Repository:
git clone https://github.com/9nate-drake/mcp-yfinance
Install Dependencies:
pip install mcp yfinance
This MCP Server excels in providing financial data to support various AI workflows, such as:
Using the yfinance MCP Server in Claude Desktop allows users to monitor stock prices in real-time. For instance, querying "Get me the current stock price for MSFT" would return the latest Microsoft Corp. stock price directly from Yahoo Finance through the server.
To analyze the historical performance of a company like Apple Inc., one could use the following query:
import yfinance as yf
apple_data = yf.Ticker("AAPL")
historical_data = apple_data.history(period="3mo")
# Further processing can be done here to analyze the data
The yfinance MCP Server is compatible with various MCP clients, including:
MCP Client | Claude Desktop | Continue | Cursor |
---|---|---|---|
Resources | ✅ | ✅ | |
Tools | ✅ | ✅ | ✅ |
Prompts | ✅ | ✅ | ❌ |
Status | Full Support | Full Support | Tools Only |
The performance of the yfinance MCP Server can be gauged by its response times to various queries and data sizes. Here’s a sample compatibility matrix for different clients:
Client | Response Time (ms) | Data Size (KB) |
---|---|---|
Claude Desktop | ≤50 | 25-100 |
Continue | ≤75 | 50-128 |
Cursor | ≤100 | 64-96 |
Configuration options allow for fine-tuning the server to meet specific requirements:
{
"mcpServers": {
"yfinance": {
"command": "python",
"args": [
"/path/to/finance_server/server.py"
],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Can I use this server with other AI applications?
How can I securely integrate sensitive information like API keys?
Is real-time data available through this server?
Does this server support historical data queries?
Can I modify the server to add new financial metrics?
server.py
directly to include additional financial metrics and functions as needed.Contributions are welcome! If you plan to develop or enhance this MCP Server, consider the following guidelines:
Explore more about the Model Context Protocol and related resources on the official MCP documentation website. Engage with the broader community through forums or discussion boards for support and collaboration.
By integrating the yfinance MCP Server into your AI applications, you enhance their ability to process complex financial data efficiently, driving better-informed decisions in various sectors.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Connect your AI with your Bee data for seamless conversations facts and reminders
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Analyze search intent with MCP API for SEO insights and keyword categorization
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions