tc39-mcp
v0.6.6Independent MCP server for the TC39 specs (ECMA-262 + ECMA-402): clauses, search, diffs, history.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
spec.about About this server
Return self-description of this MCP server: package name + version, per-snapshot pin metadata (sha, fetched_at, biblio_commit, clause_count) for every supported (spec, edition), plus test262 + proposals index headers when present. Lets callers verify freshness and reproducibility without loading the parses themselves.
spec.snapshots List spec snapshots
List every (spec, edition, sha, fetched_at) snapshot this server has parsed. Use to discover what historical SHAs you can query via `at: "<sha>"`, or to verify reproducibility across server versions. Optional `spec` / `edition` filters.
| Parameter | Type | Description |
|---|---|---|
edition | string | Filter to one edition (concrete name like 'main' or 'es2025'). Omit for all. |
spec | string | Filter to one spec. Omit for both. |
clause.get Get spec clause
Fetch a parsed TC39 clause as structured JSON: metadata, signature, algorithm steps, notes, cross-refs, and outward citations to external specs (Unicode, IETF, WHATWG). `spec` selects '262' (default) or '402'. `edition` defaults to `latest` (current stable release on both specs — es2026 today).
| Parameter | Type | Description |
|---|---|---|
id * | string | Spec clause id, e.g. 'sec-tonumber' (262) or 'sec-intl.numberformat' (402). |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
clause.list List spec clauses
List parsed spec clauses with optional filters (kind, section prefix, has_algorithm). Returns lightweight rows {id, aoid, title, number, kind, algorithms}; follow up with clause.get for detail. `spec` selects '262' or '402'.
| Parameter | Type | Description |
|---|---|---|
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
has_algorithm | boolean | If true, return only clauses with at least one `<emu-alg>`. |
kind | string | Filter by clause kind (e.g. 'op', 'sdo', 'built-in function', 'concrete method'). |
limit | integer | Max clauses returned. The full spec has ~3000 clauses; the default is a safe slice. |
section | string | Filter to clauses whose section number starts with this prefix, e.g. '22.2' for RegExp or '15' for the Locale-aware operations in ECMA-402. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
clause.outline Spec section outline
Return the section tree (table of contents) for a parsed (spec, edition). `depth` caps tree depth (1 = top-level only). `under` anchors at a specific clause id so you get just its descendants. Each node carries { id, number, title, kind, children }.
| Parameter | Type | Description |
|---|---|---|
depth | integer | Max tree depth to return. 1 = top-level only; 2 = first two levels; omitted = full tree. |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
under | string | Optional clause id. If set, return only descendants of this clause. |
spec.search Search spec
Search the parsed spec by clause id / aoid / title (and step text when search_steps is true). Returns lightweight hits ranked by match quality — the entry point when you don't know the exact clause id. `spec` selects '262' or '402'. Follow up with clause.get.
| Parameter | Type | Description |
|---|---|---|
query * | string | Search text. Matched against clause id, aoid, and title (and step text when search_steps is true). |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
limit | integer | Max ranked hits returned. |
search_steps | boolean | Also match against algorithm step text. Slower + noisier; off by default. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
spec.crossrefs Spec cross-references
For a clause id, return its outgoing references (clauses it cites) and/or incoming references (clauses that cite it — the back-reference index the parse alone doesn't expose). Direction: 'in' | 'out' | 'both' (default). Outgoing also carries an `external` category: the clause's citations to external specs (Unicode, IETF, WHATWG) as resolvable URLs. Set `include_cross_spec: true` to also resolve outgoing references from ECMA-262 → ECMA-402 (or vice versa).
| Parameter | Type | Description |
|---|---|---|
id * | string | Spec clause id, e.g. 'sec-tonumber' (262) or 'sec-intl.numberformat' (402). |
direction | string | 'in' = clauses that reference this one (back-refs); 'out' = clauses this one references; 'both' = both. |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
include_cross_spec | boolean | If true, outgoing references also include AOIDs that resolve to the *other* TC39 spec (262 ↔ 402). Useful for queries like 'every 262 op that calls into Intl'. Off by default because it requires loa… |
limit | integer | Max hits returned in each direction (incoming and outgoing are limited independently). |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
spec.diff Diff spec editions
Clause-level diff across any two editions of one spec. Defaults: from='latest', to='main' (working draft). Reports status (identical / modified / added / removed / missing-from-both) plus a field-level diff: title, signature, step count, per-step reworded indices, notes, crossrefs. `spec` selects '262' or '402'.
| Parameter | Type | Description |
|---|---|---|
id * | string | Spec clause id. |
from | string | The 'before' edition. Defaults to the latest stable release. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
to | string | The 'after' edition. Defaults to the working draft (main). |
spec.history Clause git history
Recent commits in the vendored spec checkout that touched a clause's `id="..."` token. Uses git pickaxe (`-S`) so it catches clause creation, deletion, and edits to the opening tag reliably; interior-text-only edits won't show. Returns SHA, date, author, subject per commit. `spec` selects '262' or '402'.
| Parameter | Type | Description |
|---|---|---|
id * | string | Spec clause id. |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
limit | integer | Max commits returned from the vendored spec checkout's git log. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
spec.symbol_resolve Resolve spec symbol
Resolve spec notation like `[[Prototype]]` (internal slot), `%Object.prototype%` (well-known intrinsic), or `~number~` (sigil enum) to the clauses that mention or define it. Hits ranked by occurrence count + section-prefix bumps for the canonical definition location. `spec` selects '262' or '402'.
| Parameter | Type | Description |
|---|---|---|
notation * | string | Spec notation like `[[Prototype]]` (internal slot), `%Object.prototype%` (well-known intrinsic), or `~number~` (sigil enum). |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
limit | integer | Max candidate clauses returned, ranked by relevance score. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
spec.sdo_index Syntax-directed operations index
Index Syntax-Directed Operations by the grammar production they handle. SDOs are abstract operations (Evaluation, BoundNames, etc.) with one `<emu-alg>` per production. Default by='production' returns { [production]: [{ sdo, id, title }] }; by='sdo' returns { [sdo title]: [productions] }. `filter` substring-narrows keys; `spec` selects '262' or '402'.
| Parameter | Type | Description |
|---|---|---|
by | string | Index direction. 'production' (default) groups SDO definitions by the production they handle. 'sdo' groups productions by which SDO defines them. |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
filter | string | |
limit | integer | Cap the number of groups returned. Each group can still hold many entries. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
spec.global_search Search both specs
Run spec.search across both ECMA-262 and ECMA-402 in one call and interleave results by score. Each hit is tagged with the spec it came from. Useful when you don't know which spec defines the symbol (e.g. `Canonicalize` is 262, `CanonicalizeLocaleList` is 402).
| Parameter | Type | Description |
|---|---|---|
query * | string | Search text. Matched against clause id, aoid, and title across both specs (and step text when search_steps is true). |
limit | integer | Total hits across both specs combined. |
search_steps | boolean | Also match against algorithm step text. Slower + noisier; off by default. |
spec.well_known_intrinsics Well-known intrinsics
Enumerate the well-known intrinsics (`%X%` notations) used in the spec, with each one's probable defining clause (chosen by a title-substring heuristic — see `matched_on` per hit). For the canonical 262 well-known intrinsics table, read `clause.get { id: 'sec-well-known-intrinsic-objects' }` directly.
| Parameter | Type | Description |
|---|---|---|
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
filter | string | Case-insensitive substring filter on the intrinsic name (bare, e.g. 'object.prototype'). |
limit | integer | Max well-known intrinsics returned. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
spec.tables Spec tables
List or fetch parsed `<emu-table>` content. Pass `id` to get one table with full columns + rows; omit `id` to list tables (lightweight summaries) optionally filtered by caption/id substring. Authoritative source for the well-known intrinsics table (id='table-well-known-intrinsic-objects'), well-known symbols, completion record fields, etc. `spec` selects '262' or '402'.
| Parameter | Type | Description |
|---|---|---|
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
filter | string | Case-insensitive substring filter on the caption or id (list mode only). |
id | string | If set, return exactly this table (full columns + rows). If omitted, list tables (lightweight rows). |
limit | integer | Max table summaries returned in list mode (ignored when 'id' is set). |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
spec.grammar Spec grammar productions
Query standalone `<emu-grammar>` productions from the spec's lexical / syntactic grammar (§11-15 in 262). Three modes: { nonterminal: 'X' } returns every production for X; { contains: 'Y' } returns productions whose RHS or non-terminal name contains Y; neither returns a list of all non-terminals with their production counts. Set include_sdo:true to also surface SDO-attached grammar headers.
| Parameter | Type | Description |
|---|---|---|
contains | string | Filter to productions whose RHS lines or non-terminal name contain this substring (case-insensitive). |
edition | string | Edition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next. |
include_sdo | boolean | If true, also include productions captured as SDO algorithm headers. Off by default — most callers want the standalone lexical/syntactic grammar definitions. |
limit | integer | Max productions (or non-terminal groups in list mode) returned. |
nonterminal | string | Filter to productions defining this non-terminal (exact match). Example: 'BindingIdentifier'. |
spec | string | Which TC39 spec to read: '262' (core language, default) or '402' (Internationalization API). |
test262.search Search test262
Search tc39/test262 for tests matching a free-text query and/or an esid (clause id, prefix-matched). test262 covers both ECMA-262 and ECMA-402. Served from a parsed test262 index sourced via the loader chain (local cache → hosted Worker → bundled fallback); the index is fetched on first use and cached locally. If no layer can produce the index the result is empty + a hint explaining the one-time local build. No auth, no subprocess.
| Parameter | Type | Description |
|---|---|---|
esid | string | Filter to tests whose front-matter esid: starts with this prefix (case-insensitive). Prefix match catches the common case where test262 uses a more specific esid than the spec section id — e.g. `esi… |
limit | integer | Max ranked hits returned from the test262 index. |
query | string | Free-text query. Matched case-insensitively as whitespace-separated tokens (AND) across each test's description + path. Either `query` or `esid` (or both) must be supplied. |
test262.get Get test262 fixture
Fetch one test's source + parsed front-matter by path within the vendored tc39/test262 checkout. Pairs with test262.search — the paths it returns plug in here directly. Returns { source, front_matter, test262_sha, url } or { hint } if the path can't be resolved.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path within the test262 checkout, relative to the repo root. Example: 'test/built-ins/Number/prototype/toString/S15.7.4.2_A1_T01.js'. The values returned by test262.search go here directly. |
proposal.list List TC39 proposals
List TC39 proposals from a parsed proposals index sourced via the loader chain (local cache → hosted Worker → bundled fallback); the index is fetched on first use and cached locally. Filter by `stage` ('0'|'1'|'2'|'2.7'|'3'|'finished'|'inactive'|'active'), `champion` (substring), or `contains` (name/slug substring). Returns lightweight rows; follow up with `proposal.get`. No auth, no subprocess.
| Parameter | Type | Description |
|---|---|---|
champion | string | Case-insensitive substring filter on the champion list. |
contains | string | Case-insensitive substring filter applied to the proposal name + slug. |
limit | integer | Max proposals returned from the filtered set. |
spec | string | Filter to one spec's proposals: '262' (core language) or '402' (Intl). tc39/proposals tracks the two in parallel — omit to list both. |
stage | string | Filter to one stage: '0', '1', '2', '2.7', '3', 'finished', 'inactive', or 'active' (anything in the active README — stages 2/2.7/3). |
proposal.get Get TC39 proposal
Fetch one TC39 proposal by slug (exact) or name (case-insensitive). Returns { slug, name, stage, authors, champions, url, test262_flag, source_file }. Slug is canonical — use what proposal.list returns directly.
| Parameter | Type | Description |
|---|---|---|
name * | string | Match against either the proposal's slug (preferred, exact-match) or its name (case-insensitive). Slug is the canonical id — use what proposal.list returns directly. |