YFinance Trader MCP Tool
适用于 Claude 桌面的 YFinance Trader MCP 工具
一种 MCP(模型上下文协议)工具,使用 yfinance 库提供股票市场数据和交易功能,专门针对 Claude Desktop 进行调整。
图片来源:本项目灵感源自 Luigi Ajah 的mcp-stocks ,后者是 Cursor 的一个类似实现。本次改编修改了原始概念,使其能够与 Claude Desktop 兼容。
教程
有关设置和使用此工具的详细指南,请查看我们的 Medium 教程: 教程:使用 Claude Desktop 和 YFinance Trader MCP 工具访问实时股票市场数据
Related MCP server: Agentic-Investor
特征
实时股票报价
公司信息和财务指标
历史价格数据
符号搜索功能
分析师建议
内幕交易追踪
设置
确保安装了 Python 3.10 或更高版本
安装依赖项:
pip install -r requirements.txt与 Claude Desktop 集成
通过将以下内容添加到您的 MCP 配置中,在 Claude Desktop 中配置您的 MCP 设置:
{
"mcpServers": {
"yfinance-trader": {
"command": "py",
"args": ["-3.13", "path/to/your/main.py"]
}
}
}将路径替换为 main.py 文件的完整路径
如果需要,重新启动 Claude Desktop
可用工具
1. 获取股票报价
获取实时股票报价信息:
{
"symbol": "AAPL",
"price": 150.25,
"change": 2.5,
"changePercent": 1.67,
"volume": 1234567,
"timestamp": "2024-03-20T10:30:00"
}2. 获取公司概览
获取公司信息和关键指标:
{
"name": "Apple Inc.",
"sector": "Technology",
"industry": "Consumer Electronics",
"marketCap": 2500000000000,
"peRatio": 25.4,
"forwardPE": 24.2,
"dividendYield": 0.65,
"52WeekHigh": 182.94,
"52WeekLow": 124.17
}3. 获取每日时间序列
获取历史每日价格数据:
{
"symbol": "AAPL",
"timeSeriesDaily": [
{
"date": "2024-03-20T00:00:00",
"open": 150.25,
"high": 152.30,
"low": 149.80,
"close": 151.75,
"volume": 12345678
}
// ... more data points
]
}4. 搜索符号
搜索股票和其他证券:
{
"results": [
{
"symbol": "AAPL",
"name": "Apple Inc.",
"type": "EQUITY",
"exchange": "NASDAQ"
}
// ... more results
]
}5. 获取建议
获取股票分析师的建议:
{
"symbol": "AAPL",
"recommendations": [
{
"period": "2024-03-15T00:00:00",
"strongBuy": 15,
"buy": 20,
"hold": 8,
"sell": 2,
"strongSell": 0
}
// ... more periods
]
}6. 获取内部交易
获取内幕交易信息:
{
"symbol": "AAPL",
"transactions": [
{
"date": "2024-03-15T00:00:00",
"insider": "John Doe",
"position": "Director",
"transactionType": "Buy",
"shares": 1000,
"value": 150250.00,
"url": "https://finance.yahoo.com/...",
"text": "Purchase of 1000 shares",
"startDate": "2024-03-15",
"ownership": "Direct"
}
// ... more transactions
]
}示例查询
您可以向 Claude Desktop 询问以下问题:
“AAPL 的当前股价和每日变化是多少?”
“您能给我介绍一下微软(MSFT)的公司概况吗?”
“显示过去 3 个月特斯拉 (TSLA) 的历史价格数据。”
“搜索与‘NVDA’相关的股票。”
“分析师对亚马逊(AMZN)的建议是什么?”
“谷歌(GOOGL)最近有内幕交易吗?”
加密货币支持
有限的加密货币数据可通过特殊的股票代码格式获得:
BTC-USD 比特币
ETH-USD 代表以太坊
DOGE-USD 为狗狗币
错误处理
所有工具都包含适当的错误处理,如果出现问题,将返回错误消息:
{
"error": "Failed to fetch quote for INVALID_SYMBOL"
}故障排除
如果 MCP 服务器在 Claude Desktop 中无法运行:
确保服务器正在运行 - 启动脚本时您应该看到输出
验证设置中的路径是否正确且绝对
确保 Python 3.10+ 位于你的系统 PATH 中
检查所有依赖项是否已安装
尝试重启 Claude Desktop
检查日志中是否有任何错误消息
与原始 mcp-stocks 项目的区别
直接使用 MCP 库,而不是 FastAPI
适用于 Claude Desktop 而非 Cursor
修改错误处理和响应格式
更新的配置方法
执照
MIT 许可证
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables querying Yahoo Finance data including stock prices, historical data, financial statements, dividends, news, analyst recommendations, and company information through the yfinance library.
- AlicenseAqualityDmaintenanceProvides comprehensive financial analysis and real-time market data including stock information, options chains, technical indicators, financial statements, earnings calendars, and market sentiment indicators through integration with yfinance and other financial APIs.14MIT
- FlicenseAqualityDmaintenanceProvides stock market data and analysis tools using the Finnhub API, including stock prices, financial metrics, news, and historical data.67
- FlicenseNot gradedqualityDmaintenanceProvides real-time stock data, historical analysis, and stock comparisons using the Yahoo Finance API.
Related MCP Connectors
Real-time news with bias scoring, live market data, and AI-powered options pricing
Real-time market data, screeners, technical analysis & backtesting for stocks, crypto and forex.
Provide access to Chinese stock market data including historical prices, real-time data, news, and…
Appeared in Searches
- A server for the yfinance Python library for downloading financial market data
- Prediction of Indian Share Market Trends for the Coming Week
- A platform for live probability option trading with indicators across multiple markets
- Live Option Recommendations for Trading or Investing
- A server for obtaining historical cryptocurrency market data
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/SaintDoresh/YFinance-Trader-MCP-ClaudeDesktop'
If you have feedback or need assistance with the MCP directory API, please join our Discord server