模型上下文协议股票工具
一种模型上下文协议服务器,提供与雅虎财经互动的工具,允许用户检索股票价格、公司信息并进行财务数据比较。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"yahoo-finance": {
"args": [
"mcp-yahoo-finance"
],
"command": "uvx"
}
}
}
可用工具 (9 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
get_current_stock_price
Get the current stock price based on stock symbol.
该工具无需必填参数,直接调用即可
get_stock_price_by_date
Get the stock price for a given stock symbol on a specific date.
该工具无需必填参数,直接调用即可
get_stock_price_date_range
Get the stock prices for a given date range for a given stock symbol.
该工具无需必填参数,直接调用即可
get_historical_stock_prices
Get historical stock prices for a given stock symbol.
该工具无需必填参数,直接调用即可
get_dividends
Get dividends for a given stock symbol.
该工具无需必填参数,直接调用即可
get_income_statement
Get income statement for a given stock symbol.
该工具无需必填参数,直接调用即可
get_cashflow
Get cashflow for a given stock symbol.
该工具无需必填参数,直接调用即可
get_earning_dates
Get earning dates.
该工具无需必填参数,直接调用即可
get_news
Get news for a given stock symbol.
该工具无需必填参数,直接调用即可
服务介绍
MCP 雅虎财经
一个用于与雅虎财经交互的模型上下文协议 (MCP) 服务器。该服务器提供了获取定价、公司信息等功能的工具。
请注意,
mcp-yahoo-finance目前处于早期开发阶段。随着我继续开发和改进服务器,其功能和可用工具可能会发生变化和扩展。
安装
如果你使用的是 uv,则无需手动安装 mcp-yahoo-finance。我们将使用 uvx 直接运行 mcp-yahoo-finance。
如果你只是想使用 MCP 服务器,我建议你使用这种方法。
使用 pip
使用 pip。
sh
pip install mcp-yahoo-finance
使用 Git
你也可以在将仓库克隆到你的机器后安装该包。
sh
git clone git@github.com:maxscheijen/mcp-yahoo-finance.git
cd mcp-yahoo-finance
uv sync
配置
Claude 桌面版
在你的 claude_desktop_config.json 中添加以下内容:
json
{
"mcpServers": {
"yahoo-finance": {
"command": "uvx",
"args": ["mcp-yahoo-finance"]
}
}
}
你也可以使用 Docker:
json
{
"mcpServers": {
"yahoo-finance": {
"command": "docker",
"args": ["run", "-i", "--rm", "IMAGE"]
}
}
}
VSCode
在你的 .vscode/mcp.json 中添加以下内容:
json
{
"servers": {
"yahoo-finance": {
"command": "uvx",
"args": ["mcp-yahoo-finance"]
}
}
}
示例问题
- "苹果公司的股票价格是多少?"
- "苹果和谷歌的股票价格有什么区别?"
- "苹果公司的股票价格在2024-01-01至2025-01-01期间变化了多少?"
构建
Docker:
sh
docker build -t [IMAGE] .
使用 MCP Inspector 测试
sh
npx @modelcontextprotocol/inspector uv run mcp-yahoo-finance
致谢
- 原始项目由 Max Scheijen 创建