Skip to content

feat(mcpx): recipes as MCP tools + runtime on adapter declarations (#2117) - #2504

Merged
dezren39 merged 3 commits into
mainfrom
queue/3103-2117-mcpx-recipes-runtime
Oct 30, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/3103-2117-mcpx-recipes-runtime

Conversation

@dezren39

@dezren39 dezren39 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Closes #2117 (slices 1+3 of #1875, split by triage task 2769).

What

1. Recipes are individual MCP tools. A saved recipe now appears in tools/list as recipe_<name>, with its // @param headers turned into the tool's JSON Schema by the existing recipes.FormSchema. Exposure is opt-out per recipe (// @tool false, default on). Registration happens where adapter/OpenAPI//v1 extras are already assembled (cli.MCPServer → mcpserver.RecipeTools), so recipe tools reach /mcp, mcpx serve stdio and the plain-POST projection alike. A tool call routes to the existing POST /v1/recipes/{name}/run path — no second runner.

Name rules are the adapter rules (one namespace prefix + member name), not a new scheme. A recipe whose recipe_<name> is already taken by an adapter//v1/OpenAPI tool is skipped, never shadowed, and named in mcpx catalog, which now ends with a recipe-tool block: exposed / budget (25) / opted out / every skip with its reason.

2. runtime on adapter declarations. bash, js, ts, py are accepted, resolved to bash/sh, deno|bun|node, python3|python (deno gets run), with command resolved as an absolute path, dir-relative, or via PATH. Declarations without runtime spawn exactly as before, byte for byte; mcpx adapter serve needs no change because it goes through Spec.Call. Invalid values fail validation with the accepted list.

Tests

New: recipe tool schema/opt-out/collision/budget/idempotence (recipes), tools-list presence + call + collision + re-listing (mcpserver), real-spawn bash and python adapters served and answering, dir-relative script resolution, catalog skip reporting, no-runtime unchanged, runtime validation (adapter).

  • go build ./..., go vet ./... clean
  • go test ./... in pkgs/mcpx: all pass except two pre-existing failures proven identical on main at 7d1b081c — internal/settings TestEveryDocumentHasAChapter (11 files absent from compendium.manifest.json) and 8 internal/e2e failures that are runtime-environmental (no deno on PATH). None touch tools/list, serve, adapters or recipes.

Known gaps (deliberately out of scope)

  • Extras are computed when the MCP surface is built, so a recipe saved afterwards shows up on the next daemon/serve construction — the same limitation adapter extras have; this is the sibling "live add" work, not this issue.
  • The recipe tool budget is a constant (25), not a setting.
  • js/ts runtimes inject no permission flags, so a deno script needing --allow-* must be declared through a wrapper.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 30, 2026 01:47
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c16a782a-1e7b-4c53-8a66-be31628d6791
Commits

Reviewing files that changed from the base of the PR and between 7d1b081 and 7897498.

Files selected for processing: 16
  • pkgs/mcpx/docs/configuration.md
  • pkgs/mcpx/docs/consumer.md
  • pkgs/mcpx/internal/adapter/adapter.go
  • pkgs/mcpx/internal/adapter/adapter_test.go
  • pkgs/mcpx/internal/adapter/runtime.go
  • pkgs/mcpx/internal/cli/adapter_runtime_test.go
  • pkgs/mcpx/internal/cli/commands.go
  • pkgs/mcpx/internal/cli/recipe_tools.go
  • pkgs/mcpx/internal/cli/serve.go
  • pkgs/mcpx/internal/mcpserver/recipe_tools.go
  • pkgs/mcpx/internal/mcpserver/recipe_tools_test.go
  • pkgs/mcpx/internal/mcpserver/server.go
  • pkgs/mcpx/internal/recipes/recipes.go
  • pkgs/mcpx/internal/recipes/recipes_test.go
  • pkgs/mcpx/internal/recipes/tools.go
  • pkgs/mcpx/internal/recipes/tools_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T02:54:45.465741Z 7897498 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f76452c780

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/mcpx/internal/cli/recipe_tools.go Resolved
Comment thread pkgs/mcpx/internal/adapter/runtime.go Resolved
Comment thread pkgs/mcpx/internal/cli/recipe_tools.go Resolved
Comment thread pkgs/mcpx/internal/recipes/recipes.go Resolved
…ers (#2117)

- recipe_tools: run recipes under the MCP caller's session
  (a.mcpCaller(ctx).SessionID), not the daemon process session, so
  session-scoped namespaces stay isolated per client (P1).
- recipe_tools: a nonzero recipe exit now returns an error (output
  retained), so the MCP result is a tool failure, not a success (P2).
- adapter/runtime: when Dir is set and the script is absent beside
  the declaration, fall back to resolving the bare name on PATH (P2);
  regression test probes+runs a PATH script with Dir elsewhere.
- recipes: placeholder discovery (refs) skips // @tool marker lines
  as it already skipped @PARAM declarations, so opting out of MCP
  exposure no longer invents a required 'tool' input (P2);
  regression test added.
@dezren39

Copy link
Copy Markdown
Member Author

@codex review

Codex findings on f76452c dispositioned in f495c8e (all fixed, replied on their threads, threads resolved):

  • P1 recipe session isolation → a.mcpCaller(ctx).SessionID
  • P2 runtime scriptPath PATH fallback when Dir is set (new regression test)
  • P2 nonzero recipe exits return an error with output retained
  • P2 // @tool markers excluded from placeholder discovery (new regression test)

Laptop verification: go test ./internal/recipes/ ./internal/adapter/ pass; go test ./internal/cli/ -run Recipe pass; go vet clean on all three packages. Please re-review the new head.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f495c8e5c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/mcpx/internal/adapter/runtime.go Resolved
Comment thread pkgs/mcpx/internal/cli/recipe_tools.go Resolved
- adapter: resolve a relative executable against Dir when no runtime is declared (preserves pre-resolution exec behaviour for command: ./tool with dir set)

- mcpserver: keep a failed tool's returned text in the isError result so a failed recipe's stdout/stderr reaches the caller alongside the error

- regression tests for both
@dezren39
dezren39 merged commit 58eb94b into main Oct 30, 2026
7 of 8 checks passed
@dezren39
dezren39 deleted the queue/3103-2117-mcpx-recipes-runtime branch October 30, 2026 04:30
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.

mcpx: recipes as MCP tools + runtime on adapter declarations (split of #1875)

1 participant