tools/release.sh builds -p lucisv_mcp for the host and every cross triple, stages lucisv-mcp[.exe] beside the two binaries (three per platform package, fifteen in the all-platforms one; the universal package still carries none), smoke-tests it (editors/vscode/mcp_smoke.js: initialize, tools/list ≥ 26, project_overview) loose and unzipped from the host and all-platforms packages; tools/audit_artifacts.sh audits the third name and rejects any other; prune_release_assets.sh unchanged (seven vsix names). editors/vscode/mcp.js: the three-rung binary ladder (lucisv.mcp.path → bundled → PATH), one McpStdioServerDefinition per workspace folder — the constructor is POSITIONAL (label, command, args, env, version) with cwd set afterwards; the plan's object form was wrong and is corrected — with `--root <folder> --index-cache <storage>`, refreshed on folder and setting changes, guarded so VS Code < 1.101 registers nothing but the command; a missing binary refused at resolve time with one output-channel line; the `lucisv.mcp.copyConfig` command puts the Claude Code / Cursor / VS Code snippet on the clipboard. package.json: contributes.mcpServerDefinitionProviders, lucisv.mcp.enabled/path, the command; engine stays ^1.82.0 (vsce 4 accepts). ci.yml runs node --test over the extension's unit tests. Docs: docs/site guides/agents.md with the tool table generated from the binary (site rebuilt), README paragraph, RELEASING.md, extension README/CHANGELOG (Unreleased), manual-acceptance rows 18–25 for the live-VS Code checks. QA (Opus): API signature confirmed against VS Code 1.138's vscode.d.ts; 8 mutation checks caught by mcp_test.js; release.sh run end to end, vsix contents listed (three binaries, mcp.js, no test files), SHA256SUMS verified, the embedded binary smoke-tested, the vsix installed into an isolated profile. Gates: node --test 6/6, fmt clean. Co-Authored-By: Claude Fable 5.1 <[email protected]>
21 KiB
mcp-packaging
Goal
Ship lucisv-mcp (the Model Context Protocol server of docs/mcp/PLAN.md)
the way lucisv-server ships: as a third binary in every platform .vsix and
in the all-platforms one, smoke-tested out of the package by
tools/release.sh; registered by the VS Code extension with agent mode (one
stdio server per workspace folder) on a VS Code that has the MCP API; and
reachable from hosts that do not read VS Code's registry (Claude Code, Cursor)
through a copy-config command and a docs page. TODO-MCP M5, PLAN §5.
Assumptions
- Engine stays
^1.82.0.npx @vscode/vsce package(vsce 4.0.0, 2026-09-23) packagescontributes.mcpServerDefinitionProvidersunder^1.82.0with no warning beyond the pre-existing "bundle your extension" one, so no bump. The registration is guarded at runtime:vscode.lm,vscode.lm.registerMcpServerDefinitionProviderandvscode.McpStdioServerDefinitionmust all exist (VS Code 1.101+); on an older VS Code nothing is registered, one line goes to the lucisv output channel, and the rest of the extension is unaffected. McpStdioServerDefinition's constructor is positional, not an object:(label, command, args?, env?, version?), withcwda plain property. Verified against the installed VS Code 1.138'svscode.d.tsand its extension-host implementation (constructor(t,e,n,o={},i,s){this.label=t; this.command=e;this.args=n;this.env=o;this.version=i;…}). PLAN §2.3 and the VS Code extension guide's sample show an object argument — that would make the object the label and leavecommandundefined.mcp.jsuses the positional form and assignscwdafterwards.- Activation.
activationEventsis unchanged: VS Code derivesonMcpCollection:lucisv.mcpfrom the contribution point itself (seen in the 1.138 workbench:activationEventsGeneratoryields it for every provider id), so agent mode can activate the extension without a Verilog file open. Activation starts the language server too —mcp.activateis called at the end ofextension.js'sactivate, after the server start. - Where the binary is found — the server's three-rung ladder: an explicit
lucisv.mcp.path(read withinspect(); blank and the manifest default count as unset — theuserServerPathrule), elsebin/lucisv-mcporbin/<platform>-<arch>/lucisv-mcpin the package (extension.js's ownbundledBinary, handed tomcp.activate— so there is one implementation of the two layouts and the chmod), elselucisv-mcponPATH. - What the extension passes:
--root <folder fsPath>and, when VS Code gives one,--index-cache <storageUri, else globalStorageUri, fsPath>— the same directory the language server receives asstoragePath.cwdis the folder's URI,envis{},versionispackage.json's. Not passed:lucisv.index.cachePath(the LSP's override of that directory) andlucisv.filelist(MCP reads the project'slucisv.tomlfilelistitself). M6, which reads the store, may want the former. - What VS Code shows: one
lucisv (<folder name>)server per workspace folder under MCP: List Servers; trust is VS Code's own per-server prompt. A folder added/removed or anylucisv.mcp.*change firesonDidChangeMcpServerDefinitions, so the list follows without a reload. lucisv.mcp.enabled: falseis live. The provider stays registered and returns no definitions while the setting is off (one output-channel line at activation says so); turning it back on needs no reload. The brief said "register nothing" — returning nothing has the same visible effect and avoids the reload.- A missing binary is not started.
resolveMcpServerDefinitionchecks the command exists (as given when it has a directory part, else onPATH); when not, it logs one line to the lucisv output channel and returnsundefined, which the API defines as "do not start". This is the universal package on a machine withoutlucisv-mcp. - Hosts that need the copied config: Claude Code (
.mcp.json,mcpServers), Cursor (.cursor/mcp.json,mcpServers) — neither reads VS Code's provider registry — and VS Code itself when configured by hand (.vscode/mcp.json,serverswithtype: "stdio"). The snippet names the resolved binary and one--rootper workspace folder; when that binary is the bundled one, the message warns that its path changes on update. - The loose binaries stay unpublished, as for the other two
(
tools/prune_release_assets.sh, unchanged: it keys on the seven.vsixnames). - CI runs the extension's JavaScript tests with
node --test editors/vscode/*_test.js. The runner is this Mac in host mode, node 22 (--testneeds ≥ 18). The tests stubvscodeand need nonpm ci.
Handshakes
editors/vscode ─▶ lucisv_mcp(spawn contract). Binary namelucisv-mcp(lucisv-mcp.exeon Windows); arguments--root DIRand optionally--index-cache DIR, nothing else; stdio newline-delimited JSON-RPC; cwd the folder. Pinned bymcp_test.js(exact args) andmcp_smoke.js(spawns the real binary with the same shape). A rename of either flag incrates/lucisv_mcp/src/main.rsbreaks both.tools/ ─▶ lucisv_mcp(packaging).release.shbuilds-p lucisv_mcpfor the host and every cross triple and expectstarget/[<triple>/]release/lucisv-mcp[.exe];mcp_smoke.jsexpectsserverInfo.name == "lucisv-mcp", ≥ 26 tools and a non-errorproject_overviewwhose text names the top module. Lowering the tool count means loweringMIN_TOOLSinmcp_smoke.js.- Promised to users: the settings
lucisv.mcp.enabled/lucisv.mcp.path, the commandlucisv.mcp.copyConfig, the provider idlucisv.mcp. - Request to the lead (outside this lane's files):
.gitea/workflows/release.yml's header comment still says the platform packages embed "the lucisv + lucisv-server binaries"; it wants "lucisv, lucisv-server and lucisv-mcp".docs/mcp/PLAN.md§2.3/§5.2 show the object form of theMcpStdioServerDefinitionconstructor, which is wrong (see Assumptions).docs/topo.mdedges are M6's.
Status / TODO
release.sh:-p lucisv_mcpin the host and cross builds; loosedist/lucisv-mcp-<version>-<triple>[.exe]; staged asbin/lucisv-mcpandbin/<target>/lucisv-mcp;expect_vsix_binsthree per platform, fifteen forall; universal still asserts nobin/;smoke_embedded_mcpfor the host platform package and (with--cross) theallpackage; hostmcp_smoke.jsrun; checksummedaudit_artifacts.sh: every binary must be one of the three names; the same per-triple audits apply tolucisv-mcpprune_release_assets.sh: read, unchangedmcp.js,mcp_test.js,mcp_smoke.js;extension.js+2 linespackage.json: provider, two settings, command + palette; engine kept.vscodeignore:mcp_test.js,mcp_smoke.jsexcluded- CI step
node --test editors/vscode/*_test.js - docs: site guide
guides/agents.md+ sidebar,README.mdparagraph,tools/RELEASING.md, extension README + CHANGELOG (Unreleased) - local
tools/release.sh(host) green; darwin-arm64 vsix unzipped - QA (TODO-MCP M5 last box)
Work log
2026-09-23 (dev)
- VS Code API check. Read the installed VS Code 1.138's
vscode.d.tsand minified extension host: the stdio definition's constructor is positional; the plan's object form would have produced a server with an object label and no command. The contribution point generatesonMcpCollection:<id>activation implicitly. mcp.js(≈ 180 lines with comments): ladder, provider withprovideMcpServerDefinitions/resolveMcpServerDefinition/onDidChangeMcpServerDefinitions, copy-config command (registered on every VS Code, including those without the MCP API).bundledBinaryand the output channel are passed in fromextension.js, whose change is two lines (therequire, and the call afterrestarter.start()).mcp_test.js: 7 groups — the ladder (explicit / blank / bundled / PATH), one definition per folder with exact args/cwd/version and both storage fallbacks, change events (folders,lucisv.mcp, not others),enabled: false(no definitions, one log line, re-enabled live), the old VS Code guard in three forms (nolm,lmwithout the function, no definition class; no throw with no channel), missing-binary refusal, and the three snippets' exact JSON plus the dismissed pick.mcp_smoke.js: temp project of two files, the extension's spawn shape, all four messages written then stdin closed; checks serverInfo, tool count, overview text, stdout purity and exit status 0. Fails cleanly (exit 1) on a missing binary and on the wrong binary (lucisv-serverrefuses--root).--tool-tableprints the Markdown table checked into the guide.release.shhost run undertools/guard.sh -t 1800: exit 0; both smokes passed on the loose binaries and on the ones unzipped fromlucisv-0.56.0-darwin-arm64.vsix;shasum -cOK for all five artifacts.unzip -Z1 … 'extension/bin/*'→lucisv,lucisv-mcp,lucisv-server;extension/mcp.jspresent; nomcp_test.js/mcp_smoke.js. The universal vsix hasextension/mcp.jsand nobin/.- Size:
lucisv-0.56.0-darwin-arm64.vsix= 6 784 784 bytes; thelucisv-mcpentry is 4 532 816 bytes, 1 922 890 deflated,mcp.js2 686 deflated — +1.93 MB per platform package (≈ +9.6 MB forall, by the same ratio across five targets; not measured, needs--cross). - Cross check (not in the brief, cheap insurance): built
-p lucisv_mcpforx86_64-unknown-linux-gnu,x86_64-pc-windows-gnuandx86_64-unknown-linux-muslwith the script's recipes;audit_artifacts.shpassed all three (glibc ceilingGLIBC_2.28); a stray name (lucisv-lsp-…) is rejected. - vsce: engine
^1.82.0accepted (see Assumptions); no bump. node --test editors/vscode/*_test.js: 6 files, all pass. The docs site builds (astro buildto a scratch dir) with the new page.- No Rust touched.
QA log
2026-09-23 (QA) — verdict: pass (headless); live-VS Code steps filed as manual-acceptance rows 18–25
Everything below ran on master 23ec444 + the lane's uncommitted tree; scratch
work under the session scratchpad, nothing committed, no Rust touched.
- API claim — confirmed. VS Code 1.138.0 (
code --version;/Applications/Visual Studio Code.app/Contents/Resources/app/out/vscode-dts/vscode.d.ts):vscode.d.ts:20467constructor(label: string, command: string, args?: string[], env?: Record<string, string | number | null>, version?: string);andvscode.d.ts:20434cwd?: Uri;(a plain, non-readonly property;labelis the only readonly one). The extension host (out/vs/workbench/api/node/extensionHostProcess.js) implements it asconstructor(t,e,n,o={},i,s){this.label=t;this.command=e;this.args=n;this.env=o;this.version=i;this.metadata=s}.resolveMcpServerDefinitionmay returnundefined= "do not start" (vscode.d.ts:20538). Contribution point schema inworkbench.desktop.main.js:extensionPoint:"mcpServerDefinitionProviders", items{id, label, when}(additionalProperties:false), andactivationEventsGeneratoryieldsonMcpCollection:<id>— the Assumptions' implicit-activation claim holds.package.jsonuses exactlyid/label;PROVIDER_IDinmcp.jsequals it. mcp.js— read line by line;node --test editors/vscode/*_test.js: 6 files, 6 pass, 0 fail (node v22.13.1). Ladder order, blank = unset, one definition per folder with args exactly--root <fsPath> --index-cache <storage>, change events,enabled:false, the three old-VS Code shapes, the snippets — all asserted. Mutation check (8 mutants of a scratchmcp.js: bundled-before-explicit, untrimmed blank,--index-cacherenamed,cwddropped, fire on every config change,type:"stdio"dropped,enabledignored,lmguard dropped): all 8 killed bymcp_test.jsundernode --test. Own scratch checks (qa_mcp_test.js, not checked in), all pass, withunhandledRejection/uncaughtExceptionhooks asserting nothing escaped: zero folders (workspaceFoldersbothundefinedand[]): no definitions, no log line, each snippetJSON.parses withargs: []; folder/work/my projand bundled path/ext dir/bin/lucisv-mcp: labellucisv (my proj), args keep the space inside one element,cwd.fsPathright, all three snippetsJSON.parseand round-trip the path, only the VS Code one has"type":"stdio", and a real existing binary under a directory with a space resolves;lucisv.mcp.path→/definitely/not/here/lucisv-mcp: the setting wins over bundled, resolve returnsundefinedwithout throwing, one output-channel line (and no throw with no channel at all); novscode.lm: copy-config still yields valid VS Code JSON naming barelucisv-mcp.extension.js:git diffis exactly +2 lines (therequireandmcp.activate(context, { bundledBinary, outputChannel: client.outputChannel })afterrestarter.start(); no early return inactivatebefore it).restart_test.jspasses (44 checks);tools/guard.sh -- cargo build --release -p lucisv_server -p lucisv_mcpthennode editors/vscode/smoke.js target/release/lucisv-server: OK (55 messages).- Packaging:
tools/guard.sh -t 1800 -- tools/release.sh→ exit 0 (both smokes on the loose binaries and on the ones unzipped from the darwin-arm64 vsix;bin/ contents okfor both packages; vsce 4.0.0 printed only the pre-existing "bundle your extension" warning — engine^1.82.0accepted).shasum -a 256 -c SHA256SUMS: 5 × OK.unzip -Z1 dist/lucisv-0.56.0-darwin-arm64.vsix | sortminus 315extension/node_modules/entries:[Content_Types].xml,extension.vsixmanifest,extension/LICENSE.txt,extension/bin/lucisv,extension/bin/lucisv-mcp,extension/bin/lucisv-server,extension/changelog.md,extension/extension.js,extension/extract.js,extension/hierarchyModel.js,extension/hierarchySections.js,extension/hierarchyView.js,extension/images/{architecture.png,feature-map.png,hierarchy.svg,icon.png},extension/mcp.js,extension/media/{hierarchy.css,hierarchy.js},extension/package.json,extension/readme.md,extension/restart.js,extension/snippets/{systemverilog,verilog}.json,extension/syntaxes/systemverilog.tmLanguage.json— no*_test.js, nosmoke.js/mcp_smoke.js. Universallucisv-0.56.0.vsix: 0extension/bin/entries,extension/mcp.jspresent. Unzipped by hand to scratch:mcp_smoke.jsagainst the embeddedlucisv-mcp→ OK (0.56.0, 26 tools); it is byte-identical (cmp) to the loose binary. Negative smokes exit 1: missing path (ENOENT),lucisv-serverandlucisv(both refuse--root). Clean-profile install:code --user-data-dir <scratch> --extensions-dir <scratch> --install-extension dist/lucisv-0.56.0-darwin-arm64.vsix→ installed,[email protected],bin/holds the three executables (755).tools/prune_release_assets.sh: not ingit diff/git status; its seven suffixes ("", darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64, all) matchvsce_target_for+ the universal +-allinrelease.sh(read, cross not run).--crossartifact arithmetic inRELEASING.md(6 triples × 3 = eighteen loose binaries, fifteenbin/entries inall) matches the script.audit_artifacts.shon a scratch copy of dist: clean → exit 0 (3 audited, incl.lucisv-mcp-…); a straylucisv-foo-0.56.0-aarch64-apple-darwin→FAIL: … not lucisv, lucisv-server or lucisv-mcp, exit 1; a Mach-O renamedlucisv-mcp-0.56.0-x86_64-unknown-linux-musl→not an x86-64 ELF, exit 1 (the per-triple audit really applies to the third name). - CI:
yaml.safe_loadparsesci.yml; jobcheckssteps in ordercargo fmt,cargo clippy,cargo test,extension tests(after the cargo steps). Local node v22.13.1 (≥ 18); the runner's node version is the dev's statement, not checked from here. - Docs:
node editors/vscode/mcp_smoke.js --tool-table target/release/lucisv-mcpregenerated;diffagainst the guide's table → identical (26 rows). Every one of the 14 write tools hasdry_runin its input schema (the guide's "on any edit tool" holds);lucisv-mcp --bogus→ usage line, exit 2; default root.(canonical_roots) — the Standalone paragraph is accurate. Links: the guide has one, absolute; the extension README's only non-https://links are in-page anchors (#agents-mcp, new;#large-workspaces, pre-existing), which vsce accepts (it packaged). Site:tools/guard.sh -t 600 -- npx astro build --outDir <scratch>→ 14 pages,guides/agents/built, sidebar entry on every page, the`definerow renders as text,\a@b@1intact. (Built to scratch becausedocs/site/dist/is tracked — see lead items.)README.mdparagraph andRELEASING.mdagree withrelease.sh(three binaries, both smokes, host +allre-smoke, the artifact table, "nine crates" = 9version.workspacecrates). - PLAN §2.3/§5.2: found already corrected in the working tree (not
this lane's edit) to the positional form with
cwdset afterwards;release.yml's header now nameslucisv-mcp.
Extra, headless proxies for the QA checklist's live-VS Code clauses: the
Claude Code snippet built by configSnippet with the installed extension's
bin/lucisv-mcp and a root containing a space, spawned exactly as
command/args from an unrelated cwd (os.tmpdir()): status 0,
serverInfo.name lucisv-mcp, project_overview non-error with the right
root. lucisv-mcp --index-cache /nonexistent/dir/x starts and answers
(exit 0) — VS Code creates storageUri lazily, so the directory the
extension passes may not exist yet.
Findings (none blocking; no fix made):
- F1 (docs, minor)
tools/RELEASING.md:240— "~13 MB rather than ~3 MB (both beforelucisv-mcpjoined them; the darwin-arm64 package measured 6.8 MB with it, +1.9 MB)": 3 + 1.9 ≠ 6.8. The pre-MCP darwin-arm64 package was already ≈ 4.9 MB (6 785 772 − 1 922 890 deflated), so "~3 MB" was stale before this lane; the new parenthesis makes the inconsistency visible. Same stale "about 13 MB against 3 MB" ateditors/vscode/README.md:55(pre-existing, untouched by the lane). - F2 (docs, drift risk)
editors/vscode/README.md:196hard-codes "its 26 tools";MIN_TOOLSinmcp_smoke.jsonly guards the floor, so a 27th tool leaves this stale silently. Suggest "its tools" or regenerate with the guide's table. - F3 (hardening, optional)
mcp.js:157—registerMcpServerDefinitionProvideris not wrapped: if it ever throws (e.g. a future VS Code rejecting the provider),activateinextension.js:293throws after the language server has started, and VS Code reports the whole extension's activation as failed. A try/catch logging one line would keep the MCP part strictly additive. Not reproducible today (the id is declared). - F4 (for M6) the
--index-cachedirectory may not exist when VS Code spawns the server (see above); the M6 reader must treat a missing directory as "cold start", not an error.
Lead items (outside this lane's files): docs/site/dist/ is tracked
and was not rebuilt, so the committed site build lacks guides/agents/ until
someone regenerates it; .gitea/workflows/release.yml:6 still says "every
pair at once" one line below the corrected binary list; PLAN §5.2 now shows
undefined for env where mcp.js passes {} (equivalent — the host
defaults env to {} — noted only so the two read alike).
Not done here (owner, live VS Code): MCP: List Servers, trust, an agent-mode
project_overview, enabled:false live, multi-root, universal-without-PATH
degradation as VS Code shows it, the copied snippet in a real Claude Code
session — docs/manual-acceptance.md rows 18–25. The stubbed unit tests and
the headless proxies above cover the logic behind each; only VS Code's own UI
reaction (e.g. whether it adds a toast when resolve returns undefined) is
unverified.
Review
Lead, 2026-09-23 (M5). The lane is scripts, JavaScript and docs, and it
did the one thing the plan got wrong right: VS Code's
McpStdioServerDefinition is a positional constructor (confirmed by the dev
and by QA against 1.138's vscode.d.ts), so the plan's object form is
corrected in docs/mcp/PLAN.md §2.3/§5.2. Rulings kept from the dev's
deviations: lucisv.mcp.enabled: false leaves the provider registered and
returning no servers (no reload to turn it back on); a missing binary is
refused at resolveMcpServerDefinition with one output-channel line, which
is what the universal package needs. Engine stays ^1.82.0 — vsce 4 accepts
the contribution point and the registration is guarded at runtime. QA's F1/F2
(stale size and tool-count prose) fixed by the lead; F3 (a try/catch around
the registration) and F4 (--index-cache may not exist yet — M6's reader
must tolerate it) noted for M6. The tracked docs site rebuilt so the Agents
page ships. Rows 18–25 of docs/manual-acceptance.md are the owner's in a
live VS Code. Committed as M5.