Skip to main content

MCP server for SEC financial report download, parsing and search

Project description

AgentLadle MCP SEC

English | ไธญๆ–‡

๐Ÿ‡จ๐Ÿ‡ณ 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 covering the full SEC report pipeline: discover โ†’ download โ†’ parse โ†’ search
  • 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

Note: After installing uv, restart your terminal and MCP client (e.g. Cherry Studio) to ensure the uv command 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.com with 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 (~/.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 first when you don't know the exact filing date, then call download_sec_report with the returned 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"
filing_date string โœ… Filing 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
filing_date string โœ… Filing 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
filing_date string โœ… Filing 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
filing_date string โœ… Filing 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
filing_date string โœ… Filing date

Configuration

On first run, a default config file is created at ~/.mcp-sec/config.yaml:

sec:
  email: ""

paths:
  data_dir: "~/.mcp-sec/data"
  html_dir: "~/.mcp-sec/data/html"
  json_dir: "~/.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):

  1. Environment variable SEC_EMAIL โ€” recommended, set it in your MCP client JSON config
  2. Config file โ€” edit ~/.mcp-sec/config.yaml and set email
  3. 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

~/.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}_{FILING_DATE}.htm/json

Example Usage

These tools are called by an AI assistant through the MCP protocol. Here's a typical workflow:

User: "Analyze AAPL's latest 10-K management discussion"

1. list_sec_filings(ticker="AAPL", form="10-K")
   โ†’ Returns: [10-K  filing_date: 2025-11-01, 10-K  filing_date: 2024-11-01, ...]

2. download_sec_report(ticker="AAPL", form="10-K", filing_date="2025-11-01")
   โ†’ Downloads HTML to ~/.mcp-sec/data/html/

3. parse_sec_report(ticker="AAPL", form="10-K", filing_date="2025-11-01")
   โ†’ Parses into page-split JSON in ~/.mcp-sec/data/json/

4. keyword_search(ticker="AAPL", form="10-K", filing_date="2025-11-01",
                   keywords=["management", "discussion"])
   โ†’ Returns page snippets matching the keywords, ranked by relevance

5. get_report_pages(ticker="AAPL", form="10-K", filing_date="2025-11-01",
                     start_page=15, page_count=3)
   โ†’ Returns full content of pages 15โ€“17 (MD&A section)

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 (~/.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentladle_mcp_sec-0.1.0.tar.gz (184.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentladle_mcp_sec-0.1.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file agentladle_mcp_sec-0.1.0.tar.gz.

File metadata

  • Download URL: agentladle_mcp_sec-0.1.0.tar.gz
  • Upload date:
  • Size: 184.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.3

File hashes

Hashes for agentladle_mcp_sec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c51ba7057df024bd17c762fa6eff40fb9f3d887b730cfece7a3df9dc8d910ce7
MD5 34f9080868b4c2b6826f0bc1c5c01aee
BLAKE2b-256 2d17b6b2fb6335c7e869e38cd48d69ac4ad9768aaa3d9055023459facf6c3e9a

See more details on using hashes here.

File details

Details for the file agentladle_mcp_sec-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentladle_mcp_sec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2156b6c57645b687f48cb49c134bbed8d78950f0e74b9ba02f9f12b56e2feafe
MD5 65e4ef759e5e5e36265d6d7ccf934cdf
BLAKE2b-256 764c98064c4c8cb5f4f697446d1b32fb3d47f4a7bf1d3dad995b4411077dbfd2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page