filinggate-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@filinggate-mcp Audit NVDA's latest 10-Q to check the three statements tie out"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
FilingGate
面向美股 SEC EDGAR 的确定性 XBRL 解析引擎、三表恒等式审计器、同口径同行对比工具、10 工具 MCP 服务与数字核验门禁。
所有财报数据均通过 Python(httpx + lxml + pydantic + mcp)直接解析 SEC EDGAR 官方原始文件,内置 SHA-256 内容寻址缓存、SQLite WAL 本地持久化,以及按美股交易日历计算的公开可用日(美东 16:00 盘后提交顺延至下一交易日)。
每个输出数字均附带原始 SEC 申报号(
accession)、提交日、公开可用日与文件sha256摘要;财报未披露的科目或分部调节差均按原样标出。
10 秒零配置离线体验(无需联网、无需 API Key)
git clone https://github.com/MiusHuv/filinggate.git
cd filinggate
python -m pip install -e ".[dev]"
# 一键离线自检:XBRL 三表审计 + verify_claims 门禁拦截 + MCP 目录就绪校验
filinggate demo
# 基于本地 XBRL 夹具生成独立单页 HTML 审计卡片
filinggate report --fixture tests/fixtures/hon_conglomerate_10q.xml --format html --out demo_hon.html实际运行 filinggate demo 的完整输出:
FilingGate 离线快速体验(v0.2.0 · 无需联网 · 无需 API Key)
[1/3] XBRL 三表审计与公司抵销项对账(HON_DEMO)
审计通过: True | 检查项: 4 | 分部状态: reconciled_with_corporate
✅ 对账通过(业务分部 + 公司层/抵销调节项 Corporate And Other [-120,000,000] 与合并总额一致)
[2/3] 数字核验门禁演示(verify_claims)
待核文本: 本季营收 $96,221B,同比增长 17.9%,毛利率 78.0%。
核验结果: gate_ok=False | fail=3(拦截 3 处错误)
❌ $96,221B → 数量级不符:报告写 9.622e+13,事实为 9.622e+10
❌ 17.9% → 口径错配:报告写 yoy,证据只有 qoq
❌ 78.0% → 数值与 gross_margin 不符(偏差 4.1%)
[3/3] MCP 服务工具目录:10 个确定性只读工具已就绪(运行 `filinggate mcp --print-config` 获取接入配置)Related MCP server: edgar-mcp
真实 SEC 财报在线审计卡片(支持 GitHub Pages)
仓库 docs/ 目录已预生成 3 家真实美股 10-Q XBRL 静态单页审计卡片(纯 HTML/CSS + 内联 SVG,零前端框架依赖):
卡片总览首页:
docs/index.htmlNVDA Q2 FY27 10-Q(
0001045810-26-000075,三表与分部审计全部通过):docs/reports/nvda.htmlAMD Q3 2026 10-Q(
0000002488-26-000191,财报未单独披露total_liabilities):docs/reports/amd.htmlHON Q3 2026 10-Q(
0000773840-26-000143,财报未单独披露gross_profit, total_liabilities):docs/reports/hon.html
系统架构
flowchart LR
SEC["SEC EDGAR 一手申报文件<br/>(10-K / 10-Q / 8-K / Form 4 / CompanyFacts)"] --> L1
subgraph L1["1. 规则解析与审计层"]
HTTP["限速 HTTP + SHA-256 缓存<br/>SQLite WAL 事实库 + 美股节假日交易日历"]
XBRL["XBRL 实例与 Linkbase 层级解析<br/>23 项扩展财务科目 · 嵌套/抵销分部对账"]
COMP["多期财报趋势与同口径同行对比<br/>单季 60–120 天 / 年报 300–400 天 · 币种隔离"]
DIFF["Item 1A/7 风险段红线 Diff(过滤纯排版调整)<br/>8-K 严重度索引 · Form 4 10b5-1 去噪"]
end
L1 --> MCP["2. 标准 Stdio MCP 服务(filinggate-mcp)<br/>10 个只读工具 · 2 个只读资源 · as_of_date 历史时点截断"]
L1 --> RPT["一键单页审计卡片<br/>filinggate report --format html/md/json"]
MCP --> GATE["3. 受约束生成与核验闭环<br/>canonical fact_id 白名单 -> verify_claims 四态核验<br/>-> 1 轮自动纠偏 -> 确定性模板兜底回退"]核心命令行用法(直连 SEC 现网)
SEC EDGAR 公平访问策略要求在请求头中提供真实联系邮箱作为 User-Agent:
export FILINGGATE_USER_AGENT="你的姓名 your.email@example.com"
# 可选:复制 .env.example 为 .env.local 配置 Finnhub 或 LLM 网关参数1. 一键生成单公司审计卡片(filinggate report)
filinggate report NVDA --format html --out nvda_audit.html
filinggate report HON --format md单条命令汇集 23 项扩展财务科目、内联 SVG 单季营收趋势图、业务分部对账、三表会计恒等式审计、利润率背离预警、Item 1A 风险段变动、近期 8-K 重大事件及 Form 4 内部人主动交易,并附带完整申报号与 SHA-256 溯源信息。
2. 多期趋势与同口径同行对比(trends / compare)
美股 10-Q 同一份季报里往往同时填报“3 个月单季”与“前 6/9 个月累计”数据,直接抓取容易把累计值误当单季。FilingGate 按期间天数严格过滤(单季 60–120 天、年报 300–400 天),缺失单季时不跨期伪造环比,跨币种(如 USD vs TWD)或财年截止日错位时自动告警:
filinggate trends AAPL --period quarter --periods 4
filinggate compare NVDA AMD MSFT AAPL --period quarter实测现网输出(filinggate compare NVDA AMD MSFT AAPL --period quarter):
FilingGate 同行同口径对比 | 口径=单季(仅纳入 60–120 天区间数据)
代码 报告期末 天数 币种 营收 同比 毛利率 营业率 净利率 EPS
------------------------------------------------------------------------------------------
NVDA 2026-07-26 90天 USD 96,221.0M +105.8% 75.0% 66.2% 62.0% 2.46
AMD 2026-09-26 90天 USD 13,377.0M +44.7% 53.9% 21.2% 18.1% 1.46
MSFT 2026-09-30 91天 USD 92,279.0M +18.8% 67.8% 49.8% 39.7% 4.92
AAPL 2026-06-27 90天 USD 109,417.0M +16.4% 50.1% 32.6% 27.2% 2.02
⚠️ [fiscal_calendar_offset] 因财年截止日不同,各公司最新报告期末存在错位(2026-06-27, 2026-07-26, 2026-09-26, 2026-09-30);所有行均已按单季口径对齐(仅纳入 60–120 天区间数据)。3. 其他常用确定性子命令
filinggate audit HON --db .filinggate-cache/filinggate_facts.db # 23 项科目抽取 + 三表勾稽审计 + SQLite WAL 落盘
filinggate segments NVDA --period quarter # 嵌套层级与公司抵销项分部对账
filinggate diff AMD --section 1A --limit 5 # Item 1A/7 风险段红线 Diff(自动过滤纯排版调整)
filinggate events NVDA --since 90d # 8-K 严重度索引与附件指标抽取
filinggate insiders NVDA --since 90d --only P,S # Form 4 主动交易过滤与 10b5-1 标注
filinggate claims examples/report_with_errors.md --ticker NVDA # 四态数字核验门禁独立校验
filinggate brief NVDA --no-context # 基于规则模板直接生成财报简报
filinggate synth HON --no-context # LLM 受约束撰稿 + verify_claims 自动纠偏闭环MCP 服务接入(Claude Desktop / Cursor / Claude Code)
FilingGate 内置标准 stdio MCP 服务入口(filinggate-mcp 或 filinggate mcp),暴露 10 个只读工具 与 2 个只读资源(数据契约版本 CONTRACT_VERSION = "2.0"),支持统一 McpToolError 结构化错误映射,以及按 as_of_date 截断历史时点(只返回该日期及之前已公开的财报)。
本地自检与打印可直接粘贴的客户端配置:
filinggate mcp --check
filinggate mcp --print-config{
"mcpServers": {
"filinggate": {
"command": "filinggate-mcp",
"env": {
"FILINGGATE_USER_AGENT": "你的姓名 your.email@example.com"
}
}
}
}MCP 工具名 | 核心功能 |
| 将美股代码解析为 10 位 CIK,显式暴露多类别股份歧义 |
| 列出 SEC 申报历史,输出 |
| 仅提取合并报表口径核心财务科目,未披露科目按原样列出 |
| 解析带维度的业务分部,支持嵌套父子去重与公司层/抵销项对账 |
| 8-K 披露事项严重度分级、附件解析与业绩公告指标提取 |
| Form 4 过滤期权/税扣噪音仅留 |
| 对比两期 Item 1A / Item 7 段落差异,自动忽略纯排版与换行调整,仅保留实质变动 |
| 四态数字核验门禁( |
| 组装结构化事实包,生成 |
| 抽取 23 项扩展科目并执行资产负债表、毛利、营运资金及分部加总四项勾稽审计 |
只读资源:filinggate://tools/catalog、filinggate://evidence/cached。
评测基准与实证记录
完整的复现命令、原始日志与多行业实测明细收录在 EVIDENCE.md。
1. 24 项财报边界题双模型对照评测(evals/cases.jsonl)
评测集覆盖 10 类常见的 SEC 财报解析与问答边界场景(共 24 题),在同一评测框架下对比 4 种架构在 Gemini 3.5 Flash 与 Gemini 4 Hydrogen 上的表现:
架构模式 | 离线 Mock 基准 | Gemini 3.5 Flash( | Gemini 4 Hydrogen( | 幻觉率(Flash / Hydrogen) |
无工具直出( | 12.5% (3/24) | 45.8% (11/24) | 75.0% (18/24) | 54.2% / 20.8% |
仅提示词约束( | 58.3% (14/24) | 66.7% (16/24) | 70.8% (17/24) | 33.3% / 29.2% |
接入 MCP 工具( | 75.0% (18/24) | 95.8% (23/24) | 100.0% (24/24) | 4.2% / 0.0% |
MCP + 核验纠偏( | 100.0% (24/24) | 100.0% (24/24) | 100.0% (24/24) | 0.0% / 0.0% |
核心结论:未接入工具时,Gemini 4 Hydrogen 领先 Gemini 3.5 Flash +29.2pp(75.0% vs 45.8%),但仍因缺少一手 SEC 财报数据停在 18/24;接入 MCP 工具与核验门禁后,耗时仅为其 38%(快 2.62×)的 Gemini 3.5 Flash 同样达到 100.0% 通过率与 0.0% 幻觉率。
本地离线复现 Mock 对照测试:
python -m evals.runner --mode all --provider mock2. 10 家跨行业现网 SEC 兼容扫描
通过 scripts/scan_companies.py 覆盖科技、芯片、工业、零售、银行与 SaaS 六类行业:
ok(5/10):NVDA、AAPL、MSFT、SNDK、CRMmissing_concepts(4/10):HON、AMD、JPM、WMT(原件未单独填报部分标准科目,如总负债或毛利,按缺失原样标出)segment_mismatch(1/10):CAT(机械制造与金融子公司分部合计存在调节差,按原样标注)unparsed(0/10):0
3. 上游 SEC 开源生态贡献
在审计开源库 dgunning/edgartools 的 MCP 工具层时,发现美股 10-Q 季报同时包含单季与 6/9 个月累计值时,其 edgar_trends(..., period="quarterly") 会把累计营收覆盖到单季(如苹果单季 $109.4B 被覆盖为 9 个月累计 $364.4B),已提交上游修复 PR dgunning/edgartools#2018。
测试与持续集成
# 纯离线单元测试与回归套件(零联网,209 项测试)
pytest -m "not network" --tb=short
# 现网 SEC 集成测试(需配置 FILINGGATE_USER_AGENT)
pytest -m network --tb=shortGitHub Actions 工作流(.github/workflows/ci.yml)在 Python 3.10 与 3.12 环境下自动执行全部离线单测、filinggate demo、filinggate mcp --check 以及确定性 Mock 消融回归。
目录结构
filinggate/
├── filinggate/
│ ├── xbrl.py # XBRL 实例与 Linkbase 树形层级解析
│ ├── segments.py # 嵌套父子分部去重与公司抵销项对账
│ ├── accounting.py # 23 项扩展科目、三表恒等式审计、累计现金流差额拆单季
│ ├── trends.py # 多期单季/年报趋势与同口径同行对比
│ ├── claims.py # 四态数字核验门禁(PASS/FAIL/AMBIGUOUS/UNVERIFIABLE)
│ ├── filings.py # SEC 申报翻页、附件定位与公开可用日计算
│ ├── market_calendar.py # 规则化 NYSE/Nasdaq 节假日日历(含耶稣受难日与六月节)
│ ├── sections.py # Item 1A/7 段落 Diff 与纯排版调整过滤
│ ├── events.py / insider.py / divergence.py / factpack.py / brief.py / synth.py
│ ├── report.py # 独立 HTML/Markdown 审计卡片与内联 SVG 趋势图生成
│ ├── mcp_server.py # 10 工具标准 stdio MCP 服务(CONTRACT_VERSION 2.0)
│ ├── storage.py # SQLite WAL 事实存储库
│ └── cli.py # 命令行主入口(filinggate)
├── evals/ # 24 题财报边界评测集(cases.jsonl)与 4 模式评测器
├── docs/ # GitHub Pages 静态审计卡片(index.html 及 NVDA/AMD/HON)
├── tests/ # 209 项离线单测与跨行业 XBRL 测试夹具
└── EVIDENCE.md # 可复现的测试、跨行业扫描与双模型消融实证记录明确边界与已知局限
仅覆盖美股 SEC EDGAR:港股、A 股、加密货币等非 SEC 标的会明确拒答。
不提供投资建议:不输出目标价、买卖评级或交易信号。
金融与多子公司集团长尾口径:银行股(如
JPM)天然无工业企业GrossProfit科目,含金融子公司的综合集团(如CAT)可能存在分部调节差segment_mismatch。FilingGate 按原件状态直接标注,不做估算补全。verify_claims聚焦数值与口径核验:不覆盖开放式语义推理或观点判断。24 题基准定位为边界陷阱回归集:不代表开放域全市场财报问答准确率,后续计划接入公开
FinanceBench数据集补充外部分层评测。
开源协议
Available Tools
10 toolsaudit_statementsCRead-onlyIdempotent
Extract 23 extended XBRL concepts and run 3-statement and segment accounting checks.
Inputs: cik, period, ticker, accession, +1 more. Returns: object
build_fact_packCRead-onlyIdempotent
Build Stage 2/3 extended fact pack with canonical fact_ids, segment deltas, audit, and drilldowns.
Inputs: cik, form, since, ticker, +2 more. Returns: object
diff_sectionsBRead-onlyIdempotent
Compare Item 1A or Item 7 across two periodic filings with word-level similarity and restructuring detection.
Inputs: cik (required), section, max_items, as_of_date, +2 more. Returns: object
get_financialsCRead-onlyIdempotent
Extract standardized financial statement concepts from a 10-K/10-Q with provenance and sha256.
Inputs: cik (required), concepts, accession, as_of_date. Returns: object
get_insider_tradesCRead-onlyIdempotent
List Form 4 open-market insider trades (P/S), 10b5-1 flags, and excluded noise counts.
Inputs: cik (required), codes, limit, since, +2 more. Returns: object
get_segmentsCRead-onlyIdempotent
Extract business/product/geographic segment revenue and hierarchical reconciliation status.
Inputs: cik (required), period, accession, as_of_date. Returns: object
list_eventsBRead-onlyIdempotent
List Form 8-K events with item severity classification, exhibit filenames, and parsed earnings metrics.
Inputs: cik (required), forms, items, limit, +3 more. Returns: object
list_filingsCRead-onlyIdempotent
List SEC filings for a CIK with filed_at and market available_on dates.
Inputs: cik (required), forms, limit, since, +1 more. Returns: object
resolve_securityARead-onlyIdempotent
Resolve a US equity ticker to its 10-digit SEC CIK; raises LOOKUP_ERROR on ambiguity or unknown ticker.
Inputs: ticker (required). Returns: object
verify_claimsCRead-onlyIdempotent
Verify numeric claims in text against SEC tool evidence and return PASS/FAIL/AMBIGUOUS/UNVERIFIABLE gate.
Inputs: text (required), evidence (required), basis, strict. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools have clearly distinct targets: ticker resolution, filing listing, financials, segments, 8-K events, Form 4 trades, diffing, verification, and auditing. The overlap zone is financial extraction—get_financials, build_fact_pack, and audit_statements all touch standardized XBRL data, and get_segments overlaps audit_statements' segment checks—but the descriptions differentiate extraction vs. aggregation vs. validation well enough.
All ten names follow a clean snake_case verb_noun pattern (resolve_security, list_filings, get_financials, diff_sections, verify_claims, etc.). Verb choice is meaningful and consistent with the action performed.
Ten tools is well within the ideal range and each maps to a distinct SEC-analysis capability. No filler tools appear and the surface feels purposefully scoped to a filing research workflow.
Coverage spans the full SEC research lifecycle: identity resolution, filing discovery, statement/segment extraction, events, insider activity, period-over-period diffing, verification, and audit. The main gap is raw document retrieval/full-text search—there is no direct way to fetch a filing's text sections or exhibits, which limits drilldown beyond the pre-parsed facts.
Maintenance
Related MCP Connectors
Primary-source SEC filing intelligence and financial/disclosure reconciliation for AI agents.
SEC filings — 13F, Form 4, 8-K, 13D, IPO and short-interest data — as 17 agent tools.
SEC filings and financial data for AI agents: 59 tools for statements, valuation and supply chains.
SEC EDGAR financials, insider trading, and economic data for AI agents. US GAAP + IFRS.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to download, parse, and analyze SEC EDGAR filings, including 10-K/Q reports, XBRL financial statements, and insider trading data. It provides structured access to institutional holdings, corporate events, and financial facts for comprehensive investment research.20MIT
- AlicenseAqualityBmaintenanceProvides access to SEC EDGAR financial data, enabling AI agents to fetch company filings, financial metrics, and narrative sections. It supports natural-language metric searching and extracts structured data from 10-K, 10-Q, and 8-K reports.663 PyPIMIT
- AlicenseAqualityBmaintenanceEnables AI agents to query US public company financial data from SEC filings, with tools for resolving tickers, listing filings, retrieving financial concepts, comparing companies, extracting filing sections, and full-text search. It surfaces data ambiguities like tag variations, restatements, and fiscal-year misalignment rather than hiding them.6MIT
- AlicenseAqualityBmaintenanceProvides 22 read-only tools that let AI assistants pull and read SEC EDGAR data straight from official sec.gov APIs: 10-K, 10-Q, 8-K, 20-F and proxy filings, paged or phrase-searched filing text, XBRL facts and cross-company rankings, insider trades, 13D/13G ownership and 13F portfolios. Also enables full-text search across every EDGAR filing since 2001, so users can answer company financial questions in natural language without an API key.2260 PyPIMIT