SEC-MCP
MCP server for analyzing SEC filings (10-K, 10-Q, 8-K) with industry-aware financial extraction and BERT-based NLP.
README
SEC-MCP
MCP server for analyzing SEC filings (10-K, 10-Q, 8-K) with industry-aware financial extraction and BERT-based NLP.
Features
- Company Search — Look up companies by ticker or name via SEC EDGAR
- Standardized Financials — Industry-aware XBRL extraction with ~250 concept mappings across 5 industry classes (standard, bank, insurance, REIT, utility)
- Validation — Automatic sanity checks (revenue ≥ net income, accounting equation, segment vs total detection)
- Filing Access — Fetch filing text and specific sections (Risk Factors, MD&A, etc.)
- Sentiment Analysis — FinBERT financial sentiment (positive/negative/neutral)
- Summarization — BART-based hierarchical summarization for long filing sections
- Entity Extraction — NER for companies, people, locations + regex for monetary values, dates, percentages
Setup
# Clone
git clone https://github.com/YOUR_USERNAME/SEC-MCP.git
cd SEC-MCP
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install
pip install -e ".[dev]"
# Configure EDGAR identity (required by SEC)
cp .env.example .env
# Edit .env and set EDGAR_IDENTITY="Your Name your@email.com"
Available Tools
Base / Discovery
| Tool | Description |
|---|---|
search_company |
Search by ticker/name → CIK, ticker, SIC code, industry |
get_filing_list |
List filings, filter by form type (10-K, 10-Q, 8-K) |
Financials (standardized, industry-aware, validated)
| Tool | Description |
|---|---|
get_financials |
Full standardized extraction: metrics, ratios, validation, opt. statements |
get_financials_batch |
Same as above for N tickers in parallel |
get_income_statement |
Just the income statement rows |
get_balance_sheet |
Just the balance sheet rows |
get_cash_flow |
Just the cash flow rows |
get_financial_ratios |
Just computed ratios (margins, ROA, ROE, leverage, etc.) |
compare_companies |
Side-by-side metrics + ratios for multiple tickers |
Filing Text
| Tool | Description |
|---|---|
get_filing_text |
Full filing or specific section text (supports aliases like 'risk factors') |
NLP Analysis
| Tool | Description |
|---|---|
analyze_sentiment |
FinBERT sentiment on text or filing section |
summarize_filing |
Hierarchical BART summarization |
extract_entities |
NER (ORG, PER, LOC, MONEY, DATE, PERCENT) |
analyze_filing |
Combined sentiment + summary + entities in one call |
How financials extraction works
Industry detection
The SIC code is used to classify a company into one of 5 industry classes:
| Class | SIC Range | Revenue Strategy |
|---|---|---|
| standard | Everything else | First match: Revenues, RevenueFromContractWithCustomer, SalesRevenueNet, … |
| bank | 6020–6299 | Try total (Revenues, NetRevenues), then aggregate NII + non-interest + trading + fees |
| insurance | 6310–6411 | Try total, then aggregate premiums + investment income + fees |
| reit | 6500–6553 | Lease revenue + other income |
| utility | 4900–4991 | Electric + gas utility revenue |
XBRL concept dictionary
xbrl_mappings.py maps ~250 XBRL concepts to 20+ standardized metrics. Each metric has an ordered list of concepts to try — earlier entries are preferred. Some entries are marked aggregate=True (sum all matching, used for multi-component revenue like banks).
Validation rules
Every extraction runs these checks:
- revenue ≥ net income (when both positive) — catches segment-only revenue
- Assets = Liabilities + Equity (within 5%) — catches mismatched concepts
- Revenue not null — warns if no concept matched
- Bank segment check — flags if bank revenue < 80% of net income
- Gross margin 0–100% — for standard companies
Warnings are returned in the validation array so the AI can explain or retry.
Usage
Run as MCP server (STDIO)
python -m sec_mcp.server
Using with your app (Cursor, Claude Desktop, etc.)
- Configure MCP so your app starts the SEC-MCP server (see below).
- Set
EDGAR_IDENTITYin.envor in the MCP server env. - The AI chooses the right tool per request:
- "Apple's financials" →
get_financials("AAPL") - "Compare AAPL vs MSFT vs GOOGL" →
compare_companies(["AAPL","MSFT","GOOGL"]) - "Morgan Stanley income statement" →
get_income_statement("MS") - "What are Apple's risk factors?" →
get_filing_textwith section='risk factors'
- "Apple's financials" →
Cursor / Claude Desktop configuration
{
"mcpServers": {
"sec-mcp": {
"command": "python",
"args": ["-m", "sec_mcp.server"],
"cwd": "/path/to/SEC-MCP",
"env": {
"EDGAR_IDENTITY": "Your Name your@email.com"
}
}
}
}
Configuration
| Variable | Default | Description |
|---|---|---|
EDGAR_IDENTITY |
SEC-MCP sec-mcp@example.com |
Your identity for SEC EDGAR API |
SENTIMENT_MODEL |
ProsusAI/finbert |
Sentiment analysis model |
SUMMARIZATION_MODEL |
facebook/bart-large-cnn |
Summarization model |
NER_MODEL |
dslim/bert-base-NER |
NER model |
MAX_CHUNK_TOKENS |
512 |
Max tokens per chunk |
CHUNK_OVERLAP_TOKENS |
128 |
Overlap between chunks |
Architecture
src/sec_mcp/
├── server.py # MCP tool definitions (14 tools)
├── edgar_client.py # EDGAR API wrapper (company search, filings, text)
├── financials.py # Standardized extraction engine + validation
├── xbrl_mappings.py # XBRL concept → metric dictionary (5 industry classes)
├── models.py # Pydantic models (StandardizedFinancials, ratios, etc.)
├── config.py # Environment config
└── nlp/
├── sentiment.py # FinBERT
├── summarizer.py # BART
└── ner.py # NER
NLP Models
Models are lazy-loaded (downloaded on first use, ~2.5GB total):
- ProsusAI/finbert — Financial sentiment, trained on SEC filings
- facebook/bart-large-cnn — Abstractive summarization
- dslim/bert-base-NER — Named entity recognition
Development
# Run tests
pytest
# Run tests (skip slow model tests)
pytest -m "not slow"
# Lint
ruff check src/ tests/
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。