tc39-mcp

v0.6.6
io.github.xyzzylabs/tc39-mcp Checked 8 hours ago Published 24 days ago

Independent 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.

ParameterTypeDescription
editionstringFilter to one edition (concrete name like 'main' or 'es2025'). Omit for all.
specstringFilter 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).

ParameterTypeDescription
id *stringSpec clause id, e.g. 'sec-tonumber' (262) or 'sec-intl.numberformat' (402).
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
specstringWhich 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'.

ParameterTypeDescription
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
has_algorithmbooleanIf true, return only clauses with at least one `<emu-alg>`.
kindstringFilter by clause kind (e.g. 'op', 'sdo', 'built-in function', 'concrete method').
limitintegerMax clauses returned. The full spec has ~3000 clauses; the default is a safe slice.
sectionstringFilter 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.
specstringWhich 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 }.

ParameterTypeDescription
depthintegerMax tree depth to return. 1 = top-level only; 2 = first two levels; omitted = full tree.
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
specstringWhich TC39 spec to read: '262' (core language, default) or '402' (Internationalization API).
understringOptional 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.

ParameterTypeDescription
query *stringSearch text. Matched against clause id, aoid, and title (and step text when search_steps is true).
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
limitintegerMax ranked hits returned.
search_stepsbooleanAlso match against algorithm step text. Slower + noisier; off by default.
specstringWhich 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).

ParameterTypeDescription
id *stringSpec clause id, e.g. 'sec-tonumber' (262) or 'sec-intl.numberformat' (402).
directionstring'in' = clauses that reference this one (back-refs); 'out' = clauses this one references; 'both' = both.
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
include_cross_specbooleanIf 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…
limitintegerMax hits returned in each direction (incoming and outgoing are limited independently).
specstringWhich 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'.

ParameterTypeDescription
id *stringSpec clause id.
fromstringThe 'before' edition. Defaults to the latest stable release.
specstringWhich TC39 spec to read: '262' (core language, default) or '402' (Internationalization API).
tostringThe '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'.

ParameterTypeDescription
id *stringSpec clause id.
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
limitintegerMax commits returned from the vendored spec checkout's git log.
specstringWhich 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'.

ParameterTypeDescription
notation *stringSpec notation like `[[Prototype]]` (internal slot), `%Object.prototype%` (well-known intrinsic), or `~number~` (sigil enum).
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
limitintegerMax candidate clauses returned, ranked by relevance score.
specstringWhich 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'.

ParameterTypeDescription
bystringIndex direction. 'production' (default) groups SDO definitions by the production they handle. 'sdo' groups productions by which SDO defines them.
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
filterstring
limitintegerCap the number of groups returned. Each group can still hold many entries.
specstringWhich TC39 spec to read: '262' (core language, default) or '402' (Internationalization API).

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.

ParameterTypeDescription
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
filterstringCase-insensitive substring filter on the intrinsic name (bare, e.g. 'object.prototype').
limitintegerMax well-known intrinsics returned.
specstringWhich 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'.

ParameterTypeDescription
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
filterstringCase-insensitive substring filter on the caption or id (list mode only).
idstringIf set, return exactly this table (full columns + rows). If omitted, list tables (lightweight rows).
limitintegerMax table summaries returned in list mode (ignored when 'id' is set).
specstringWhich 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.

ParameterTypeDescription
containsstringFilter to productions whose RHS lines or non-terminal name contain this substring (case-insensitive).
editionstringEdition within the chosen spec. ECMA-262: es2016 … es2026, main. ECMA-402: es2016 … es2026, main. Aliases: latest, draft, next.
include_sdobooleanIf true, also include productions captured as SDO algorithm headers. Off by default — most callers want the standalone lexical/syntactic grammar definitions.
limitintegerMax productions (or non-terminal groups in list mode) returned.
nonterminalstringFilter to productions defining this non-terminal (exact match). Example: 'BindingIdentifier'.
specstringWhich 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.

ParameterTypeDescription
esidstringFilter 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…
limitintegerMax ranked hits returned from the test262 index.
querystringFree-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.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
championstringCase-insensitive substring filter on the champion list.
containsstringCase-insensitive substring filter applied to the proposal name + slug.
limitintegerMax proposals returned from the filtered set.
specstringFilter to one spec's proposals: '262' (core language) or '402' (Intl). tc39/proposals tracks the two in parallel — omit to list both.
stagestringFilter 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.

ParameterTypeDescription
name *stringMatch 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.