Back to MCP directory
publicPublicdnsLocal runtime

finance-mcp-server

一个基于Model Context Protocol的金融数据服务器,提供股票/加密货币的实时价格和新闻查询功能。

article

README

🚀 yfinance MCP 服务器

yfinance MCP 服务器基于模型上下文协议,允许大语言模型(LLM)获取准确且最新的股票及加密货币交易对的价格和新闻,为金融信息获取提供了高效的途径。

🚀 快速开始

本服务器借助模型上下文协议,让 LLM 能够精准获取股票和加密货币交易对的价格与新闻,为金融信息的获取提供了便利。

✨ 主要特性

  • 提供 get_price_toolget_news_tool 两个实用工具,方便获取价格和新闻。
  • 支持多种安装方式,包括通过 Smithery 自动安装、本地安装包安装以及使用 Docker 安装。
  • 可针对不同客户端(如 Claude Desktop 和 5ire)进行灵活配置。

📦 安装指南

使用 Smithery 安装

通过 Smithery 自动安装 yfinance-mcp-server 以供 Claude Desktop 使用:

npx -y @smithery/cli install @Otman404/finance-mcp-server --client claude

使用 uv 安装

本地安装包:

uv pip install -e .

运行服务器:

finance-mcp-server

使用 Docker 安装

# 构建容器
docker build -t finance-server .

# 运行容器
docker run -it finance-server

📚 详细文档

可用工具

get_price_tool

用于获取股票/加密货币交易对的价格。

  • 参数:
    • ticker(字符串):必需 - 交易对名称或别名(例如,“BTC-USD”,“AAPL”)
    • period(字符串):可选 - 时间范围(例如,“1d”,“5d”,“1mo”)。默认为“1d”

get_news_tool

用于获取股票/加密货币交易对的新闻。

  • 必需参数:
    • ticker(字符串):必需
    • count(字符串):可选 - 获取的文章数量(默认:5)

配置方法

用于 Claude Desktop

claude_desktop_config.json 中添加以下内容:

uvx 方式:
"mcpServers": {
  "finance": {
    "command": "uvx",
    "args": ["finance-mcp-server"]
  }
}
Docker 方式:
{
  "mcpServers": {
    "finance": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "finance-server"]
    }
  }
}

用于 5ire

uvx 方式:
{
  "key": "finance",
  "command": "uvx",
  "args": ["finance-mcp-server"]
}
Docker 方式:
{
  "key": "finance-server",
  "command": "docker",
  "args": ["run", "-i", "--rm", "finance-server"]
}

💻 使用示例

示例交互

example

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client