Tiingo金融数据服务

一个将Tiingo金融数据API暴露为Claude可调用工具的Python MCP服务器,提供股票元数据、价格、新闻等金融数据服务。

  • by jmccarrell
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 jmccarrell/tiingo-mcp

使用说明

tiingo-mcp

Python MCP服务器公开 廷戈 财务的 数据API作为Claude可以直接调用的工具。模仿 Matteoanoci/mcp-tiingo (TypeScript) 还有一个额外的 get_ticker_metadata 工具和Python/uv堆栈。

先决条件

设置

1--安装依赖项

just install

2-添加您的API密钥

cp .env.example .env
# edit .env and set TIINGO_API_KEY=your-token-here

服务器加载 .env 从项目启动时的根开始,所以关键永远不会 在您的shell配置文件或Claude的配置文件中需要。

3--使用克劳德代码注册

just install-mcp

添加 tiingo-mcp 到Claude Code的用户范围MCP配置,使其可用 在每个项目中,不仅仅是这个目录。

验证它是否已注册:

claude mcp list

工具

工具 端点 关键参数
get_ticker_metadata GET /tiingo/daily/{ticker} ticker
get_end_of_day_prices GET /tiingo/daily/{ticker}/prices ticker, start_date, end_date, resample_freq
get_news GET /tiingo/news tickers, start_date, end_date, limit, sort_by
get_splits GET /tiingo/corporate-actions/{ticker}/splits ticker, start_ex_date, end_ex_date
get_dividend_distributions GET /tiingo/corporate-actions/{ticker}/distributions ticker, start_ex_date, end_ex_date
get_dividend_yield GET /tiingo/corporate-actions/{ticker}/distribution-yield ticker, start_date, end_date, columns
get_fundamentals_meta GET /tiingo/fundamentals/meta (无)
get_fundamentals_daily_metrics GET /tiingo/fundamentals/{ticker}/daily ticker, start_date, end_date, columns
get_fundamentals_statements GET /tiingo/fundamentals/{ticker}/statements ticker, start_date, end_date, year, quarter

使用所有日期参数 YYYY-MM-DD 格式。所有工具都返回原始JSON Tiingo API。

日常

命令 它的作用
just install-mcp 使用Claude Code注册(运行一次)
just serve 手动启动服务器(stdio——有助于调试)
just test 运行测试
just lint Ruff检查+格式

配置

变量 描述
TIINGO_API_KEY Tiingo API令牌-存储在 .env,从未承诺

项目布局

tiingo-mcp/
├── src/tiingo_mcp/
│   ├── client.py   — async Tiingo HTTP client (TiingoClient + get_client())
│   └── server.py   — FastMCP server; one @mcp.tool() per Tiingo endpoint
└── tests/
    └── test_client.py  — HTTP mocked with respx

故障排除

TIINGO_API_KEY environment variable is not set 确保 .env 存在于项目根目录中 TIINGO_API_KEY=….

之后服务器对Claude Code不可见 just install-mcp 启动一个新的Claude Code会话——MCP服务器在会话启动时加载。

来自Tiingo的HTTP 401 令牌无效或已过期。生成一个新的 https://www.tiingo.com/account/api/token.