sec-edgar-mcp

sec-edgar-mcp

An MCP server that provides natural-language access to SEC EDGAR filings, including company lookups, financial figures, insider transactions, and filing comparisons, over streamable HTTP for any MCP client.

Category
访问服务器

README

sec-edgar-mcp

An MCP (Model Context Protocol) server that gives natural-language access to SEC EDGAR filings — company lookups, filing content, financial-statement figures, insider transactions, and filing-to-filing comparisons — over streamable HTTP, so any MCP client (Claude Code, Claude Desktop, etc.) can answer real filing-research questions grounded in real filings, not general knowledge.

Built as a portfolio piece demonstrating production-minded engineering around a public, rate-limited, unauthenticated API: a shared two-tier rate limiter, a coalescing cache, real-data-validated HTML/XML parsing, and a tool surface shaped by testing against a real LLM client, not just unit tests. The full design reasoning — and the tradeoffs behind it — lives in plans/architecture.md; the original requirements are in reference/product_spec.md.

Status: functionally complete through Milestone 7 (all 6 tools, tested against real EDGAR data and a real MCP client). Not yet deployed — this repo runs as a local server today; containerized deployment is Milestone 8.

Why HTTP, not stdio

SEC EDGAR requires a compliant User-Agent with contact info and enforces a per-IP rate limit (~10 req/s). Under stdio, every user's local process is its own uncoordinated IP — the rate limit is never actually exercised or enforced. Under HTTP, one deployment means one egress IP, one shared budget, and one place to get compliance, rate limiting, and caching right. That decision — and everything it forces (single-process invariant, global 429 backoff, cache design) — is spelled out in plans/architecture.md's Decision 0.

Tools

Tool What it does
resolve_company Ticker or company name → canonical CIK, with explicit multi-candidate disambiguation when ambiguous
list_filings A company's filings by form type and date range (metadata only — accession numbers, dates, form types)
get_filing_section One named 10-K section (Business, Risk Factors, Properties, Legal Proceedings, Cybersecurity, Unresolved Staff Comments, Mine Safety Disclosures, MD&A), paginated
get_financial_facts XBRL-sourced figures — revenue, net income, assets, and similar line items — for a company, annual (10-K) or quarterly (10-Q), grounded per value in the filing that reported it
compare_filing_sections Structured added/removed/changed blocks between the same section across two 10-Ks — never a character diff
list_insider_transactions Form 4 insider transactions for a company or person, value-sorted, filterable by transaction code and date range

Each tool's docstring is deliberately prescriptive about when to call it and what it doesn't cover — see src/sec_edgar_mcp/server/tools.py. The server's top-level instructions (in src/sec_edgar_mcp/server/app.py) state the full current scope boundary up front, so a client learns what's out of scope before trying a tool, not after a failed attempt.

Explicitly out of scope today (see reference/product_spec.md §7 for the full list and why): executive compensation (DEF 14A tables), 10-Q prose sections like a quarterly MD&A, 8-K event-type summarization, cross-company/ full-text search, and beneficial ownership above 5% (Schedule 13D/13G).

Quickstart

Requires Python 3.14+ and uv.

uv sync

SEC EDGAR requires a compliant User-Agent — the server fails fast at startup without one, rather than failing silently on the first request:

export SEC_EDGAR_USER_AGENT="your-app-name/0.1 (you@example.com)"

Run it:

uv run python -m sec_edgar_mcp

Starts a streamable-HTTP server on 127.0.0.1:8000 (configurable via SEC_EDGAR_HOST / SEC_EDGAR_PORT; see src/sec_edgar_mcp/config.py for every other tunable — rate limits, cache TTLs, retry/backoff — all have defaults, only the User-Agent is required).

Try it with MCP Inspector

uv run mcp dev src/sec_edgar_mcp/__main__.py

Opens a browser UI for calling each tool directly with raw JSON-RPC — good for verifying an individual tool's input/output shape, not for testing how an LLM actually selects between tools.

Connect it to Claude Code

With the server running:

claude mcp add --transport http sec-edgar-mcp http://127.0.0.1:8000/mcp

Start a new claude session (MCP servers load at session startup) and ask it a real question — e.g. "Has Apple's risk factor language around supply chain changed in the last two 10-Ks?" or "Show me every Form 4 insider sale by Nvidia executives in the last 90 days, sorted by value."

Development

uv run pytest          # unit + tool-layer tests (mocked EDGAR, no network)
uv run pytest -m live  # opt-in tests against real EDGAR
uv run ruff check .
uv run ruff format .
uv run mypy --strict src tests

Four tiers of automated tests, plus a fifth manual one — connecting the running server to a real MCP client and asking it natural-language questions — which is what actually found several of the bugs fixed in this repo's history (see plans/architecture.md's Testing section and recent commit messages for specifics). tests/fixtures/filings/ holds ~10 real, committed 10-K and Form 4 filings across filer sizes and eras — the parsers are validated against real data, not synthetic HTML.

Project layout

src/sec_edgar_mcp/
  config.py        # required SEC_EDGAR_USER_AGENT, everything else defaulted
  domain/           # Pydantic models (CIK, Filing, InsiderTransaction, FinancialFact, ...)
  edgar/            # rate limiter, cache, HTTP client, endpoint wrappers, parsers
  services/         # composition logic (resolve, compare, insiders, financials)
  server/           # MCPServer, @mcp.tool() adapters, logging, scope instructions
tests/
  fixtures/filings/ # ~10 real, committed SEC filings
plans/architecture.md    # full design reasoning and milestone history
reference/product_spec.md # original requirements + recorded scope decisions

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选