@cyanheads/federal-regulations-mcp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +387 -0
- package/CLAUDE.md +387 -0
- package/Dockerfile +127 -0
- package/LICENSE +201 -0
- package/README.md +372 -0
- package/changelog/0.1.x/0.1.0.md +20 -0
- package/changelog/template.md +127 -0
- package/dist/config/server-config.d.ts +32 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +64 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/cfr-section.resource.d.ts +14 -0
- package/dist/mcp-server/resources/definitions/cfr-section.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/cfr-section.resource.js +77 -0
- package/dist/mcp-server/resources/definitions/cfr-section.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/document.resource.d.ts +12 -0
- package/dist/mcp-server/resources/definitions/document.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/document.resource.js +38 -0
- package/dist/mcp-server/resources/definitions/document.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/index.d.ts +12 -0
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/index.js +8 -0
- package/dist/mcp-server/resources/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.d.ts +73 -0
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.js +205 -0
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/find-comments.tool.d.ts +85 -0
- package/dist/mcp-server/tools/definitions/find-comments.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/find-comments.tool.js +271 -0
- package/dist/mcp-server/tools/definitions/find-comments.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/format-utils.d.ts +7 -0
- package/dist/mcp-server/tools/definitions/format-utils.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/format-utils.js +9 -0
- package/dist/mcp-server/tools/definitions/format-utils.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.d.ts +50 -0
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.js +152 -0
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-docket.tool.d.ts +67 -0
- package/dist/mcp-server/tools/definitions/get-docket.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-docket.tool.js +154 -0
- package/dist/mcp-server/tools/definitions/get-docket.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-document.tool.d.ts +51 -0
- package/dist/mcp-server/tools/definitions/get-document.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-document.tool.js +138 -0
- package/dist/mcp-server/tools/definitions/get-document.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +356 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +21 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-open-comments.tool.d.ts +47 -0
- package/dist/mcp-server/tools/definitions/list-open-comments.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-open-comments.tool.js +179 -0
- package/dist/mcp-server/tools/definitions/list-open-comments.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-rules.tool.d.ts +57 -0
- package/dist/mcp-server/tools/definitions/search-rules.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-rules.tool.js +185 -0
- package/dist/mcp-server/tools/definitions/search-rules.tool.js.map +1 -0
- package/dist/services/ecfr/ecfr-service.d.ts +54 -0
- package/dist/services/ecfr/ecfr-service.d.ts.map +1 -0
- package/dist/services/ecfr/ecfr-service.js +303 -0
- package/dist/services/ecfr/ecfr-service.js.map +1 -0
- package/dist/services/ecfr/types.d.ts +105 -0
- package/dist/services/ecfr/types.d.ts.map +1 -0
- package/dist/services/ecfr/types.js +7 -0
- package/dist/services/ecfr/types.js.map +1 -0
- package/dist/services/ecfr/xml.d.ts +15 -0
- package/dist/services/ecfr/xml.d.ts.map +1 -0
- package/dist/services/ecfr/xml.js +103 -0
- package/dist/services/ecfr/xml.js.map +1 -0
- package/dist/services/ecfr-mirror/ecfr-mirror.d.ts +43 -0
- package/dist/services/ecfr-mirror/ecfr-mirror.d.ts.map +1 -0
- package/dist/services/ecfr-mirror/ecfr-mirror.js +267 -0
- package/dist/services/ecfr-mirror/ecfr-mirror.js.map +1 -0
- package/dist/services/federal-register/federal-register-service.d.ts +30 -0
- package/dist/services/federal-register/federal-register-service.d.ts.map +1 -0
- package/dist/services/federal-register/federal-register-service.js +241 -0
- package/dist/services/federal-register/federal-register-service.js.map +1 -0
- package/dist/services/federal-register/types.d.ts +138 -0
- package/dist/services/federal-register/types.d.ts.map +1 -0
- package/dist/services/federal-register/types.js +8 -0
- package/dist/services/federal-register/types.js.map +1 -0
- package/dist/services/regulations-gov/regulations-gov-service.d.ts +55 -0
- package/dist/services/regulations-gov/regulations-gov-service.d.ts.map +1 -0
- package/dist/services/regulations-gov/regulations-gov-service.js +283 -0
- package/dist/services/regulations-gov/regulations-gov-service.js.map +1 -0
- package/dist/services/regulations-gov/types.d.ts +148 -0
- package/dist/services/regulations-gov/types.d.ts.map +1 -0
- package/dist/services/regulations-gov/types.js +7 -0
- package/dist/services/regulations-gov/types.js.map +1 -0
- package/dist/services/request-context.d.ts +13 -0
- package/dist/services/request-context.d.ts.map +1 -0
- package/dist/services/request-context.js +23 -0
- package/dist/services/request-context.js.map +1 -0
- package/package.json +94 -0
- package/scripts/_mirror-context.ts +101 -0
- package/scripts/ecfr-mirror-init.ts +36 -0
- package/scripts/ecfr-mirror-refresh.ts +29 -0
- package/scripts/ecfr-mirror-verify.ts +33 -0
- package/server.json +113 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
# FORMAT REFERENCE — do not edit. Copy this file to
|
|
3
|
+
# `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
|
|
4
|
+
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
|
+
# with a concrete date.
|
|
6
|
+
|
|
7
|
+
# Required. One-line GitHub Release-style headline. 350 character cap.
|
|
8
|
+
# Default short and scannable. Don't pad, don't stitch unrelated changes with
|
|
9
|
+
# semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
|
|
10
|
+
# inside the value as a key separator and fails GitHub's strict parser.
|
|
11
|
+
summary: ""
|
|
12
|
+
|
|
13
|
+
# Set `true` when consumers must change code to upgrade: API removals,
|
|
14
|
+
# signature changes, config renames, behavior changes that break existing
|
|
15
|
+
# usage. Flagged as `Breaking` in the rollup.
|
|
16
|
+
breaking: false
|
|
17
|
+
|
|
18
|
+
# Set `true` if this release contains any security fix. Pairs with the
|
|
19
|
+
# `## Security` section below. Flagged as `Security` in the rollup so
|
|
20
|
+
# users can triage upgrade urgency at a glance.
|
|
21
|
+
security: false
|
|
22
|
+
|
|
23
|
+
# Optional free-form notes for maintenance agents processing this release.
|
|
24
|
+
# Not rendered in CHANGELOG — consumed by agents running `maintenance` on
|
|
25
|
+
# downstream servers. Use for adoption instructions that don't fit the
|
|
26
|
+
# human-facing sections: new files to create, fields to populate, one-time
|
|
27
|
+
# migration steps. Omit the field entirely when there's nothing to say.
|
|
28
|
+
# agent-notes: |
|
|
29
|
+
# <instructions for downstream maintenance agents>
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# <version> — YYYY-MM-DD
|
|
33
|
+
|
|
34
|
+
<!--
|
|
35
|
+
AUTHORING GUIDE — applies to the new per-version file you create from this
|
|
36
|
+
template.
|
|
37
|
+
|
|
38
|
+
Audience: someone scanning release notes to decide what affects them. Lead
|
|
39
|
+
each bullet with the symbol or concept name in **bold** so they can skip
|
|
40
|
+
what's irrelevant and zoom in on what's not.
|
|
41
|
+
|
|
42
|
+
Tone: terse, fact-dense, not verbose. Default to one sentence per bullet —
|
|
43
|
+
name the symbol, state what changed, stop. Use a second sentence only when
|
|
44
|
+
it carries weight. If a bullet feels long, it is.
|
|
45
|
+
|
|
46
|
+
Cut: mechanism walkthroughs (those belong in JSDoc, CLAUDE.md/AGENTS.md, or the
|
|
47
|
+
relevant skill), ceremonial framings ("This release introduces…",
|
|
48
|
+
backwards-compat paragraphs), file-by-file test enumerations, internal
|
|
49
|
+
implementation notes. Prefer code/symbol names over English re-explanations.
|
|
50
|
+
|
|
51
|
+
Narrative intro: skip by default. Add one short sentence only when the
|
|
52
|
+
release theme genuinely needs framing the bullets can't carry.
|
|
53
|
+
|
|
54
|
+
Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
|
|
55
|
+
Fixed, Security. Include only sections with entries; delete the rest
|
|
56
|
+
(including the commented-out scaffolding below). Don't ship empty headers.
|
|
57
|
+
|
|
58
|
+
Include: every distinct fact a reader needs to adopt or audit the release —
|
|
59
|
+
new exports, signatures, lint rule IDs, env vars, breaking changes, version
|
|
60
|
+
bumps on shipped skills. Nothing more.
|
|
61
|
+
|
|
62
|
+
Links: link issues, PRs, docs, or skills where they help a reader jump to
|
|
63
|
+
context. Once per item per entry — don't re-link the same issue in summary,
|
|
64
|
+
narrative, and bullet. Skip links for inline symbol names; code spans speak
|
|
65
|
+
for themselves.
|
|
66
|
+
|
|
67
|
+
Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
|
|
68
|
+
inside its own UI, not in npm reads or local editors.
|
|
69
|
+
|
|
70
|
+
[#38](https://github.com/cyanheads/mcp-ts-core/issues/38) ← issue
|
|
71
|
+
[#42](https://github.com/cyanheads/mcp-ts-core/pull/42) ← PR
|
|
72
|
+
|
|
73
|
+
Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
|
|
74
|
+
Never speculate on a future number — `#42` for an upcoming PR silently
|
|
75
|
+
resolves to whatever real item already owns 42, and timeline previews pull
|
|
76
|
+
in that unrelated item's metadata.
|
|
77
|
+
|
|
78
|
+
TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
|
|
79
|
+
via `gh release create --notes-from-tag`. The tag is a derivative of this
|
|
80
|
+
changelog entry — a condensed, scannable version, not a copy. Format:
|
|
81
|
+
|
|
82
|
+
<theme — omit version number, GitHub prepends it>
|
|
83
|
+
← blank line
|
|
84
|
+
<1-2 sentence context: what this release does>
|
|
85
|
+
← blank line
|
|
86
|
+
Dependency bumps: ← section header
|
|
87
|
+
← blank line
|
|
88
|
+
- `@cyanheads/mcp-ts-core` ^0.9.1 → ^0.9.6 ← bullet
|
|
89
|
+
← blank line
|
|
90
|
+
Changed: ← only sections with entries
|
|
91
|
+
← blank line
|
|
92
|
+
- `format()` output includes `query` in text mode
|
|
93
|
+
← blank line
|
|
94
|
+
Added:
|
|
95
|
+
← blank line
|
|
96
|
+
- `manifest.json` scaffolded for MCPB bundle support
|
|
97
|
+
- Install badges (Claude Desktop, Cursor, VS Code)
|
|
98
|
+
← blank line
|
|
99
|
+
<N> tests pass; `bun run devcheck` clean. ← footer
|
|
100
|
+
|
|
101
|
+
Never a flat comma-separated string. Always structured markdown with
|
|
102
|
+
sections. The tag must scan well as a rendered GitHub Release page.
|
|
103
|
+
-->
|
|
104
|
+
|
|
105
|
+
## Added
|
|
106
|
+
|
|
107
|
+
-
|
|
108
|
+
|
|
109
|
+
## Changed
|
|
110
|
+
|
|
111
|
+
-
|
|
112
|
+
|
|
113
|
+
<!-- ## Deprecated
|
|
114
|
+
|
|
115
|
+
- -->
|
|
116
|
+
|
|
117
|
+
<!-- ## Removed
|
|
118
|
+
|
|
119
|
+
- -->
|
|
120
|
+
|
|
121
|
+
## Fixed
|
|
122
|
+
|
|
123
|
+
-
|
|
124
|
+
|
|
125
|
+
<!-- ## Security
|
|
126
|
+
|
|
127
|
+
- -->
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific environment configuration for
|
|
3
|
+
* federal-regulations-mcp-server. Lazy-parsed Zod schema, separate from the
|
|
4
|
+
* framework's own config. Maps the three data-source base URLs, the optional
|
|
5
|
+
* Regulations.gov API key, and the eCFR mirror settings.
|
|
6
|
+
*
|
|
7
|
+
* `REGULATIONS_GOV_API_KEY` is optional: the keyless core (Federal Register +
|
|
8
|
+
* eCFR tools) is a complete deployment without it. The two Regulations.gov tools
|
|
9
|
+
* enforce its presence per-call (an actionable `auth_required` error), so its
|
|
10
|
+
* absence is a valid startup state, not a configuration failure.
|
|
11
|
+
*
|
|
12
|
+
* @module config/server-config
|
|
13
|
+
*/
|
|
14
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
15
|
+
declare const ServerConfigSchema: z.ZodObject<{
|
|
16
|
+
regulationsGovApiKey: z.ZodOptional<z.ZodString>;
|
|
17
|
+
federalRegisterBaseUrl: z.ZodDefault<z.ZodString>;
|
|
18
|
+
ecfrBaseUrl: z.ZodDefault<z.ZodString>;
|
|
19
|
+
regulationsGovBaseUrl: z.ZodDefault<z.ZodString>;
|
|
20
|
+
ecfrMirrorPath: z.ZodDefault<z.ZodString>;
|
|
21
|
+
ecfrMirrorRefreshCron: z.ZodDefault<z.ZodString>;
|
|
22
|
+
ecfrMirrorTitles: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* Lazily parse and cache the server config from the environment. Throws a
|
|
27
|
+
* `ConfigurationError` (rendered as a clean startup banner) when a provided
|
|
28
|
+
* value fails validation.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getServerConfig(): ServerConfig;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB;;;;;;;;iBA+BtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAW9C"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific environment configuration for
|
|
3
|
+
* federal-regulations-mcp-server. Lazy-parsed Zod schema, separate from the
|
|
4
|
+
* framework's own config. Maps the three data-source base URLs, the optional
|
|
5
|
+
* Regulations.gov API key, and the eCFR mirror settings.
|
|
6
|
+
*
|
|
7
|
+
* `REGULATIONS_GOV_API_KEY` is optional: the keyless core (Federal Register +
|
|
8
|
+
* eCFR tools) is a complete deployment without it. The two Regulations.gov tools
|
|
9
|
+
* enforce its presence per-call (an actionable `auth_required` error), so its
|
|
10
|
+
* absence is a valid startup state, not a configuration failure.
|
|
11
|
+
*
|
|
12
|
+
* @module config/server-config
|
|
13
|
+
*/
|
|
14
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
15
|
+
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
16
|
+
const ServerConfigSchema = z.object({
|
|
17
|
+
/** api.data.gov key for the Regulations.gov leg. Absent = keyless-core deployment. */
|
|
18
|
+
regulationsGovApiKey: z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('api.data.gov key for the Regulations.gov tools (get_docket, find_comments).'),
|
|
22
|
+
federalRegisterBaseUrl: z
|
|
23
|
+
.string()
|
|
24
|
+
.url()
|
|
25
|
+
.default('https://www.federalregister.gov/api/v1')
|
|
26
|
+
.describe('Federal Register API v1 base URL.'),
|
|
27
|
+
ecfrBaseUrl: z.string().url().default('https://www.ecfr.gov/api').describe('eCFR API base URL.'),
|
|
28
|
+
regulationsGovBaseUrl: z
|
|
29
|
+
.string()
|
|
30
|
+
.url()
|
|
31
|
+
.default('https://api.regulations.gov/v4')
|
|
32
|
+
.describe('Regulations.gov API v4 base URL.'),
|
|
33
|
+
ecfrMirrorPath: z
|
|
34
|
+
.string()
|
|
35
|
+
.default('./data/ecfr-mirror.sqlite')
|
|
36
|
+
.describe('Filesystem path for the eCFR SQLite mirror database.'),
|
|
37
|
+
ecfrMirrorRefreshCron: z
|
|
38
|
+
.string()
|
|
39
|
+
.default('0 4 * * 0')
|
|
40
|
+
.describe('Cron expression for the weekly eCFR mirror refresh.'),
|
|
41
|
+
ecfrMirrorTitles: z
|
|
42
|
+
.string()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Comma-separated CFR title numbers to scope the mirror to (e.g. "21,40"). Omit to mirror all 50 titles. A partial mirror still serves its baked titles from the index; cites outside the set fall through to the live eCFR API.'),
|
|
45
|
+
});
|
|
46
|
+
let _config;
|
|
47
|
+
/**
|
|
48
|
+
* Lazily parse and cache the server config from the environment. Throws a
|
|
49
|
+
* `ConfigurationError` (rendered as a clean startup banner) when a provided
|
|
50
|
+
* value fails validation.
|
|
51
|
+
*/
|
|
52
|
+
export function getServerConfig() {
|
|
53
|
+
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
54
|
+
regulationsGovApiKey: 'REGULATIONS_GOV_API_KEY',
|
|
55
|
+
federalRegisterBaseUrl: 'FEDERAL_REGISTER_BASE_URL',
|
|
56
|
+
ecfrBaseUrl: 'ECFR_BASE_URL',
|
|
57
|
+
regulationsGovBaseUrl: 'REGULATIONS_GOV_BASE_URL',
|
|
58
|
+
ecfrMirrorPath: 'ECFR_MIRROR_PATH',
|
|
59
|
+
ecfrMirrorRefreshCron: 'ECFR_MIRROR_REFRESH_CRON',
|
|
60
|
+
ecfrMirrorTitles: 'ECFR_MIRROR_TITLES',
|
|
61
|
+
});
|
|
62
|
+
return _config;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=server-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,sFAAsF;IACtF,oBAAoB,EAAE,CAAC;SACpB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6EAA6E,CAAC;IAC1F,sBAAsB,EAAE,CAAC;SACtB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,wCAAwC,CAAC;SACjD,QAAQ,CAAC,mCAAmC,CAAC;IAChD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IAChG,qBAAqB,EAAE,CAAC;SACrB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,gCAAgC,CAAC;SACzC,QAAQ,CAAC,kCAAkC,CAAC;IAC/C,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,OAAO,CAAC,2BAA2B,CAAC;SACpC,QAAQ,CAAC,sDAAsD,CAAC;IACnE,qBAAqB,EAAE,CAAC;SACrB,MAAM,EAAE;SACR,OAAO,CAAC,WAAW,CAAC;SACpB,QAAQ,CAAC,qDAAqD,CAAC;IAClE,gBAAgB,EAAE,CAAC;SAChB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,gOAAgO,CACjO;CACJ,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,oBAAoB,EAAE,yBAAyB;QAC/C,sBAAsB,EAAE,2BAA2B;QACnD,WAAW,EAAE,eAAe;QAC5B,qBAAqB,EAAE,0BAA0B;QACjD,cAAc,EAAE,kBAAkB;QAClC,qBAAqB,EAAE,0BAA0B;QACjD,gBAAgB,EAAE,oBAAoB;KACvC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview federal-regulations-mcp-server entry point. Wires the three
|
|
4
|
+
* data-source services (Federal Register, eCFR, Regulations.gov) and registers
|
|
5
|
+
* the codified-CFR mirror's weekly refresh on a cron — gated to the HTTP
|
|
6
|
+
* transport so stdio operators (who run the mirror lifecycle out-of-band) don't
|
|
7
|
+
* double-run it. The mirror's full init is never run here; it is an out-of-band
|
|
8
|
+
* `mirror:init` CLI step.
|
|
9
|
+
* @module index
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview federal-regulations-mcp-server entry point. Wires the three
|
|
4
|
+
* data-source services (Federal Register, eCFR, Regulations.gov) and registers
|
|
5
|
+
* the codified-CFR mirror's weekly refresh on a cron — gated to the HTTP
|
|
6
|
+
* transport so stdio operators (who run the mirror lifecycle out-of-band) don't
|
|
7
|
+
* double-run it. The mirror's full init is never run here; it is an out-of-band
|
|
8
|
+
* `mirror:init` CLI step.
|
|
9
|
+
* @module index
|
|
10
|
+
*/
|
|
11
|
+
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
12
|
+
import { logger, requestContextService, schedulerService } from '@cyanheads/mcp-ts-core/utils';
|
|
13
|
+
import { getServerConfig } from './config/server-config.js';
|
|
14
|
+
import { allResourceDefinitions } from './mcp-server/resources/definitions/index.js';
|
|
15
|
+
import { allToolDefinitions } from './mcp-server/tools/definitions/index.js';
|
|
16
|
+
import { initEcfrService } from './services/ecfr/ecfr-service.js';
|
|
17
|
+
import { ecfrMirror } from './services/ecfr-mirror/ecfr-mirror.js';
|
|
18
|
+
import { initFederalRegisterService } from './services/federal-register/federal-register-service.js';
|
|
19
|
+
import { initRegulationsGovService } from './services/regulations-gov/regulations-gov-service.js';
|
|
20
|
+
const MIRROR_REFRESH_JOB = 'ecfr-mirror-refresh';
|
|
21
|
+
await createApp({
|
|
22
|
+
name: 'federal-regulations-mcp-server',
|
|
23
|
+
title: 'federal-regulations-mcp-server',
|
|
24
|
+
tools: allToolDefinitions,
|
|
25
|
+
resources: allResourceDefinitions,
|
|
26
|
+
prompts: [],
|
|
27
|
+
instructions: 'US federal regulatory law over three official sources. The Federal Register (regulations_search_rules, regulations_get_document, regulations_list_open_comments) and eCFR (regulations_browse_cfr, regulations_get_cfr_section) tools are keyless. The Regulations.gov tools (regulations_get_docket, regulations_find_comments) need REGULATIONS_GOV_API_KEY (free at https://api.data.gov/signup/) and return an actionable auth_required error without it; regulations_list_open_comments runs keyless and only adds comment counts when the key is present. Trace a rule end to end: search_rules → get_document (yields docket ID + CFR parts) → find_comments → get_cfr_section.',
|
|
28
|
+
setup(core) {
|
|
29
|
+
initFederalRegisterService(core.config, core.storage);
|
|
30
|
+
initEcfrService(core.config, core.storage);
|
|
31
|
+
initRegulationsGovService(core.config, core.storage);
|
|
32
|
+
// Register the weekly mirror refresh on HTTP only. Stdio operators run the
|
|
33
|
+
// mirror lifecycle (init/refresh) out-of-band via the CLI scripts, so the
|
|
34
|
+
// cron would otherwise double-run. Init is never triggered here.
|
|
35
|
+
if (core.config.mcpTransportType === 'http') {
|
|
36
|
+
const cron = getServerConfig().ecfrMirrorRefreshCron;
|
|
37
|
+
void schedulerService
|
|
38
|
+
.schedule(MIRROR_REFRESH_JOB, cron, async () => {
|
|
39
|
+
await ecfrMirror.runSync({ mode: 'refresh' });
|
|
40
|
+
}, 'Weekly incremental refresh of the codified CFR mirror')
|
|
41
|
+
.then(() => schedulerService.start(MIRROR_REFRESH_JOB))
|
|
42
|
+
.catch((err) => {
|
|
43
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
44
|
+
logger.warning(`Failed to schedule eCFR mirror refresh: ${message}`, requestContextService.createRequestContext({
|
|
45
|
+
operation: 'setup:schedule-mirror-refresh',
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,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AoB,CAAC;oBACzC,SAAS,EAAE,+BAA+B;iBAC3C,CAAC,CACH,CAAC;YACJ,CAAC,CAAC,CAAC;QACP,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview regulations://cfr/{title}/{part}/{section} — codified text of a
|
|
3
|
+
* current CFR section, the same payload as regulations_get_cfr_section at the
|
|
4
|
+
* current date, for clients that support injectable context. Mirror-backed with a
|
|
5
|
+
* live eCFR fallback. Every datum is also reachable through the tool surface.
|
|
6
|
+
* @module mcp-server/resources/definitions/cfr-section.resource
|
|
7
|
+
*/
|
|
8
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
9
|
+
export declare const cfrSectionResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
10
|
+
title: z.ZodString;
|
|
11
|
+
part: z.ZodString;
|
|
12
|
+
section: z.ZodString;
|
|
13
|
+
}, z.core.$strip>, undefined, undefined>;
|
|
14
|
+
//# sourceMappingURL=cfr-section.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cfr-section.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/cfr-section.resource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAKrD,eAAO,MAAM,kBAAkB;;;;wCAiF7B,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview regulations://cfr/{title}/{part}/{section} — codified text of a
|
|
3
|
+
* current CFR section, the same payload as regulations_get_cfr_section at the
|
|
4
|
+
* current date, for clients that support injectable context. Mirror-backed with a
|
|
5
|
+
* live eCFR fallback. Every datum is also reachable through the tool surface.
|
|
6
|
+
* @module mcp-server/resources/definitions/cfr-section.resource
|
|
7
|
+
*/
|
|
8
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
9
|
+
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
10
|
+
import { getEcfrService } from '../../../services/ecfr/ecfr-service.js';
|
|
11
|
+
import { mirrorGetSection, mirrorReady } from '../../../services/ecfr-mirror/ecfr-mirror.js';
|
|
12
|
+
export const cfrSectionResource = resource('regulations://cfr/{title}/{part}/{section}', {
|
|
13
|
+
name: 'cfr-section',
|
|
14
|
+
title: 'CFR section (current)',
|
|
15
|
+
description: 'Codified text of a current CFR section by title/part/section (e.g. regulations://cfr/40/50/50.1). Mirrors regulations_get_cfr_section at the current date — mirror-backed with a live eCFR fallback.',
|
|
16
|
+
mimeType: 'application/json',
|
|
17
|
+
params: z.object({
|
|
18
|
+
title: z
|
|
19
|
+
.string()
|
|
20
|
+
.regex(/^\d{1,2}$/)
|
|
21
|
+
.describe('CFR title number (1–50).'),
|
|
22
|
+
part: z.string().describe('CFR part (e.g. "50").'),
|
|
23
|
+
section: z.string().describe('Section identifier (e.g. "50.1").'),
|
|
24
|
+
}),
|
|
25
|
+
async handler(params, ctx) {
|
|
26
|
+
const titleNum = Number.parseInt(params.title, 10);
|
|
27
|
+
const service = getEcfrService();
|
|
28
|
+
if (await mirrorReady()) {
|
|
29
|
+
const hit = await mirrorGetSection(titleNum, params.part, params.section);
|
|
30
|
+
if (hit) {
|
|
31
|
+
const hierarchyPath = await service.hierarchyPath(titleNum, params.part, params.section, hit.date, ctx);
|
|
32
|
+
return {
|
|
33
|
+
cfrCite: `${titleNum} CFR ${params.section}`,
|
|
34
|
+
title: titleNum,
|
|
35
|
+
part: params.part,
|
|
36
|
+
section: params.section,
|
|
37
|
+
heading: hit.heading,
|
|
38
|
+
hierarchyPath,
|
|
39
|
+
date: hit.date,
|
|
40
|
+
source: 'mirror',
|
|
41
|
+
bodyText: hit.bodyText,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const date = await service.latestIssueDate(titleNum, ctx);
|
|
46
|
+
const result = await service.getSectionText(titleNum, params.part, params.section, date, ctx);
|
|
47
|
+
if (!result.bodyText) {
|
|
48
|
+
throw notFound(`No codified text for ${titleNum} CFR ${params.section}.`, {
|
|
49
|
+
title: titleNum,
|
|
50
|
+
part: params.part,
|
|
51
|
+
section: params.section,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const hierarchyPath = await service.hierarchyPath(titleNum, params.part, params.section, result.date, ctx);
|
|
55
|
+
return {
|
|
56
|
+
cfrCite: `${titleNum} CFR ${params.section}`,
|
|
57
|
+
title: titleNum,
|
|
58
|
+
part: params.part,
|
|
59
|
+
section: params.section,
|
|
60
|
+
heading: result.heading,
|
|
61
|
+
hierarchyPath,
|
|
62
|
+
date: result.date,
|
|
63
|
+
source: 'live',
|
|
64
|
+
bodyText: result.bodyText,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
list: () => ({
|
|
68
|
+
resources: [
|
|
69
|
+
{
|
|
70
|
+
uri: 'regulations://cfr/40/50/50.1',
|
|
71
|
+
name: 'Example CFR section (40 CFR 50.1)',
|
|
72
|
+
mimeType: 'application/json',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=cfr-section.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cfr-section.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/cfr-section.resource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,4CAA4C,EAA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CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview regulations://document/{documentNumber} — a single Federal
|
|
3
|
+
* Register document (metadata + cross-source handles, full text omitted), the
|
|
4
|
+
* same payload as regulations_get_document for clients that support injectable
|
|
5
|
+
* context. Every datum is also reachable through the tool surface.
|
|
6
|
+
* @module mcp-server/resources/definitions/document.resource
|
|
7
|
+
*/
|
|
8
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
9
|
+
export declare const documentResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
10
|
+
documentNumber: z.ZodString;
|
|
11
|
+
}, z.core.$strip>, undefined, undefined>;
|
|
12
|
+
//# sourceMappingURL=document.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/document.resource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGrD,eAAO,MAAM,gBAAgB;;wCA8B3B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview regulations://document/{documentNumber} — a single Federal
|
|
3
|
+
* Register document (metadata + cross-source handles, full text omitted), the
|
|
4
|
+
* same payload as regulations_get_document for clients that support injectable
|
|
5
|
+
* context. Every datum is also reachable through the tool surface.
|
|
6
|
+
* @module mcp-server/resources/definitions/document.resource
|
|
7
|
+
*/
|
|
8
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
9
|
+
import { getFederalRegisterService } from '../../../services/federal-register/federal-register-service.js';
|
|
10
|
+
export const documentResource = resource('regulations://document/{documentNumber}', {
|
|
11
|
+
name: 'federal-register-document',
|
|
12
|
+
title: 'Federal Register document',
|
|
13
|
+
description: 'A single Federal Register document by FR number: metadata plus the cross-source handles (docket ID, affected CFR parts, comment count) that chain into the comment and codified-text tools. Mirrors regulations_get_document (full text omitted).',
|
|
14
|
+
mimeType: 'application/json',
|
|
15
|
+
params: z.object({
|
|
16
|
+
documentNumber: z
|
|
17
|
+
.string()
|
|
18
|
+
.regex(/^[0-9]{4}-[0-9]+$/)
|
|
19
|
+
.describe('Federal Register document number (e.g. "2025-14555").'),
|
|
20
|
+
}),
|
|
21
|
+
async handler(params, ctx) {
|
|
22
|
+
const service = getFederalRegisterService();
|
|
23
|
+
const detail = await service.getDocument(params.documentNumber, false, ctx);
|
|
24
|
+
// Drop the (absent) fullText field; the resource omits the body by contract.
|
|
25
|
+
const { fullText: _omit, ...rest } = detail;
|
|
26
|
+
return rest;
|
|
27
|
+
},
|
|
28
|
+
list: () => ({
|
|
29
|
+
resources: [
|
|
30
|
+
{
|
|
31
|
+
uri: 'regulations://document/2025-14555',
|
|
32
|
+
name: 'Example Federal Register document',
|
|
33
|
+
mimeType: 'application/json',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=document.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/document.resource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AAEpG,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,yCAAyC,EAAE;IAClF,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE,2BAA2B;IAClC,WAAW,EACT,mPAAmP;IACrP,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,KAAK,CAAC,mBAAmB,CAAC;aAC1B,QAAQ,CAAC,uDAAuD,CAAC;KACrE,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,OAAO,GAAG,yBAAyB,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC5E,6EAA6E;QAC7E,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;QACX,SAAS,EAAE;YACT;gBACE,GAAG,EAAE,mCAAmC;gBACxC,IAAI,EAAE,mCAAmC;gBACzC,QAAQ,EAAE,kBAAkB;aAC7B;SACF;KACF,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel of all resource definitions for federal-regulations-mcp-server.
|
|
3
|
+
* @module mcp-server/resources/definitions/index
|
|
4
|
+
*/
|
|
5
|
+
export declare const allResourceDefinitions: (import("@cyanheads/mcp-ts-core").ResourceDefinition<import("zod").ZodObject<{
|
|
6
|
+
title: import("zod").ZodString;
|
|
7
|
+
part: import("zod").ZodString;
|
|
8
|
+
section: import("zod").ZodString;
|
|
9
|
+
}, import("zod/v4/core").$strip>, undefined, undefined> | import("@cyanheads/mcp-ts-core").ResourceDefinition<import("zod").ZodObject<{
|
|
10
|
+
documentNumber: import("zod").ZodString;
|
|
11
|
+
}, import("zod/v4/core").$strip>, undefined, undefined>)[];
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,sBAAsB;;;;;;0DAAyC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel of all resource definitions for federal-regulations-mcp-server.
|
|
3
|
+
* @module mcp-server/resources/definitions/index
|
|
4
|
+
*/
|
|
5
|
+
import { cfrSectionResource } from './cfr-section.resource.js';
|
|
6
|
+
import { documentResource } from './document.resource.js';
|
|
7
|
+
export const allResourceDefinitions = [documentResource, cfrSectionResource];
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview regulations_browse_cfr — navigate the CFR hierarchy (structure
|
|
3
|
+
* mode) or full-text-search the codified CFR (search mode) via eCFR. Search runs
|
|
4
|
+
* against the local mirror's FTS5 index when ready, falling back to the live eCFR
|
|
5
|
+
* search API on a cold deploy. Keyless. Feeds regulations_get_cfr_section.
|
|
6
|
+
* @module mcp-server/tools/definitions/browse-cfr.tool
|
|
7
|
+
*/
|
|
8
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
9
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
10
|
+
export declare const browseCfrTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
11
|
+
mode: z.ZodEnum<{
|
|
12
|
+
search: "search";
|
|
13
|
+
structure: "structure";
|
|
14
|
+
}>;
|
|
15
|
+
title: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
part: z.ZodOptional<z.ZodString>;
|
|
17
|
+
query: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>;
|
|
18
|
+
date: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>;
|
|
19
|
+
per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
mode: z.ZodEnum<{
|
|
22
|
+
search: "search";
|
|
23
|
+
structure: "structure";
|
|
24
|
+
}>;
|
|
25
|
+
date: z.ZodOptional<z.ZodString>;
|
|
26
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
|
+
type: z.ZodString;
|
|
28
|
+
identifier: z.ZodString;
|
|
29
|
+
label: z.ZodString;
|
|
30
|
+
description: z.ZodNullable<z.ZodString>;
|
|
31
|
+
reserved: z.ZodBoolean;
|
|
32
|
+
cfrCite: z.ZodNullable<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>>>;
|
|
34
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
mirror: "mirror";
|
|
36
|
+
live: "live";
|
|
37
|
+
}>>;
|
|
38
|
+
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
|
+
title: z.ZodNumber;
|
|
40
|
+
part: z.ZodString;
|
|
41
|
+
section: z.ZodNullable<z.ZodString>;
|
|
42
|
+
heading: z.ZodString;
|
|
43
|
+
hierarchyPath: z.ZodString;
|
|
44
|
+
excerpt: z.ZodString;
|
|
45
|
+
cfrCite: z.ZodString;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
}, z.core.$strip>, readonly [{
|
|
48
|
+
readonly reason: "query_required";
|
|
49
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
50
|
+
readonly when: "mode=\"search\" with no query phrase.";
|
|
51
|
+
readonly recovery: "Provide a query phrase for search mode, or switch to mode=\"structure\" to browse.";
|
|
52
|
+
}, {
|
|
53
|
+
readonly reason: "title_not_found";
|
|
54
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
55
|
+
readonly when: "Structure mode with a title outside 1–50, or a part not found in the title.";
|
|
56
|
+
readonly recovery: "Omit title to list all titles, or pick a number in 1–50 and a part that exists.";
|
|
57
|
+
}, {
|
|
58
|
+
readonly reason: "no_results";
|
|
59
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
60
|
+
readonly when: "Search mode returned zero matches.";
|
|
61
|
+
readonly recovery: "Broaden the phrase or drop the title filter and retry.";
|
|
62
|
+
}, {
|
|
63
|
+
readonly reason: "upstream_unavailable";
|
|
64
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
65
|
+
readonly when: "eCFR returned a 5xx, timed out, or served an HTML error page (live path).";
|
|
66
|
+
readonly recovery: "Retry after a brief wait; the eCFR API may be momentarily down.";
|
|
67
|
+
}], {
|
|
68
|
+
readonly totalCount: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
readonly truncated: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
readonly shown: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}>;
|
|
73
|
+
//# sourceMappingURL=browse-cfr.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browse-cfr.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/browse-cfr.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAkCjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqMxB,CAAC"}
|