MCP server for SEC financial report download, parsing and search
Project description
AgentLadle MCP SEC
English | ไธญๆ | ๐บ Watch Demo
๐จ๐ณ China A-Share Market โ Cloud-hosted MCP for Shanghai & Shenzhen listed companies. Read more | Get API Key
A MCP (Model Context Protocol) server that provides tools for discovering, downloading, parsing, and searching U.S. SEC financial reports.
It enables AI assistants (Claude, Cursor, etc.) to access SEC EDGAR data through 6 structured tools โ from discovering available filings to keyword-searching within their pages.
Features
- 6 MCP tools for SEC financial data: state-driven retrieval (search directly, fallback to download/parse only when needed)
- Professional SEC document parsing using edgartools โ accurate page-break detection and structured node-tree extraction for iXBRL filings
- Local keyword search with TF + position-boost scoring, zero external dependencies
- Idempotent โ already-downloaded/parsed files are automatically skipped
- Zero-config install โ one line to add to your MCP client, no clone or manual setup needed
- Pure Python, cross-platform (Windows / macOS / Linux)
Prerequisites
- Python 3.10+ โ Download Python
- uv โ Install uv
Note: After installing uv, restart your terminal and MCP client (e.g. Cherry Studio) to ensure the
uvcommand is recognized.
Quick Start
Add to your MCP client configuration (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"mcp-sec": {
"command": "uvx",
"args": ["agentladle-mcp-sec"],
"env": {
"SEC_EMAIL": "your@email.com"
}
}
}
}
That's it. uvx will automatically download the package and its dependencies from PyPI โ no clone, no manual install, no path configuration.
โ ๏ธ SEC Email Requirement: Replace
your@email.comwith your real email. The SEC requires a valid email in the User-Agent header. Using a fake email may result in your IP being blocked.
Alternative: pip install
If you prefer managing the environment yourself:
pip install agentladle-mcp-sec
Then configure:
{
"mcpServers": {
"mcp-sec": {
"command": "agentladle-mcp-sec",
"env": {
"SEC_EMAIL": "your@email.com"
}
}
}
}
Alternative: Run from source (local development)
Clone the repository and run directly:
git clone https://github.com/agentladle/mcp-sec.git
Then configure your MCP client:
{
"mcpServers": {
"mcp-sec": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-sec", "agentladle-mcp-sec"],
"env": {
"SEC_EMAIL": "your@email.com"
}
}
}
}
Replace /path/to/mcp-sec with the actual path to the cloned repository.
Data Flow
SEC EDGAR API Local Files (~/.agentladle/mcp-sec/data/)
โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
company_tickers.json โโโ company_tickers.json (tickerโCIK mapping)
โ
SEC Submissions API โโโ html/*.htm (Tool 2: download)
โ
edgartools parsing โโโ json/*.json (Tool 3: parse, page-split)
โ
Local TF search โโโ search results (Tool 4: keyword search)
Page range read โโโ page content (Tool 5: read pages)
TOC lookup โโโ table of contents (Tool 6: get TOC)
Tools
| # | Tool | Description |
|---|---|---|
| 1 | list_sec_filings |
Discover available SEC filings for a company |
| 2 | download_sec_report |
Download a specific SEC filing as HTML |
| 3 | parse_sec_report |
Parse HTML into page-split JSON using edgartools |
| 4 | keyword_search |
Full-text keyword search with TF relevance scoring |
| 5 | get_report_pages |
Read report content by page number range |
| 6 | get_report_toc |
Get the Table of Contents page(s) |
Tool 1: list_sec_filings
List available SEC filings for a company. Use this tool ONLY when the exact year/date is unspecified by the user, or when a download attempt fails due to an invalid date.
| Parameter | Type | Required | Description |
|---|---|---|---|
ticker |
string | โ | Stock ticker, e.g. "AAPL" |
form |
string | โ | Filing type filter, e.g. "10-K". Omit to list all financial report types (10-K, 10-Q, 20-F, 6-K, 8-K, 40-F) |
limit |
int | โ | Max filings to return, default 5, max 20 |
Tool 2: download_sec_report
Download a specific SEC filing from EDGAR. One filing per call. Idempotent (skips if file exists and is valid).
| Parameter | Type | Required | Description |
|---|---|---|---|
ticker |
string | โ | Stock ticker, e.g. "AAPL" |
form |
string | โ | Filing type: "10-K", "10-Q", "20-F", "6-K" |
report_date |
string | โ | Report date (fiscal period end date), e.g. "2025-01-31" |
Tool 3: parse_sec_report
Parse a downloaded HTML filing into page-split JSON. Uses edgartools mark_page_breaks() + parse_html() for professional SEC document parsing.
| Parameter | Type | Required | Description |
|---|---|---|---|
ticker |
string | โ | Stock ticker |
form |
string | โ | Filing type |
report_date |
string | โ | Report date (fiscal period end date) |
Tool 4: keyword_search
Full-text keyword search across all pages. Results ranked by TF + position-boost score.
| Parameter | Type | Required | Description |
|---|---|---|---|
ticker |
string | โ | Stock ticker |
form |
string | โ | Filing type |
report_date |
string | โ | Report date (fiscal period end date) |
keywords |
string[] | โ | 1โ5 search keywords |
match_mode |
string | โ | "ANY" (default, any keyword matches) / "ALL" (all must match) |
max_results |
int | โ | Max results to return, default 5, max 50 |
Tool 5: get_report_pages
Read full page content by page number range.
| Parameter | Type | Required | Description |
|---|---|---|---|
ticker |
string | โ | Stock ticker |
form |
string | โ | Filing type |
report_date |
string | โ | Report date (fiscal period end date) |
start_page |
int | โ | Start page number (1-based) |
page_count |
int | โ | Number of pages to return, default 3, max 5 |
Tool 6: get_report_toc
Get the Table of Contents page(s). Searches the first 10 pages for "Table of Contents".
| Parameter | Type | Required | Description |
|---|---|---|---|
ticker |
string | โ | Stock ticker |
form |
string | โ | Filing type |
report_date |
string | โ | Report date (fiscal period end date) |
Configuration
On first run, a default config file is created at ~/.agentladle/mcp-sec/config.yaml:
sec:
email: ""
paths:
data_dir: "~/.agentladle/mcp-sec/data"
html_dir: "~/.agentladle/mcp-sec/data/html"
json_dir: "~/.agentladle/mcp-sec/data/json"
download:
delay_between_requests: 0.2
min_file_size: 5000
The email field is used to build the SEC-compliant User-Agent header (AgentLadleMcpSec {email}). You can configure it in three ways (in order of priority):
- Environment variable
SEC_EMAILโ recommended, set it in your MCP client JSON config - Config file โ edit
~/.agentladle/mcp-sec/config.yamland setemail - Default โ if empty, a placeholder email is used (not recommended for production)
โ ๏ธ SEC User-Agent Policy: The SEC requires a real email in the User-Agent header. Using the default placeholder may result in your IP being blocked.
Data Directory Structure
~/.agentladle/mcp-sec/
โโโ config.yaml # Configuration (auto-created)
โโโ data/
โโโ company_tickers.json # tickerโCIK mapping (auto-downloaded & cached)
โโโ html/ # Downloaded HTML filings
โ โโโ AAPL_10-K_2025-01-31.htm
โ โโโ ...
โโโ json/ # Parsed page-split JSON
โโโ AAPL_10-K_2025-01-31.json
โโโ ...
File naming convention: {TICKER}_{FORM}_{REPORT_DATE}.htm/json
Example Usage
The tools are designed with an EAFP (Easier to Ask for Forgiveness than Permission) approach. AI assistants should attempt to retrieve data directly and rely on errors to trigger downloads.
Scenario A: File already exists locally (Shortest Path)
User: "Analyze AAPL's latest 10-K management discussion"
1. keyword_search(ticker="AAPL", form="10-K", report_date="2025-01-31", keywords=["management", "discussion"])
โ Returns page snippets matching the keywords immediately.
Scenario B: File missing (Fallback triggered)
User: "What is Tesla's 2024 revenue?"
1. keyword_search(ticker="TSLA", form="10-K", report_date="2024-12-31", keywords=["revenue", "net sales"])
โ Error: File not found.
2. download_sec_report(ticker="TSLA", form="10-K", report_date="2024-12-31")
โ Downloads HTML to ~/.agentladle/mcp-sec/data/html/
3. parse_sec_report(ticker="TSLA", form="10-K", report_date="2024-12-31")
โ Parses into JSON.
4. keyword_search(ticker="TSLA", form="10-K", report_date="2024-12-31", keywords=["revenue", "net sales"])
โ Retries search and returns data.
Tech Stack
| Component | Choice | Purpose |
|---|---|---|
| MCP Framework | mcp (FastMCP) |
MCP server with stdio transport |
| HTTP Client | httpx |
SEC API requests & file downloads |
| HTML Parsing | edgartools + beautifulsoup4 |
Professional SEC iXBRL parsing (page-break detection + node tree) |
| Search | Python built-in | TF + position-boost scoring |
| Config | pyyaml |
YAML configuration file |
Project Structure
src/mcp_sec/
โโโ __init__.py
โโโ server.py # MCP Server entry point
โโโ config.py # Config loading (~/.agentladle/mcp-sec/config.yaml, singleton cached)
โโโ models.py # Data models
โโโ tools/
โ โโโ list_filings.py # Tool 1: list_sec_filings
โ โโโ download.py # Tool 2: download_sec_report
โ โโโ parse.py # Tool 3: parse_sec_report
โ โโโ search.py # Tool 4: keyword_search
โ โโโ page.py # Tool 5: get_report_pages
โ โโโ toc.py # Tool 6: get_report_toc
โโโ services/
โโโ downloader.py # SEC EDGAR download + tickerโCIK
โโโ parser.py # HTMLโJSON parsing (edgartools)
โโโ searcher.py # Local JSON search + TF scoring
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentladle_mcp_sec-0.1.3.tar.gz.
File metadata
- Download URL: agentladle_mcp_sec-0.1.3.tar.gz
- Upload date:
- Size: 159.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20210c94f5dcc1bf8dc5125930b2993a38ac494d740f88a46a7652d11e1808ed
|
|
| MD5 |
8e26d96d8c9935e7002b85a58c9acd7c
|
|
| BLAKE2b-256 |
7734fbb4b97c827af1b790144fc1d91c889a9792f2b203de65b5db3463bd587b
|
File details
Details for the file agentladle_mcp_sec-0.1.3-py3-none-any.whl.
File metadata
- Download URL: agentladle_mcp_sec-0.1.3-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff67f14e999e63355d51301a6a2815cb37a29aeda6ab4cb915f60ff43750316d
|
|
| MD5 |
11ffe316afeb6fca520889f65c100522
|
|
| BLAKE2b-256 |
8d44d4dc45ee4049bf5c68aac382a0cecbed611fec01e9ab1fdc92d0b639ba1f
|