Skip to content

feat(mcp): merge_recipe merges a recipe into the served project (#1024) - #1027

Merged
jimhoyd merged 1 commit into
mainfrom
claude/mcp-recipe-merge-1024
Sep 30, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/mcp-recipe-merge-1024

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1024

What

A new authoring tool, merge_recipe {name, dryRun?} (offered only with urlcode mcp --allow-authoring), runs the same mergeRecipe as urlcode recipes add NAME --project:

  • It merges routes, includes, other files, extension configuration, fixtures, seed and the committed audit route count into the project the server serves.
  • A clash, or an extension the project has not declared, refuses the whole merge and writes nothing. The refusal is an error tool result (isError: true) whose text is the CLI's recipe-clash / recipe-needs-extension message, naming every clash.
  • dryRun reports what would be added and written, and writes nothing.
  • The result is the CLI's --json report with project: "." and next: ["run_validate","run_test","run_audit"], because the MCP runners already carry the operator's flags. It also has the usual validation verdict.
  • Bounded to the server's project: the input schema has no path property, and additionalProperties: false refuses project/destination with -32602. The target is the realpath'd operator-selected root. Non-dry runs hold the same urlcode.yaml.lock as create_route.

Why a separate tool rather than an add_recipe target

add_recipe requires destination, a path argument checked by confinedPath, and creates a new directory. Adding a target to it would mean either making destination optional with a mode switch, or adding a second path-like argument, and one schema would then describe two different operations. The existing authoring tools each do one operation with strict required arguments (create_route, scaffold_feature), so the merge fits better as its own tool. It also means no argument of merge_recipe can name a directory at all. Both tools keep the same annotations: project-confined write, not destructive, not open-world.

Docs

  • docs/TOOLING.md (authoring mode): the tool is documented, and "adds seven tools" is now "adds eight tools". check-agent-facts derives the count from mcpToolInventory, and it passes with authoring: 8.
  • docs/AI-AUTHORING.md, docs/RECIPES.md (SDK and MCP) and llms.txt are updated. llms-full.txt is regenerated.
  • The mcp package README describes the MCP extension, not this server, so it is unchanged.

Tests

test/mcp-authoring.test.ts:

  • The tool counts (40 with authoring) and the annotations cover merge_recipe.
  • A dry run of json-endpoint on a copy of the default starter writes nothing, and the report matches the CLI's. A real merge of json-endpoint then redirect moves expectRoutes to 4, and run_validate, run_test and run_audit exit 0. Re-merging is all unchanged and writes nothing. The lock is removed.
  • contact-form over static-page clashes, in both the real run and the dry run, and the error names the route and the file clash. store-booking is refused for its missing extensions. A project or destination argument is refused by the schema. An unknown recipe errors. The project is byte-identical afterwards.

Evidence

  • npm run verify: green.
  • npm run test:package: green (package audit within budget, packed smoke passed).

CI passing is not an independent security review.

🤖 Generated with Claude Code

The authoring surface gains merge_recipe {name, dryRun?}, which runs the
same mergeRecipe as `urlcode recipes add NAME --project`: routes, includes,
files, extension configuration, fixtures, seed and the audit route count,
with the same all-or-nothing clash refusal. It takes no path: the target is
the operator-selected project root, and the write holds the authoring lock
create_route uses. A clash is an error tool result naming every clash. The
result is the CLI's JSON report with project "." and next naming the MCP
runners, plus the validation verdict.

A separate tool rather than an add_recipe target keeps add_recipe's required
destination and gives merge_recipe a schema with no path argument at all.

--allow-authoring now adds eight tools (TOOLING, AI-AUTHORING, RECIPES,
llms updated; agent-facts derives the count from the inventory).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 30, 2026 01:13
@jimhoyd
jimhoyd merged commit 9f51ff8 into main Sep 30, 2026
22 checks passed
@jimhoyd
jimhoyd deleted the claude/mcp-recipe-merge-1024 branch September 30, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP authoring: merge a recipe into the served project (add_recipe only creates a new directory)

1 participant