SheetsFinance公式MCP服务器

提供SheetsFinance公式目录的MCP服务,支持搜索财务指标、构建校验Google Sheets公式并检查类别与函数元数据,帮助用户在电子表格中获取金融市场和公司数据。

  • by henrysouchien
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 henrysouchien/sheets-finance-mcp

使用说明

sheets-finance-mcp

MCP server for the SheetsFinance formula catalog.

This package exposes three tools:

  • sf_search: search metrics/functions and get ranked metric_id candidates.
  • sf_formula: build validated SheetsFinance formulas from a metric_id or explicit function/category/metric fields.
  • sf_describe: inspect category/function metadata, metric lists, and examples.

What Is SheetsFinance?

SheetsFinance is a Google Sheets add-on for financial market/company data retrieval using spreadsheet formulas.

Installation

From this package directory:

pip install -e .

Run as a module:

python -m sheets_finance_mcp

Or via console script (installed by pyproject.toml):

sheets-finance-mcp

Claude Code MCP Config

{
  "mcpServers": {
    "sheetsfinance": {
      "command": "python",
      "args": ["-m", "sheets_finance_mcp"]
    }
  }
}

Tool Reference

Tool Purpose Typical Next Step
sf_search(query, limit=10) Find matching metrics/functions Use returned metric_id with sf_formula
sf_formula(...) Construct a formula string (single or multi-symbol) Paste formula in Sheets
sf_describe(target) Inspect category/function metrics and options Pick a metric/function for sf_formula

Example Workflow

  1. Search for a metric:

    sf_search(query="gross margin")
    
  2. Build a formula from the selected metric id:

    sf_formula(symbol="AAPL", metric_id="SF.ratios.grossProfitMargin")
    
  3. Inspect a category/function when needed:

    sf_describe(target="income")
    

For a non-SF function, symbol supplies the function signature's first argument, while the selected metric_id supplies the cataloged selector parameter. Pass all remaining named parameters through extra_args. For example, SF_OPTIONS_PRO.calls selects dataType="calls", while SF_BROKERAGE.holdings selects type="holdings"; in the latter case symbol contains the brokerage account nickname rather than a market ticker.