Search and trace US federal rules across the Federal Register, eCFR, and Regulations.gov.
Search and trace US federal rules across the Federal Register (proposed/final rules and notices), the eCFR (codified, point-in-time CFR full text, locally mirrored), and Regulations.gov (rulemaking dockets and public comments) via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://federal-regulations.caseyjhand.com/mcp
US administrative law is where agencies turn statutes into binding rules — and it spans three official sources that don't talk to each other. This server stitches them into one workflow: the Federal Register (the daily journal of proposed/final rules and notices), the eCFR (the codified Code of Federal Regulations, full text, point-in-time), and Regulations.gov (rulemaking dockets and the public comments filed on them). Every Federal Register document carries the docket ID and CFR-part handles that chain across sources, so a rule can be traced proposal → comments → final → codified text in one sequence.
The agent sees regulatory verbs — search_rules, get_cfr_section, find_comments — not three API clients. The Federal Register and eCFR tools are keyless; the two Regulations.gov tools need a free api.data.gov key and return an actionable error without it.
Seven tools across the regulatory workflow. The Federal Register and eCFR tools (1–4, 7) are keyless. The two Regulations.gov tools (5–6) need REGULATIONS_GOV_API_KEY; regulations_list_open_comments runs keyless and only adds comment counts when the key is present.
| Tool | Source | Key | Description |
|---|---|---|---|
regulations_search_rules | Federal Register | — | Search proposed rules, final rules, notices, and presidential documents by query, type, agency, date range, and open-for-comment status. The primary discovery entry point. |
regulations_get_document | Federal Register | — | Fetch one FR document by number — full metadata plus the cross-source handles (docket ID, CFR parts, comment count) that chain into the comment and codified-text tools. |
regulations_browse_cfr | eCFR | — | Walk the CFR hierarchy (structure mode) or full-text-search the codified CFR (search mode). Both feed regulations_get_cfr_section. |
regulations_get_cfr_section | eCFR | — | Read the codified text at a CFR location — a section, a whole part, or an appendix — current or as of a past date. |
regulations_get_docket | Regulations.gov | ✔ | Pull a rulemaking docket and the documents filed in it (NPRM, final rule, supporting materials). |
regulations_find_comments | Regulations.gov | ✔ | Fetch public comments on a document or docket, or one comment's full body and attachments. Flags attachment-only submissions. |
regulations_list_open_comments | Federal Register (+ Reg.gov enrich) | optional | Rules currently open for public comment, closing soonest first. Fully functional keyless; enriches comment counts when keyed. |
regulations_search_rulesSearch the Federal Register — the daily journal of US proposed rules, final rules, notices, and presidential documents (1994–present). Keyless.
query across title and body, or browse by filters alonetype (PRORULE, RULE, NOTICE, PRESDOCU), agencies (Federal Register agency slug), and publication date window (published_after / published_before)documentNumber, docketIds, regulationIdNumbers (RIN), and cfrReferences that chain into the document, comment, and codified-text toolsregulations_get_documentFetch one Federal Register document by its FR number — the stitching tool of this server. Keyless.
regulations_get_docket / regulations_find_comments), affected CFR parts (→ regulations_get_cfr_section), and Regulations.gov document ID and comment count — each next to the tool name that consumes itinclude_full_text inlines the document body as plain text; default false returns the body URLs only (final rules can run tens of thousands of words)regulations_browse_cfrExplore the codified Code of Federal Regulations via eCFR in two modes. Keyless.
structure mode walks the CFR tree (all 50 titles, or one title's chapters → parts → sections) to discover a cite when the exact citation is unknownsearch mode runs a full-text query across the codified CFR and returns matching sections with their hierarchy path and a snippettitle and part scope both modes, so a part surfaced by structure can be searched directly instead of filtering a whole title's hits by eye. A part needs its title in either mode — part numbers repeat across the Code — and is matched exactly, so pass it as eCFR writes it (58, not Part 58 or 058)hierarchyPath names the part it sits in (Part 51 — Requirements for Preparation, Adoption, and Submittal of Implementation Plans), so the subject matter is readable without a second call; a mirror hit's path stays structural, because the index stores no level namesdate, or a cold deploy all go to the live eCFR search API insteadsource (mirror or live) and sourceScope — which corpus answered and what it covers, so an empty result is never mistaken for "no such regulation"date searches the section text in effect that day; eCFR indexes 2017-01-03 onward, and an undated search is pinned to eCFR's current index date rather than spanning every historical versioncfrCite that feeds regulations_get_cfr_section, and both hand appendices back the same way: an appendix field with eCFR's verbatim identifier, and a cite that names the appendix rather than the part around itsourceScope says so, since otherwise an appendix that exists and one that does not both read as zero matchesregulations_get_cfr_sectionRead the codified text at a CFR location — one section, a whole part, or one appendix — via eCFR. Keyless.
date for point-in-time texttitle + part + section for one section, or omit section to fetch the whole partappendix to read an appendix, passing the identifier verbatim as regulations_browse_cfr emits it (Appendix A-1 to Part 50, Schedule I to Part 789, Special Federal Aviation Regulation No. 88) — the identifiers are prose, not letters, and a short form matches nothingsource is reported); historical dates, whole-part fetches, appendix reads, and a cold mirror fall back to the live eCFR versioner[36 FR 22384, Nov. 25, 1971, as amended at 81 FR 68276, Oct. 3, 2016]) that leads back to the rulemakings behind the textregulations_browse_cfr structure mode, not a bare upstream statusregulations_get_docket · key requiredPull a rulemaking docket from Regulations.gov by docket ID (e.g. EPA-HQ-OAR-2025-0194). Requires REGULATIONS_GOV_API_KEY.
objectId feeds regulations_find_comments(document_object_id); frDocNum chains back to regulations_get_documentdocument_types to Proposed Rule / Rule to find the rule documents themselvesregulations_find_comments · key requiredFetch public comments — the unique corpus of what citizens and organizations actually submitted. Requires REGULATIONS_GOV_API_KEY.
docket_id (all comments in a docket), document_object_id (comments on one document), fr_document_number (convenience — resolves the FR number to its Regulations.gov document internally), or comment_id (one comment's full detail). Supplying two is rejected with an actionable error rather than resolved by precedencecomment_id to read a comment's bodyattachmentOnly is true; the attachment download URLs are returned so the agent knows where the substance lives. The flag reaches both the structured output and the rendered textregulations_list_open_commentsRules currently open for public comment, sorted by closing date (soonest first) — "what can I still weigh in on?" Keyless, degrades gracefully.
agencies (Federal Register slug) and query; closing_before finds deadlines you need to act on soondaysRemaining, the documentNumber (→ regulations_get_document), and docketIds (→ regulations_find_comments)REGULATIONS_GOV_API_KEY is configured, each row is enriched with the comment count read from the Federal Register document's own embedded Regulations.gov info (no extra rate-limited call)| Type | Name | Description |
|---|---|---|
| Resource | regulations://document/{documentNumber} | A single Federal Register document — metadata plus cross-source handles (mirrors regulations_get_document, full text omitted). |
| Resource | regulations://cfr/{title}/{part}/{section} | Codified text of a current CFR section (mirrors regulations_get_cfr_section at the current date, mirror-backed with a live eCFR fallback). |
All resource data is also reachable via the tool surface — tool-only MCP clients lose nothing. Collections (rule search, comment lists) are not exposed as resources; use regulations_search_rules and regulations_find_comments instead.
Built on @cyanheads/mcp-ts-core:
none, jwt, oauthin-memory, filesystem, Supabase, Cloudflare KV/R2/D1Federal-regulations-specific:
Retry-After on 429)Agent-friendly output:
source: "mirror" | "live" so agents know whether text came from the synced index or the live API, and on search a sourceScope line naming what that corpus coversattachmentOnly flags when a comment's substance is a file rather than inline text, with the download URLs, on both the structured and text surfacesauth_required errors — the two keyed tools name the env var and the free signup URL rather than passing through a raw 401/403A public instance is available at https://federal-regulations.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"federal-regulations-mcp-server": {
"type": "streamable-http",
"url": "https://federal-regulations.caseyjhand.com/mcp"
}
}
}
Add the following to your MCP client configuration file. The Federal Register and eCFR tools work with no key; set REGULATIONS_GOV_API_KEY (free at api.data.gov/signup) to enable the Regulations.gov docket and comment tools.
{
"mcpServers": {
"federal-regulations-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/federal-regulations-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"REGULATIONS_GOV_API_KEY": "your-key-here"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"federal-regulations-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/federal-regulations-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"REGULATIONS_GOV_API_KEY": "your-key-here"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"federal-regulations-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "REGULATIONS_GOV_API_KEY=your-key-here",
"ghcr.io/cyanheads/federal-regulations-mcp-server:latest"
]
}
}
}
Omit the
REGULATIONS_GOV_API_KEYline entirely to run the keyless core (Federal Register + eCFR). The two Regulations.gov tools then return an actionableauth_requirederror, andregulations_list_open_commentsruns without comment counts.
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp
regulations_get_docket, regulations_find_comments, and comment counts in regulations_list_open_comments). The Federal Register and eCFR tools need no key. The shared key allows 1,000 requests/hour.git clone https://github.com/cyanheads/federal-regulations-mcp-server.git
cd federal-regulations-mcp-server
bun install
cp .env.example .env
# optionally set REGULATIONS_GOV_API_KEY
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
| Variable | Description | Default |
|---|---|---|
REGULATIONS_GOV_API_KEY | api.data.gov key for the Regulations.gov tools (get_docket, find_comments, and comment-count enrichment in list_open_comments). Optional — the Federal Register and eCFR tools work without it. | — |
FEDERAL_REGISTER_BASE_URL | Federal Register API v1 base URL. | https://www.federalregister.gov/api/v1 |
ECFR_BASE_URL | eCFR API base URL. | https://www.ecfr.gov/api |
REGULATIONS_GOV_BASE_URL | Regulations.gov API v4 base URL. | https://api.regulations.gov/v4 |
ECFR_MIRROR_PATH | Filesystem path for the eCFR SQLite mirror database. | ./data/ecfr-mirror.sqlite |
ECFR_MIRROR_REFRESH_CRON | Cron expression for the weekly mirror refresh (HTTP transport only). | 0 4 * * 0 |
ECFR_MIRROR_TITLES | Comma-separated CFR title numbers to scope the mirror to (e.g. 21,40). Omit to mirror all 50 titles. Cites and searches outside the set fall through to the live eCFR API, as does any all-titles search while this is set. | — (all titles) |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | Port for the HTTP server. | 3010 |
MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
MCP_LOG_LEVEL | Log level (RFC 5424). | info |
STORAGE_PROVIDER_TYPE | Storage backend. | in-memory |
OTEL_ENABLED | Enable OpenTelemetry instrumentation. | false |
See .env.example for the full list of optional overrides.
The codified CFR is large (~50 titles, hundreds of MB of XML — Title 40 alone is ~150 MB) but changes far less often than it is queried. This server mirrors it once into an embedded SQLite + FTS5 index and serves regulations_get_cfr_section (current single sections) and regulations_browse_cfr (full-text search) from it, falling back to the live eCFR API when the mirror has not yet completed an init or a historical/whole-part read is requested.
The mirror answers only what it holds. A scoped mirror (ECFR_MIRROR_TITLES) is consulted for a search only when the requested title is in the set, and never for an all-titles search — a three-title index reporting zero matches for the whole CFR is worse than no index at all. Those requests go to live eCFR instead, and every search result names the corpus that answered it in sourceScope.
The mirror is populated out-of-band, never on startup — a full title sweep takes a while and must not block the server. Build it with:
# Mirror all 50 CFR titles (idempotent, resumable from the persisted cursor)
bun run mirror:init
# Or scope to specific titles to build a smaller, faster mirror
ECFR_MIRROR_TITLES=21,40 bun run mirror:init
# Incremental refresh against the latest eCFR issues
bun run mirror:refresh
# Report row counts, the last-synced issue date, and whether the index is stale
bun run mirror:verify
A sync pass deletes only what it read in full. Each title's pass removes the rows the pass did not rewrite — how a withdrawn section leaves the index. A response that arrives cut short parses to a prefix of the title, which is indistinguishable from a title that shrank, so the pass first checks that the document it read is whole (its root element is closed) and leaves the title untouched when it is not, rather than deleting everything past the cut and reporting the run complete.
An index written by an older ingester is not served. The ingester stamps a version into the mirror once a run has re-derived every title the index holds; when a release changes how rows are derived, an index carrying an older stamp is treated exactly like a cold one — every read falls back to live eCFR until bun run mirror:refresh re-derives it. mirror:verify says so explicitly, and a refresh removes the rows the previous ingester filed under keys the current one no longer produces. A run that skips a title — a failed fetch, or an ECFR_MIRROR_TITLES scope narrower than the index — names it in the log and leaves the stamp unwritten, because those untouched titles are exactly the ones a stamp would certify wrongly.
Until the mirror has completed an init, the codified-text tools run against the live eCFR API — so the server is useful immediately on a fresh deploy; the mirror is a latency/throughput optimization, not a hard dependency. On the HTTP transport a weekly refresh is scheduled automatically (ECFR_MIRROR_REFRESH_CRON); stdio operators run the lifecycle scripts above.
The mirror database (./data/ecfr-mirror.sqlite) is a local artifact — it is git-ignored and excluded from the .mcpb bundle, never shipped in the package.
Build and run:
# One-time build
bun run rebuild
# Run the built server
bun run start:stdio
# or
bun run start:http
Run checks and tests:
bun run devcheck # Lint, format, typecheck, security, changelog sync
bun run test # Vitest test suite
bun run lint:mcp # Validate MCP definitions against the linter rules
docker build -t federal-regulations-mcp-server .
docker run --rm -e REGULATIONS_GOV_API_KEY=your-key -p 3010:3010 federal-regulations-mcp-server
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/federal-regulations-mcp-server. The build stage installs dependencies with --ignore-scripts — better-sqlite3 is a build/ingest-only dependency whose native compile is skipped, and the runtime reads the mirror through Bun's built-in bun:sqlite. Populate the mirror in a running container with docker exec <container> bun run mirror:init; mount a volume over /usr/src/app/data so the synced index survives container recreation. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
| Directory | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools/resources, inits the three services, and schedules the mirror refresh on HTTP. |
src/config | Server-specific environment variable parsing and validation with Zod. |
src/mcp-server/tools | Tool definitions (*.tool.ts) — the seven regulations_* tools. |
src/mcp-server/resources | Resource definitions (*.resource.ts) — the document and CFR-section resources. |
src/services/federal-register | Federal Register API v1 client (keyless). |
src/services/ecfr | eCFR API client (keyless) — versioner, structure, search, and section XML parsing. |
src/services/ecfr-mirror | eCFR codified-text mirror (MirrorService — SQLite + FTS5) and its read path. |
src/services/regulations-gov | Regulations.gov v4 client (X-Api-Key) — dockets and comments. |
scripts/ecfr-mirror-*.ts | Out-of-band mirror lifecycle: init, refresh, verify. |
tests/ | Unit and integration tests mirroring src/. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for request-scoped logging, ctx.state for tenant-scoped storagesrc/mcp-server/*/definitions/index.tsIssues and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
eCFR content is "authoritative but unofficial" per the Office of the Federal Register — it is not the official legal edition of the Code of Federal Regulations. The official CFR is published annually in print and digitally at govinfo.gov. For legal research requiring the official text, verify against govinfo.gov or the annual printed CFR.
This server is not affiliated with or endorsed by the Office of the Federal Register (OFR), the Government Publishing Office (GPO), or the General Services Administration (GSA).
Apache-2.0 — see LICENSE for details.
cyanheads/libofcongress-mcp-server-11fb4479
cyanheads/nist-nvd-mcp-server-c5525bbf
cyanheads/noaa-marine-mcp-server
cyanheads/noaa-spaceweather-mcp-server
cyanheads/oecd-mcp-server
cyanheads/openfoodfacts-mcp-server-0413dfe8