Skip to content

🤖 feat: load Cursor plugin MCP servers in a cursor dialect - #7838

Merged
ThomasK33 merged 11 commits into
cursor-plugins/manifestfrom
cursor-plugins/mcp
Oct 31, 2026
Merged

ThomasK33 merged 11 commits into
cursor-plugins/manifestfrom
cursor-plugins/mcp

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

A Cursor plugin's MCP servers now load in Xum. The mcpServers file of a .cursor-plugin/plugin.json loads in a new cursor MCP dialect, which is the Codex shape plus Cursor's folder names. Of the 104 marketplace servers in cursor/plugins, 89 load (88 remote HTTP, 1 stdio). 14 are skipped as "needs values not supported in Xum". 1 is refused by the existing static-header rule.

This is PR 3 of the Cursor plugin RFC (rfc/20261030_cursor-plugin-support.md on cursor-plugins/rfc, section "PR 3", Technical Plan section 4, decisions D19 and D29). It sits on PR 1 (#7837).

Background

PR 1 reads Cursor manifests and keeps the manifest's mcpServers path in CursorManifestResult.mcpConfigPath, but it turns MCP off for Cursor packages. This PR turns it on. Cursor mcp.json files differ from the Codex and Claude files that Xum already reads:

  • They name the plugin folder ${CURSOR_PLUGIN_ROOT} (and accept ${CLAUDE_PLUGIN_ROOT}).
  • They ask the user for values with ${NAME}, ${NAME:-default} and ${env:NAME}. Xum has no Cursor variables.
  • They carry an auth block (D19) and a placement field that Xum cannot apply.

Implementation

  • mcpDialects.ts (new) holds one alias table per dialect and the pure Cursor rules. Discovery and the loader share it, because discovery cannot import mcpConfig.ts (mcpConfig.ts imports discovery).
    • codex has no aliases. claude maps CLAUDE_PLUGIN_ROOT and CLAUDE_PLUGIN_DATA, as before. cursor maps CURSOR_PLUGIN_ROOT and CLAUDE_PLUGIN_ROOT to the install folder and has no data folder alias (D29, Codex RFC round 2 finding 4).
    • A command of exactly ${<root alias>}/<path> becomes ./<path> and goes through the existing ./ checks. A cwd at an alias is anchored at the matching Xum name. The old Claude-only rewrite is now the claude row of the table.
    • cursorValuePlaceholder finds the first ${...} that Xum leaves as written in command, args, env values, cwd, url or headers. It reports the name only, never a default, which can hold a secret. The placeholders are found with a linear indexOf scan, not a regex, because discovery reads a plugin's mcp.json before consent.
  • mcpConfig.ts: for the cursor dialect, a server that needs values is skipped through the existing per-server diagnostic. auth and placement are dropped before the Codex translation, and each one gives the warning " not applied in Xum". The server still connects. Sign-in uses discovery and dynamic client registration.
  • openaiMcpAuth.ts: translateCodexMcpEntry takes the names the dialect supplies, so a Cursor server cannot forward CURSOR_PLUGIN_ROOT or CLAUDE_PLUGIN_ROOT in env_vars. RESERVED_ENV_NAMES does not change, so Codex and Agent Plugin servers can still set or forward both names (Codex RFC round 3 finding 10).
  • discovery.ts: a Cursor package resolves its MCP file from cursor.mcpConfigPath in the cursor dialect, and PR 1's "load in a later Xum build" entry is gone. Without mcpServers it defaults to mcp.json only, never to a Codex .mcp.json next to it.
  • cursorManifest.ts: a real declared mcpServers path is now also contributes.mcp, as PR 1 planned for this PR. The sign-out recovery guard reads a missing declared file as unreadable and keeps the pending sign-out record, so a restored file cannot load with an old OAuth grant. An inline or outside path stays inert. Each server that needs values, and each dropped auth or placement field, is a notApplied entry {part: "mcp", name: <server>, reason} on AgentPluginInfo, so the installed plugin can list it.
  • expansion.ts: ${CURSOR_PLUGIN_ROOT} expands only when the caller supplies it.
  • tests/bugbash/pluginInstallFixtures.ts: new fixture cursor-stdio-mcp, one stdio server echo launched as node ${CURSOR_PLUGIN_ROOT}/server.mjs. server.mjs is a dependency-free MCP server whose tool echo returns its text argument.

Validation

  • Dev-server sandbox with the cursor-stdio-mcp fixture and the real attio, brevo and trello plugins:
    • echo connects, and a Haiku 5.5 turn called echo with text: "hi" and got hi.
    • brevo is not offered. The server log says "needs values not supported in Xum (${BREVO_MCP_TOKEN})", and its notApplied entry carries the same reason.
    • attio is offered as a remote server with "OAuth: Not logged in". Login opened Attio's sign-in page with a PKCE authorize request. I have no Attio account, so I did not sign in or call an attio tool.
    • trello (placement: "server") is offered and logs "placement not applied in Xum".
  • The real loader over all 104 marketplace mcp.json files: 89 loaded, 14 needs values, 10 auth not applied, 10 placement not applied, 1 refused (excalidraw, static header). The counts did not change after merging PR 1's latest head.
  • An independent verifier ran differential tests against the base: the claude, codex and root dialects give the same results for the same inputs. The verifier's mutants for each new guard are killed by a named test.

Risks

Low. The change is limited to Cursor packages, and the claude, codex and root dialects behave as before (same servers, same env key order, so the same consent fingerprints). MCP config parsing is consent-sensitive, so the grammar for other dialects does not change. A Cursor file gains only the folder aliases and the two dropped fields. The new ${...} check only skips servers.

Deviations from the RFC

  1. Any ${...} counts as needs values, not only the RFC's ${NAME} and ${NAME:-default}. That covers Cursor's other interpolation forms: ${env:NAME} (names such as api-key included), ${userHome}, ${workspaceFolder} and ${/}. Xum never reads its own environment for them.
  2. placement is dropped like auth, with a warning and a notApplied entry, and the server connects directly. 10 marketplace servers set placement: "server", which asks Cursor to connect from its hosted service.
  3. The needs-values check runs on the values as written, before expansion and before the url and header checks. The results are the same, the reason names the placeholder instead of a url error, and an install path that contains ${ cannot cause a false match.
  4. "auth not applied in Xum" is a warning, not an ignored entry: stdio servers report only warnings, and ignored would add the prefix "Xum's MCP OAuth ignores:".
  5. A cwd at ${CURSOR_PLUGIN_DATA} or ${CLAUDE_PLUGIN_DATA} needs values (D29: Cursor has no data folder alias). RFC 3.1 and 3.2 expect the cwd form error. The server is skipped either way, and now it also gets a notApplied entry.
  6. notApplied entries for MCP servers, and the new file mcpDialects.ts that computes them, are not in the RFC text yet. Discovery reads mcp.json a second time through the existing capped, contained reader.
  7. The RFC expects 102 of 104 servers to connect. The measured result is 89 load, 14 need values and 1 is refused.

Follow-ups

  • F4: a command such as ${CURSOR_PLUGIN_ROOT} alone is skipped with "needs values (${CURSOR_PLUGIN_ROOT})", which names a value Xum does supply. The skip is right, the wording is not.
  • F5: servers refused for other reasons (the excalidraw static header, Cursor envFile) get a diagnostic but no notApplied entry. cursorMcpNotApplied also lists servers the user did not import. Trigger: PR 2, which renders notApplied on the plugin card.
  • F6: the Codex shape gives Cursor files env_vars, so a Cursor stdio server can name host variables to forward. The install review lists the names. Cursor itself has no such field.

Release note

Cursor plugins: the MCP servers in a Cursor plugin's mcp.json now load. ${CURSOR_PLUGIN_ROOT} and ${CLAUDE_PLUGIN_ROOT} expand to the plugin's install folder. A server that asks for another value (${NAME}, ${NAME:-default}, ${env:NAME}, ${userHome}) is skipped and listed as "needs values not supported in Xum". A Cursor auth block or placement field is listed as not applied, and the server still connects.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh • Cost: $30.98

A Cursor package's mcpServers file now loads in the new "cursor" MCP dialect
(Cursor plugin RFC PR 3). The dialect has the Codex shape, so type "http" and a
url without a type become streamable HTTP. ${CURSOR_PLUGIN_ROOT} and
${CLAUDE_PLUGIN_ROOT} expand to the install folder, a command anchored at
either root becomes ./<path>, and no data folder alias exists (D29). A server
whose command, args, env, cwd, url or headers keep any other ${NAME} is
skipped with "needs values not supported in Xum (${NAME})". An auth block is
dropped and named "auth not applied in Xum" (D19). Only the cursor dialect
refuses its root names in env and env_vars.

Adds the cursor-stdio-mcp bug-bash fixture with a dependency-free echo server.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$6.64`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=6.64 -->
# Conflicts:
#	src/node/services/agentPlugins/discovery.test.ts
… not applied

A Cursor plugin now carries one notApplied entry {part: "mcp"} per mcp.json
server that needs values ("needs values not supported in Xum (${NAME})") and per
other server with an auth block ("auth not applied in Xum"), so the installed
plugin lists them after install, not only in the install review's warnings.

Discovery and the MCP loader share one pure classifier (mcpDialects.ts), which
also holds the per-dialect folder aliases: discovery cannot import mcpConfig.ts
(it imports discovery). The loader's Claude and Cursor pre-translation skips
move into dialectEntrySkip.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$6.64`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=6.64 -->
…alues

Root decisions on the 104-file marketplace sweep:
- The cursor dialect drops a server's "placement" field as it drops "auth":
  the warning and notApplied entry "placement not applied in Xum", and the
  server connects directly. Cursor reads "placement": "server" as "connect from
  Cursor's hosted service", which Xum does not have. 10 marketplace servers set
  it and now load.
- Cursor's ${env:NAME} counts as a value Xum cannot fill: the server is skipped
  as "needs values not supported in Xum (${env:NAME})" and never receives the
  literal text. Xum does not read its own environment for it.

Review fixes: a cwd anchored at a name other than the two data folder names
needs values, as the RFC states; comments trimmed; codexDialect renamed
codexShape, since the claude and cursor dialects have the Codex shape too.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$18.98`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=18.98 -->
…sted

Verifier findings F1 to F3 on PR 3 at cff6d31 (test-only):
- F1: a Cursor root name as a whole command, in a url, or as
  ${CURSOR_PLUGIN_ROOT:-x} needs values; a server with the root name in args
  still loads.
- F2: a Claude command at ${CLAUDE_PLUGIN_DATA}/bin/x, and ${CLAUDE_PLUGIN_ROOT}/
  alone, are refused as commands that are not a single executable token.
- F3: notApplied lists a flat Cursor server map, skips a server named __proto__,
  and lists nothing for an MCP file over the size cap.

Each new assertion fails under the verifier's mutant for its guard (M04, M05,
M07, M08, M09, M31, M32, M35).

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$23.29`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=23.29 -->
# Conflicts:
#	src/node/services/agentPlugins/discovery.ts
… one helper

After merging PR 1's latest head, discoverPluginAt grew from CC 38 to 39 against
the new main base (crap-check floor-cc). resolvePackageMcpConfig now takes the
Cursor manifest result and returns the MCP file, its dialect and its notApplied
entries, so discoverPluginAt keeps its base complexity. Behavior is unchanged:
the same tests pass and the 104-file marketplace sweep gives the same rows.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$25.50`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=25.50 -->
@chatgpt-codex-connector

This comment has been minimized.

@ThomasK33
ThomasK33 added this pull request to stack #7836 October 31, 2026 13:54
@ThomasK33

Copy link
Copy Markdown
Member Author

Dogfood evidence for this PR (dev-server sandbox, the cursor-stdio-mcp fixture and the real attio, brevo and trello plugins from cursor/plugins).

  1. echo (fixture, launched as node ${CURSOR_PLUGIN_ROOT}/server.mjs) and attio are listed. brevo is not, because it needs ${BREVO_MCP_TOKEN}.

Workspace MCP list with attio and echo enabled

  1. Fetch Tools: echo lists its tool. attio answers HTTP 401 before sign-in.

Fetch tools: echo tool listed, attio needs authorization

  1. A Haiku 5.5 turn calls echo with text: "hi" and gets hi.

echo tool call returns hi

  1. attio login opens Attio's sign-in page (dynamic client registration and PKCE). I have no Attio account, so the sign-in and an attio tool call are not shown.

Attio sign-in page after Login

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Head: d565bda

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 46.5k tokens (27% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 5.4s
🟢 a chat survives a restart of the server 1 step · 1 call 5.4s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 4.3s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 4.3s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 9.1s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.1s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 9.3s
🟢 a chat survives trips through Settings 2 steps · 1 call 9.3s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.3s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.3s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 3.0s
🟢 the agent opens the playground workspace 2 steps · 1 call 3.0s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 7.7s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 7.7s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 5.0s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 5.0s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 24.3s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 3.5s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 5.3s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 5.7s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.0s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.3s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.7s

e2e 0.20.0 · 1m 16s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.0k tokens (32% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 5.4s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 5.4s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.4s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.4s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.8s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.8s

e2e 0.20.0 · 18.9s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.4s · 2 targets (web, phone) · run artifacts

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: d565bdaeec

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: d565bdaeec

ℹ️ 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".

…cp.json only

Codex round 1 on #7838:
- Cursor documents ${env:api-key}, ${userHome} and ${/}. The needs-values
  pattern matched only [A-Za-z0-9_] names, so a server with ${env:api-key}
  loaded and received the literal text. Any ${...} in a Cursor server's
  command, args, env, cwd, url or headers now needs values unless it is an
  exact folder name that Xum expands. The reported name still stops before a
  default.
- A Cursor package without mcpServers fell back to .mcp.json, which in a
  multi-harness repository belongs to Codex. Cursor discovers only mcp.json,
  so that is the only default now.

The 104-file marketplace sweep gives the same rows as before.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$25.50`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=25.50 -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Head: 9a5003f

Round 1 findings: any ${...} value in a Cursor server now needs values (including ${env:api-key} and ${/}), and a Cursor package without mcpServers defaults to mcp.json only.

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 9a5003f303

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 9a5003f303

ℹ️ 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".

Codex security review round 2 on #7838: the needs-values pattern
/\$\{((?:env:)?[^}:]*)[^}]*\}/g has two overlapping star terms, so an
unterminated ${ followed by data backtracks quadratically. Discovery runs it
on a plugin's mcp.json before the consent preview, so a malicious repository
could stall the backend (a 131 KB value took 21 s). A left-to-right indexOf
scan finds the same placeholders and names in linear time.

The new discovery test reads a 128 KiB unterminated value in milliseconds and
fails after 23 s with the old pattern.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$30.98`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=30.98 -->
… needs values

Codex round 2 on #7838:
- P1: an installed Cursor plugin whose declared mcpServers file is missing
  looked like a plugin without MCP servers, so sign-out recovery could delete a
  broken pending record without signing out; the restored file would then load
  with the old grant. Now that Cursor MCP servers load, a real declared path is
  contributes.mcp too (as PR 1 planned for this PR), so the recovery guard
  fails closed. Inline and outside paths stay inert.
- P2: a cwd at ${CURSOR_PLUGIN_DATA} or ${CLAUDE_PLUGIN_DATA} now needs values
  (D29: Cursor has no data folder alias), so it also gets a notApplied entry
  instead of only a cwd form error.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$30.98`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=30.98 -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Head: 52399de

Round 2 findings: the placeholder scan is linear-time, a Cursor data-folder cwd needs values, and a declared Cursor MCP file that is missing now keeps the sign-out fence.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 52399de871

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Head: 52399de

@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: 52399de871

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 52399de871

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

…ages

Codex round 7 on #7838: Cursor expands only ${CURSOR_PLUGIN_ROOT} and
${CLAUDE_PLUGIN_ROOT}. A Cursor server with ${PLUGIN_ROOT} or ${PLUGIN_DATA} in
args, env or cwd ran in Xum with Xum's paths, while Cursor leaves the text as
written. Those names now need values in the cursor dialect. The cwd is checked
as written, because its root rewrite introduces ${PLUGIN_ROOT}. The command is
still checked after its ${<root>}/<path> rewrite. The 104-file marketplace
sweep gives the same rows (no marketplace file uses these names).

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh` • Cost: `$41.51`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh costs=41.51 -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

Head: 058cc94

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 058cc94508

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 58d096f Oct 31, 2026
37 of 38 checks passed
@ThomasK33
ThomasK33 deleted the cursor-plugins/mcp branch October 31, 2026 23:09
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Nov 1, 2026
…_background (coder#7841)

## Summary

A Cursor plugin agent with `model: fast` now resolves its AI settings
(model, thinking level and Anthropic prompt-cache TTL) through Explore,
at every place Xum reads an agent's AI settings. A Cursor agent with
`is_background: true` gets the hint "[meant to run in the background
(run_in_background=true)]" in the `task` tool's agent list. Tool policy
keeps following `base`, and the `task` schema and its
`run_in_background` default do not change.

## Background

ThomasK33 asked for the Cursor plugin RFC
(`rfc/20261030_cursor-plugin-support.md`) to land as a reviewed PR
stack. This is RFC PR 4 (section "PR 4", section 7 "Agents", decisions
D11, D12, D26, D27, CUJ 2, success check 3).

Before this PR, Cursor's `fast` model alias mapped to nothing, so
`cursor-team-kit/ci-watcher` and similar agents ran on Exec's Settings
model, then the parent model. Cursor runs these agents on a small, fast
model. Explore is Xum's model slot for short read-heavy sub-agent runs,
so a `fast` agent now takes Explore's Settings (then Explore's base,
Exec, then the parent model, as an Explore sub-agent does).

## Implementation

- `pluginAgentFormat.ts`: `model: fast` writes the new optional
frontmatter field `ai.settingsBase: "explore"`, and `is_background:
true` writes `subagent.background_hint: true`. Both fields are in the
mapped frontmatter, so the consent fingerprint covers them: each
installed agent that sets them asks for consent once after this update.
Claude's `background` field stays ignored.
- `applySettingsBaseChain`
(`src/common/utils/ai/agentAncestorLayers.ts`) is the one rule every
consumer uses: the agent's own same-ID entries, then the settings-base
agent's read chain. A settings base that is missing, the agent itself,
inherits from the agent, or sets a settings base of its own ("nested")
is ignored with a `settingsBase ignored` warning, and the agent resolves
as without it (D26). Xum follows one settings base, never a second.
- Consumers:
- runs and task reawaken: `loadAgentDefinitionAiLayers` via
`resolveAgentAiSettingsChain`;
- the prompt-cache TTL: `resolveAgentForStream` returns
`agentAiSettingsChain`, which `turnRequestBuilder` and
`continuousCompactionSummary` pass to `resolveChainAgentCacheTtl`
(`agentInheritanceChain` keeps its meaning for tool policy and
capability checks);
- `agents.list`: descriptor `aiLayers` over the applied chain, and a new
descriptor field `aiSettingsBase` that is set only when the settings
base applies;
- the renderer and ACP: every declared-base map uses `aiSettingsBase ??
base` (`aiSettingsBaseOf`, `getAgentAiSettingsBases`).
- `backgroundHint` rides on the descriptor (`agents.list` and the
tool-context descriptors from `turnContextAssembler`), and
`buildTaskDescription` prints the hint.

## Deviations from the RFC text

1. `resolveAgentAiSettingsChain(agentId, chain, context)` reads the
settings base from the closest hop of the read chain
(`chainSettingsBase`), the value the base-merged frontmatter has. The
RFC read `agentDefinition.frontmatter`, which is unmerged: an inherited
settings base would then apply in `agents.list` but not in a run.
`agents.list` uses the same helper.
2. The renderer has 6 more base maps than RFC 4.9 lists
(WorkspaceModeAISync, ChatInput twice, useSendMessageOptions twice,
ThinkingContext) plus the TasksSection model walk. All use
`getAgentAiSettingsBases`, so a `fast` agent's child workspace shows the
model a run uses.
3. RFC review round 5: `agents.list` leaves disabled agents out, so with
Explore disabled the renderer walk stopped at Explore and lost Exec's
defaults. `collectUnlistedAncestorHops` adds the hops of each listed
agent's resolved `aiLayers` through agents the list leaves out. It is
used by `getAgentAiSettingsBases` and ACP. A listed agent's own base
still wins. Side effect: an ordinary `base` through a disabled agent now
also reaches its further bases in the renderer, as a run already does.
4. The "tool policy is unchanged" test lives in
`agentResolution.test.ts`, which computes `effectiveToolPolicy`.
5. Codex round 1: ACP now takes each listed agent's own definition layer
(`aiLayers.targetDefinitionAiDefaults`) instead of its base-merged
`aiDefaults`, as Settings > Tasks already does, so an ordinary base's
frontmatter cannot outrank the settings-base chain. For agents without a
settings base this also stops ACP from ranking a base's frontmatter
above that base's Settings, which matches a run.
6. Codex round 1 (and verifier F2): a settings base whose read chain
stops at a missing or cyclic base is ignored as "missing" in a run too,
as `agents.list` already did.
7. Codex round 1: `docs/agents/index.mdx` (and the generated built-in
docs skill) list `model: fast` and `is_background: true` with their new
mappings. The rest of the Cursor docs stay in RFC PR 9.
8. Codex round 2: a Settings > Tasks card's Inherit model (its thinking
ladder and Pro gating) comes from the shared resolver over the
descriptor's `aiLayers` (`resolveInheritedLayerModel`), not from the
base-merged `aiDefaults`, which still hold the bases a settings base
replaces. Cards without layers keep the old walk.
9. Codex round 3: the settings base is read the way the declaring hop's
`base` would be read (`computeBaseSkipScope`), so a global agent's
settings base skips project agents. `agents.list` therefore does one
scoped read per settings-base agent (the RFC planned no extra reads),
and ACP takes the target's `aiLayers`. A settings base is also ignored
(reason `incomplete`) when the agent's own chain or the settings base's
chain stops at a missing or cyclic base, since `agents.list` cannot
resolve those.
10. `Test / Storybook` fix: `useAutoRouting` and
`useWorkspaceAiSelection` pass the AI-selection store version into their
resolvers. The React Compiler memoizes those resolvers on their
arguments, and a memoized base map (`getAgentAiSettingsBases`) left an
Auto pick stale.

## Validation

- Unit and real-instance tests: `agentAncestorLayers.test.ts` (new),
`resolveNodeAgentAiSettings.test.ts`, `agentResolution.test.ts`,
`agentDefinitionsService.test.ts` (descriptor list through the renderer
resolver), `workspaceModeAi.test.ts`, `pluginAgentFormat.test.ts`,
`task.test.ts`, `aiService.test.ts` (wire-level prompt-cache TTL of a
settings-base agent, and the inherited hint in the task description),
and `src/node/acp/resolveAgentAiSettings.test.ts` (new). The guards for
the nested rule, the unlisted hops, the TTL call site, the ACP map and
the tool-context hint each fail when their line is broken in a scratch
edit.
- Dogfood in a dev-server sandbox with `cursor-team-kit` installed
unmanaged (Explore = Haiku 5.5 and Exec = Sonnet 5.5 in Settings). An
Exec chat on Sonnet 5.5 spawned `ci-watcher`:
- The sub-agent ran on Haiku 5.5 (header, composer and the request's
`modelId`), with a 5-minute cache TTL on all 12 cache marks. The parent
sent 1 hour.
- The parent's request listed `- ci-watcher: Watch PR CI … [meant to run
in the background (run_in_background=true)]`.
- Settings > Tasks shows ci-watcher's prompt cache as "Inherit (5
minutes)" (Explore's), next to "Inherit (1 hour)" for an Exec-based
agent.

![Sub-agent report on Haiku 5.5 from a Sonnet 5.5
parent](https://github.com/user-attachments/assets/62cc39b7-8cfa-4caf-8c8c-5dc160e82d9b)

![ci-watcher child workspace on Haiku
5.5](https://github.com/user-attachments/assets/5d3a7fdf-2efd-497d-a2ec-c4330d501a4a)

![Settings > Tasks: ci-watcher inherits Explore's 5-minute prompt
cache](https://github.com/user-attachments/assets/83e88496-8137-4bfa-9b2b-e28c9d10c119)

## Risks

- Low. The new behavior applies only to agents with `ai.settingsBase`,
which only the Cursor mapping writes, plus the renderer fill for chains
through a disabled agent (deviation 3) and ACP's per-layer defaults
(deviation 5). Tool policy does not read the new fields.
- Each installed Cursor `fast` or `is_background` agent asks for consent
once after this update (fingerprint change).
- Downgrade: older builds strip `ai.settingsBase` and
`subagent.background_hint` (`.strip()` schemas) and resolve as before.

## Release note

RFC section 8 has no row for PR 4: it changes nothing for users without
a Cursor plugin. For Cursor plugin users: an agent with `model: fast`
uses Explore's model, thinking level and prompt-cache TTL from Settings
(then Exec's, then the parent's). An agent with `is_background: true` is
marked "meant to run in the background" in the task tool's agent list.
Installed agents with either field ask for consent once.

## Follow-ups (not in this PR)

- F3 (verifier, Low): an agent derived from a `fast` agent (`base:
ci-watcher`) drops the `fast` agent's own layers, because the
settings-base chain follows the target's own entries (RFC 4.3 rule 5).
All consumers agree.
- Renderer walks keyed by agent ID (Codex round 4): the renderer's base
map holds one base per agent ID, so two listed agents that reach the
same unlisted agent at different scopes share one hop
(`collectUnlistedAncestorHops`), and ordinary scope-skipping bases
diverge the same way. Fix: the renderer walks read each target's
resolved `aiLayers`.
- Renderer-map tests: the WorkspaceModeAISync, ThinkingContext,
useSendMessageOptions, ChatInput and TasksSection maps have no test that
fails when one goes back to `base`. They need React rendering.
- Settings > Tasks shows "Inherit" for every inheriting agent's model
and never names the inherited model. An "Inherit (model)" label is new
UI outside this PR.

Stack: RFC PR 4, based on coder#7838 (PR 3, `cursor-plugins/mcp`).

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`xhigh` • Cost: `$48.63`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh
costs=48.63 -->
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.

1 participant