secapi-mcp
Enables AI clients to search and analyze SEC filings, financial statements, insider trades, and institutional holdings through natural language tools.
README
secapi-mcp
Official Model Context Protocol server for secapi.dev.
Expose SEC filings, financial statements, insider trades, and institutional holdings as AI-native tools for Claude, Cursor, ChatGPT, Windsurf, VS Code, and any MCP-compatible client.
AI Client → MCP Tools → secapi.dev REST API → JSON Response → LLM
This server never talks to databases directly — it is a typed, validated interface over the secapi-node SDK.
Features
- 9 high-level AI tools designed for reasoning, not REST endpoint mirroring
- SDK-first architecture — all API calls go through
secapi-node - Zod validation on every tool input
- AI-friendly errors with categories, suggestions, and retry hints
- Structured JSON responses with metadata and pagination
- Extensible tool registry — add new tools in minutes
- Production logging — structured, secrets-safe
- Full test suite with Vitest
- CI/CD with GitHub Actions and Changesets
Installation
npm install -g secapi-mcp
# or
pnpm add -g secapi-mcp
# or run via npx
npx secapi-mcp
Requires Node.js 20+.
Quick Start
-
Get an API key from secapi.dev
-
Set your environment variable:
export SECAPI_API_KEY="your-api-key"
- Run the server (stdio transport):
secapi-mcp
MCP Client Configuration
Cursor
Add to .cursor/mcp.json (or Cursor Settings → MCP):
{
"mcpServers": {
"secapi": {
"command": "npx",
"args": ["-y", "secapi-mcp"],
"env": {
"SECAPI_API_KEY": "your-api-key"
}
}
}
}
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"secapi": {
"command": "npx",
"args": ["-y", "secapi-mcp"],
"env": {
"SECAPI_API_KEY": "your-api-key"
}
}
}
}
VS Code (GitHub Copilot)
Add to your VS Code MCP settings:
{
"mcp": {
"servers": {
"secapi": {
"command": "npx",
"args": ["-y", "secapi-mcp"],
"env": {
"SECAPI_API_KEY": "your-api-key"
}
}
}
}
}
Windsurf
Add to Windsurf MCP configuration:
{
"mcpServers": {
"secapi": {
"command": "npx",
"args": ["-y", "secapi-mcp"],
"env": {
"SECAPI_API_KEY": "your-api-key"
}
}
}
}
Available Tools
| Tool | Description |
|---|---|
search_filings |
Search SEC filings by ticker/CIK, form type, and date range |
analyze_filing |
Get filing metadata and document list for deeper analysis |
search_companies |
Search companies by name, ticker, or CIK |
company_overview |
Company profile plus recent filings — ideal research starting point |
company_financials |
Income statement, balance sheet, or cash flow |
company_ratios |
Financial ratio time series (ROE, margins, liquidity, etc.) |
insider_trades |
Insider buying/selling activity from Form 4 filings |
search_institutions |
Find institutional investors (13F filers) |
institution_holdings |
13F portfolio holdings for a given quarter |
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
SECAPI_API_KEY |
Yes* | — | API key from secapi.dev |
SEC_API_KEY |
Yes* | — | Legacy alias for SECAPI_API_KEY |
SECAPI_BASE_URL |
No | https://api.secapi.dev |
API base URL |
SECAPI_TIMEOUT_MS |
No | 30000 |
Request timeout in milliseconds |
SECAPI_MAX_RETRIES |
No | 2 |
Retry count for transient failures |
SECAPI_DEBUG |
No | false |
Enable debug logging to stderr |
SECAPI_USER_AGENT |
No | secapi-mcp/0.1.0 |
User-Agent header |
* One of SECAPI_API_KEY or SEC_API_KEY is required.
Architecture
src/
├── index.ts # stdio entry point
├── server/ # MCP server factory
├── client/ # secapi-node wrapper
├── config/ # Zod-validated configuration
├── errors/ # AI-friendly error categorization
├── logging/ # Structured, secrets-safe logging
├── schemas/ # Shared Zod schemas
├── utils/ # Response formatting
└── tools/
├── registry.ts # Tool registration system
├── types.ts # Tool definition interfaces
├── filings/ # Filing tools
├── companies/ # Company tools
├── financials/ # Financial statement tools
├── insiders/ # Insider trading tools
└── institutions/ # 13F institutional tools
Adding a New Tool
- Create a tool definition in the appropriate
src/tools/<domain>/index.ts:
{
name: "my_new_tool",
description: "Clear description for the LLM...",
inputSchema: z.object({ ticker: tickerSchema }),
handler: async (input, { client }) => {
const data = await client.filings.search({ ticker: input.ticker });
return createToolResponse("my_new_tool", data.data, {
pagination: data.pagination,
});
},
}
- Export the module from
src/tools/index.tsif it's a new domain.
That's it — the registry handles validation, error formatting, and MCP registration.
Development
git clone https://github.com/secapi-dev/secapi-mcp.git
cd secapi-mcp
pnpm install
pnpm test
pnpm build
Run locally:
SECAPI_API_KEY=your-key pnpm start
Scripts
| Script | Description |
|---|---|
pnpm build |
Build to dist/ |
pnpm test |
Run Vitest test suite |
pnpm typecheck |
TypeScript type checking |
pnpm lint |
ESLint |
pnpm format |
Prettier format |
Troubleshooting
"API key is required" — Set SECAPI_API_KEY in your MCP client config env block.
"Invalid or missing API key" — Verify your key at secapi.dev. Keys are never logged.
"API rate limit exceeded" — Wait and retry, or upgrade your plan.
Server not appearing in Cursor — Restart Cursor after editing MCP config. Check stderr logs with SECAPI_DEBUG=true.
FAQ
Why not mirror REST endpoints 1:1?
AI agents work better with semantic, high-level tools. company_overview is more useful than GET /entities/:id + GET /entities/:id/filings.
Can I self-host?
Yes. Set SECAPI_BASE_URL if using a custom API deployment.
How do I add more tools? See Adding a New Tool. The framework is designed for fast extension.
License
MIT — see LICENSE.
Links
- secapi.dev — API platform
- secapi-node — TypeScript SDK
- Model Context Protocol — MCP specification
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。