Skip to main content
Glama
README.md
# federal-register-mcp

Search and read the US Federal Register from Claude, Cursor, or ChatGPT.

[![CI](https://github.com/konstantinbozukov/federal-register-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/konstantinbozukov/federal-register-mcp/actions/workflows/ci.yml)
![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![MCP](https://img.shields.io/badge/MCP-streamable--http-purple)

## Unofficial data source

This project is **unofficial** and is **not affiliated with or endorsed by** the National Archives and Records Administration (NARA), the Office of the Federal Register (OFR), or the Government Publishing Office (GPO). Do **not** use NARA, OFR, or GPO logos or seals.

Federal Register data are U.S. government works (public domain, 17 U.S.C. §105). This server adds trimmed fields, caching, and rate limiting as a convenience layer only. Tool output is **not legal notice**—verify against the official edition on [govinfo.gov](https://www.govinfo.gov/).

### Not for directory submission; it is a showcase

This server wraps a third-party public API. It is **not** intended for Claude Connectors directory, ChatGPT Apps directory, or similar listings that require first-party or legitimately proxied APIs. Files like `server.json` and `glama.json` are prepared for **your** namespace when you self-host; nothing here is published to a registry by this repository.

## Quickstart

Remote MCP URL (placeholder until you deploy):

`https://YOUR-WORKER.example.com/mcp`

### Cursor

```json
{
  "mcpServers": {
    "federal-register": {
      "url": "https://YOUR-WORKER.example.com/mcp"
    }
  }
}
```

### Claude (remote MCP)

```json
{
  "mcpServers": {
    "federal-register": {
      "type": "http",
      "url": "https://YOUR-WORKER.example.com/mcp"
    }
  }
}
```

### MCP Inspector

Point the inspector at `http://localhost:8787/mcp` when running locally, or your deployed `/mcp` URL.

### Run locally

```bash
npm ci
npm run dev
```

No API keys or `.env` are required. Optional overrides live in `.dev.vars.example`.

## Tools (read-only)

| Tool | Title | Annotations | Purpose |
| --- | --- | --- | --- |
| `search_documents` | Search Federal Register documents | `readOnlyHint`, `idempotentHint`, `openWorldHint` | Keyword, type, agency slug, and date filters |
| `get_document` | Get a Federal Register document | same | Single document by `document_number` |
| `list_agencies` | List agencies | same | Agency directory + slug discovery |
| `list_public_inspection_documents` | List public inspection documents | same | Current public inspection desk |

Example prompts:

1. **“List final rules from EPA in the last 30 days that mention PFAS.”** — use `list_agencies` with `environmental`, then `search_documents` with `types: ["RULE"]`, agency slug, `term: "PFAS"`, and `published_from` / `published_to`.
2. **“Summarize Federal Register document 2026-24346.”** — `get_document` with that `document_number`.
3. **“What’s on public inspection today for banking regulators?”** — `list_public_inspection_documents`, then filter results client-side by agency names.

Every tool response includes a `notes` field repeating the unofficial / govinfo.gov disclaimer.

## Design notes (tested, fixed-scope)

- **Transport:** Stateless Cloudflare Worker using `createMcpHandler` from `agents/mcp/server` with `@modelcontextprotocol/server` (`McpServer`) and Streamable HTTP at `/mcp` (no sessions, no deploy in this repo).
- **Upstream:** `https://www.federalregister.gov/api/v1` with `User-Agent: federal-register-mcp (+https://github.com/konstantinbozukov/federal-register-mcp)`.
- **Field trimming:** Search results cap abstracts at 500 characters (`abstract_truncated` when shorter copy is returned). Lists are bounded by tool `limit` arguments.
- **2,000-result cap:** If `page × limit` would exceed 2,000, the tool returns an actionable error suggesting narrower date or agency filters.
- **Caching:** Workers Cache API — ~5 minutes for document search/detail/public inspection; ~1 hour for agencies.
- **Resilience:** 10 s upstream timeout, one retry on HTTP 5xx, generic actionable errors (no raw upstream bodies).
- **Rate limit:** Cloudflare `ratelimits` binding (default 60 requests/minute per client IP), overridable via `RATE_LIMIT_PER_MINUTE`.

## Pre-flight results (`--auth none`)

Offline run against the in-process Worker handler (same checks as `node scripts/preflight.mjs` against `wrangler dev`):

```
CHECK                                         LEVEL   MESSAGE
--------------------------------------------  -----   -------
mcp.initialize                                pass    initialize succeeded.
mcp.tools_list                                pass    tools/list returned 4 tools.
tool.search_documents.schema                  pass    search_documents: schema and annotations OK.
tool.get_document.schema                      pass    get_document: schema and annotations OK.
tool.list_agencies.schema                     pass    list_agencies: schema and annotations OK.
tool.list_public_inspection_documents.schema  pass    list_public_inspection_documents: schema and annotations OK.
tool.error_quality                            pass    Invalid tool call returned actionable error.
tool.response_size                            pass    Sample response within size budget.
```

Reproduce:

```bash
npx tsx scripts/preflight-offline.ts
# or, with a running worker:
node scripts/preflight.mjs http://127.0.0.1:8787/mcp --auth none \
  --sample '{"tool":"search_documents","arguments":{"term":"water","limit":1,"page":1,"order":"newest"}}'
```

## Deploy to your own Cloudflare account

1. Copy `wrangler.jsonc`, set a unique `name`, and choose a `ratelimits.namespace_id` per Cloudflare docs.
2. `npm ci && npx wrangler deploy` (requires your Cloudflare login and account — **not** run from this showcase build).
3. Point clients at `https://<your-worker>.workers.dev/mcp`.
4. Update `server.json` `remotes[0].url` if you publish to the MCP Registry under **your** namespace (`io.github.<you>/...`).

## Need a server like this for your API?

mcp.edge.report

---

Built with AI assistance and human review. Part of the mcp.edge.report showcase. MIT licensed.