Skip to main content
Glama
efts-sec-mcp-server

efts-sec-mcp-server

by krondorl
README.md
# MCP server for SEC EDGAR Full Text Search

Example implementation of an MCP server using an API fetch call.

## Screenshots

![Codex CLI](screenshots/codex.png)

![Inspector 1](screenshots/inspector1.png)

![Inspector 2](screenshots/inspector2.png)

## Install

You will need to install, before using this software.

- [Node.js 26](https://nodejs.org/en/blog/release/v26.13.1)
- [Codex CLI](https://learn.chatgpt.com/docs/codex/cli)

## Warning

- The SEC EDGAR API can change and the API might not work.
- This API endpoint is not documented officially, it comes from secondary sources.

## Architecture

- **MCP server (`src/index.ts`)**: creates an MCP server and exposes the `get-efts-search-results` tool over standard input/output.
- **Input validation**: uses Zod to validate the full-text query and `YYYY-MM-DD` date range before the tool calls the SEC service.
- **SEC EDGAR integration**: translates the tool inputs into a request to the SEC EDGAR Full Text Search endpoint and returns the API response as structured and text content.
- **Response model (`src/types.ts`)**: TypeScript interfaces describe the SEC search response, filings, aggregations, and echoed query metadata.
- **Logging (`src/log.ts`)**: records server startup and tool invocations in `mcp-calls.log`.
- **Fetch prototype (`src/fetch.ts`)**: a standalone command-line script for exercising the SEC endpoint and printing a simplified filing summary.
- **Runtime and tooling**: Node.js runs TypeScript through `tsx`; the MCP Inspector can connect to the same stdio server for local testing.

## Starting Point

For the API fetch call, the original request was this.

I based the MCP server on this request.

```bash
curl -H "User-Agent: Your Name your@email.example" "https://efts.sec.gov/LATEST/search-index?q=%22financial%20statements%22&dateRange=custom&startdt=2023-01-01&enddt=2023-12-31"
```

## Fetch

Use the npm script `npm run fetch`. This is for testing the initial fetch prototype.

## Inspector

Run the npm script: `npm run inspector`. Then check the browser with the localhost address.

## Calling from Codex

1. Register your MCP server (use your custom folder structure, this is just an example)
   `codex mcp add sec-edgar -- npx --yes tsx C:/projects/sec-mcp/src/index.ts`
1. Verify the registration
   - `codex mcp list`
   - `codex mcp get sec-edgar`
1. Start Codex CLI
   - `codex`
   - `/mcp`
1. Prompt
   `Use the sec-edgar MCP tool to search SEC filings containing "financial statements" between 2023-01-01 and 2023-12-31. Return the first 10 results with company names.`

## Logging

The MCP server can log operational information.

Check out the `mcp-calls.log` file

- in the project folder you use codex from
- in the MCP server folder, when used from inspector

## Resources

- [EDGAR Application Programming Interfaces (APIs)](https://www.sec.gov/search-filings/edgar-application-programming-interfaces)
- [MCP TypeScript SDK, Getting Started](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/docs/get-started/first-server.md)
- [Awesome Financial Data APIs](https://github.com/zuozhu625/awesome-financial-data-apis-ff/blob/main/README.md#fundamental--financial-statement-data)

## License

Please see the [LICENSE file](LICENSE).

## History

Started in November, 2026.