How to Pull SEC Company Financials in Claude Code
Claude Code is great at writing financial logic, but it has no way to fetch real financial data. If you ask it for Apple’s revenue over the last five years, it’s either working from stale training data or making something up. AgentPatch’s SEC Company Financials tool changes that by pulling data directly from SEC EDGAR XBRL filings.
Why This Matters
Building anything that touches financial data — dashboards, reports, analysis scripts, data pipelines — requires real numbers. Not estimates, not training data, not scraped blog posts. The SEC’s EDGAR system is the authoritative source for public company financials in the US, and XBRL filings are machine-readable.
The problem is that EDGAR’s API is unintuitive and the XBRL data format is dense. AgentPatch wraps all of that into a single tool call. You pass a CIK number and get back structured financial facts — revenues, net income, assets, liabilities, EPS, and more — with period dates, filing types, and units already parsed.
At 75 credits ($0.0075) per call, it’s cheaper than any financial data API subscription.
Setup
Install the AgentPatch CLI (zero dependencies, Python 3.10+):
pip install agentpatch
Set your API key:
export AGENTPATCH_API_KEY=your_api_key
Then use it:
ap search "web search"
ap run agentpatch google-search --input '{"query": "test"}'
Get your API key from the AgentPatch dashboard.
Run this command to add AgentPatch as an MCP server:
claude mcp add -s user --transport http agentpatch https://agentpatch.ai/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
Replace YOUR_API_KEY with your actual key from the AgentPatch dashboard. Claude Code discovers all AgentPatch tools automatically.
Example
You’re building an earnings summary feature and need real data to develop against. First, you need the company’s CIK number:
“Search SEC for Microsoft’s CIK number, then pull their last 5 years of financials.”
Claude Code chains the two tools together:
Searching SEC for "Microsoft"...
Found: Microsoft Corp, CIK 0000789019
Pulling financials for CIK 0000789019 (5 years)...
Microsoft Corp — Financial Summary:
Revenues (10-K annual filings):
FY2025: $261.8B (filed 2025-07-30)
FY2024: $245.1B (filed 2024-07-30)
FY2023: $211.9B (filed 2023-07-27)
FY2022: $198.3B (filed 2022-07-28)
FY2021: $168.1B (filed 2021-07-29)
NetIncomeLoss:
FY2025: $88.1B
FY2024: $72.4B
...
Also returned: Assets, Liabilities, StockholdersEquity, EarningsPerShareBasic,
OperatingIncomeLoss, CashAndCashEquivalentsAtCarryingValue.
All data sourced from official SEC EDGAR XBRL filings.
Claude Code fetched structured financial data, organized it by fiscal year, and noted the filing dates and form types. You can now use this to build fixtures, seed a database, or verify your data model against real numbers.
Wrapping Up
With AgentPatch connected, Claude Code can pull official SEC financial data inline during any session. Combine it with sec-company-search to look up CIK numbers on the fly. The same connection gives you access to every other tool on the marketplace — search, email, maps, and more. Check out what’s available at agentpatch.ai.