Emit MCP variants under their original server name - #9
Merged
Merged
Conversation
Both emitters keyed the MCP file by the ingredient name, so an MCP variant, which import creates since 0.2.1, was written as "srv--b" and the workspace's own file read as a collision. Two ingredients writing one server name now warn.
0.2.2: patch, for the MCP emitter fix.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
craftar@0.2.2to npm once thereleaserun is approved in thenpmenvironment.nameinstead ofoutName— every other ingredient type already follows the rule that a variant emits under its original name. Since 0.2.1,importcorrectly turns a second workspace's differing MCP server into the variantmcp/srv--b.syncthen wrote it into.mcp.jsonas"srv--b", so that workspace's own.mcp.jsonread ascollision. The fix affects both targets:.mcp.jsonand.kiro/settings/mcp.json.mcpServers()helper replaces the two copies of the loop. When two ingredients write one server name, it now warns:<target>: two ingredients write the MCP server "<name>" into <file>: <a> and <b> (last wins). This mirrors the existing file-collision warning. Before this change the clash could not happen: the two names differed, so 0.2.1 wrote both servers.Emitted bytes and the oracle
This changes emitted bytes for existing targets, but only for MCP variants:
outName(m) === m.name, and the order is still resolution order. An old-versus-new comparison ofplan()andstatus()on 8 synthetic Forges, across both targets, gave identical bytes and key order. The Forges covered several servers, recipe order andextends, names such asconstructor,toString,2and10, per-target scoping, and CRLF + BOM. The golden workspaceacme-portal, which includes.mcp.jsonand.kiro/settings/mcp.json, passed with no regeneration.update: only those that sync an MCP variant..mcp.jsonthat 0.2.1 wrote with"<name>--<profile>"becomesupdate. The nextsyncrewrites it under the original name, and it isunchangedafter that..mcp.jsonwas reported ascollisionbecomesadopt.as:).Upgrade notes
.mcp.jsonas well (adopt). In 0.2.1 only the Forge side was repaired.mcp/<name>andmcp/<name>--<profile>, which can happen when the importer merged an existing suffixed recipe,syncnow warns about the duplicate server name instead of writing both. Remove the stalemcp/<name>reference from that recipe.Test plan
npm run typecheck: exit 0npm test: 294 passed / 27 skippedNew tests failed for the right reason before the fix, and were re-checked against
c410aee:srv--acme;import a→import b→status breported.mcp.jsonascollision.Now:
srv, the warning is emitted, andadopt.Old/new byte comparison for non-variant MCP output: identical on 8 synthetic Forges, both targets.
Golden workspaces (
test/golden.test.ts, includingacme-portal's MCP files) and the golden unify Forge passed with no regeneration.Oracle suite: skipped, no fixture available. It cannot reach the variant path (see above).
Linux CI