用途
该 MCP 服务器用于让人工智能助手(如 Claude)通过 Model Context Protocol 接口访问 Financial Datasets 提供的股市数据。借助该服务器,AI 助手可以检索公司的财务报表、股价和市场新闻,以及加密货币相关的价格数据。
主要能力(可用工具)
服务器提供以下工具:
- get_income_statements:获取某公司的利润表。
- get_balance_sheets:获取某公司的资产负债表。
- get_cash_flow_statements:获取某公司的现金流量表。
- get_current_stock_price:获取某公司当前/最新股价。
- get_historical_stock_prices:获取某公司的历史股价。
- get_company_news:获取某公司的新闻。
- get_available_crypto_tickers:获取所有可用的加密货币交易代码。
- get_crypto_prices:获取某种加密货币的历史价格。
- get_historical_crypto_prices:获取某种加密货币的历史价格。
- get_current_crypto_price:获取某种加密货币当前/最新价格。
使用方式
运行环境要求
- Python 3.10 或更高版本
- uv 包管理器
安装与运行步骤
- 克隆仓库:
git clone https://github.com/financial-datasets/mcp-server cd mcp-server - 如果尚未安装 uv,请先安装:
# macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows curl -LsSf https://astral.sh/uv/install.ps1 | powershell - 安装依赖:
# 创建虚拟环境并激活 uv venv source .venv/bin/activate # Windows: .venv\Scripts\activate # 安装依赖 uv add "mcp[cli]" httpx # Windows: uv add mcp[cli] httpx - 设置环境变量:
# 创建用于存放 API 密钥的 .env 文件 cp .env.example .env # 在 .env 中设置 API 密钥 FINANCIAL_DATASETS_API_KEY=your-financial-datasets-api-key - 运行服务器:
uv run server.py
连接到 Claude Desktop
- 如果尚未安装 Claude Desktop,请先安装。
- 创建或编辑 Claude Desktop 配置文件:
# macOS mkdir -p ~/Library/Application\ Support/Claude/ nano ~/Library/Application\ Support/Claude/claude_desktop_config.json - 添加以下配置:
将 /path/to/uv 替换为{ "mcpServers": { "financial-datasets": { "command": "/path/to/uv", "args": [ "--directory", "/absolute/path/to/financial-datasets-mcp", "run", "server.py" ] } } }which uv的结果,将 /absolute/path/to/financial-datasets-mcp 替换为该项目的绝对路径。 - 重启 Claude Desktop。
- 现在应在 Claude Desktop 的工具菜单(锤子图标)中看到可用的金融工具。
示例提问
可以尝试向 Claude 提问,例如:
- “苹果公司最近的利润表是什么?”
- “显示特斯拉股票的当前价格”
- “获取 MSFT 从 2024-01-01 到 2024-12-31 的历史价格”
适用场景
适用于希望让 AI 助手(尤其是 Claude)直接查询股票财务报表、股价、公司新闻和加密货币价格数据的用户。可用于辅助金融数据分析、投资研究或市场资讯查询等场景。
限制
资料中未提及具体收费、价格、平台支持范围、数据覆盖范围、使用频率限制等信息,暂未提供。