Skip to content

feat(next-wxt): 支持 Options 在线编辑页面 MCP 脚本 - #536

Merged
zzcr merged 5 commits into
devfrom
zzc/feat-add-editor-mcp-0730
Jul 31, 2026
Merged

feat(next-wxt): 支持 Options 在线编辑页面 MCP 脚本#536
zzcr merged 5 commits into
devfrom
zzc/feat-add-editor-mcp-0730

Conversation

@zzcr

@zzcr zzcr commented Jul 30, 2026

Copy link
Copy Markdown
Member

Pull Request (OpenTiny NEXT-SDKs)

PR Gate 根据约定式标题判断类型(fix / feat / docs / …),并从本 PR 变更文件自动校验:Bug 须有复现测试,Feature 须同时有 Spec 与测试。
标签为兜底(与 auto-label 一致:bug / enhancement 等)。琐碎 Feature 可打 skip-spec(仅豁免 Spec);应急打 gate-bypass

Summary

What is the current behavior?

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

(可选。Issue 请用 GitHub 原生关联,无需手填路径。)

Summary by CodeRabbit

  • New Features
    • Added a “Page MCP Scripts” editor to create, edit, enable/disable, delete, import/export custom scripts.
    • Scripts match URL patterns in the MAIN world, register WebMCP tools, and can replace built-in tools to skip default injection.
    • Saved changes now trigger more precise reinjection and refresh behavior.
  • Documentation
    • Expanded and refined MCP extension guidance, including injection strategy, debugging/validation, and new user MCP script requirements/specs.
  • Tests
    • Added unit coverage for matching, storage, script resolution, and a CSP bridge regression test.
  • Chores
    • Added Vitest test runner scripts/config for the next-wxt package.

@cursor

cursor Bot commented Jul 30, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions github-actions Bot added the enhancement New feature or request label Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

[ci-test-pass]

未改动测试相关源码(next-sdk / webmcp-cli),已跳过单元测试与浏览器 E2E。

  • Workflow: 查看日志
  • Commit: 6776ff5f0f481b7a1b91703b2f4e87824a1af6b8
  • Unit: skipped
  • Browser: skipped

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds user-defined MCP script storage, matching, editing, MAIN-world execution, built-in server override behavior, tab reinjection, Vitest coverage, and documentation updates for the Next WXT extension.

Changes

User MCP script lifecycle

Layer / File(s) Summary
Script contracts, matching, and storage
packages/next-wxt/user-mcp-scripts/*
Defines script types, @match validation, deterministic resolution, serialized storage mutations, JSON import/export, default templates, and bridge ownership contracts.
MAIN-world injection and reinjection
packages/next-wxt/entrypoints/background.ts, packages/next-wxt/entrypoints/background/inject-user-mcp-scripts.ts, packages/next-wxt/entrypoints/content.ts, packages/next-wxt/public/vendor/user-mcp-exec.js, packages/next-wxt/wxt.config.ts
Routes injection messages, validates the extension-owned bridge, executes matching scripts, conditionally skips built-in servers, and reloads matching tabs after changes.
Options script management
packages/next-wxt/entrypoints/options/Options.vue, packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue, packages/next-wxt/components.d.ts
Adds the Page MCP scripts tab with editing, reinjection snapshots, import/export, keyboard accessibility, dirty-state handling, and editor layout updates.
Tests, specifications, and extension guidance
packages/next-wxt/test/user-mcp-scripts/*, packages/next-wxt/vitest.config.ts, packages/next-wxt/package.json, packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/*, docs/ai-extension/next-wxt.md
Adds Vitest configuration and coverage, formal requirements and design documentation, component typing, and updated injection and debugging guidance.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Options
  participant Background
  participant Content
  participant MainWorld
  User->>Options: Edit and save MCP script
  Options->>Background: Request reinjection
  Background->>Content: Reload matching tab
  Content->>Background: Request matching scripts
  Background->>MainWorld: Execute user script through owned bridge
  MainWorld-->>Background: Return execution result
  Background-->>Content: Return skip-built-in decision
  Content->>MainWorld: Inject built-in server when allowed
Loading

Possibly related PRs

Poem

A bunny typed scripts by moonlight bright,
Saved little tools for pages in flight.
Through bridges they hopped,
Built-ins were stopped,
And tabs refreshed with delight! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.54% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次 PR 的核心变化:在 next-wxt 的 Options 中支持在线编辑页面 MCP 脚本。
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zzc/feat-add-editor-mcp-0730

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 10

🧹 Nitpick comments (9)
packages/next-wxt/user-mcp-scripts/storage.ts (2)

75-75: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant expression.

input.id && store[input.id] ? input.id : input.id || newId() collapses to input.id || newId() — both branches yield input.id when it is truthy.

♻️ Simplify
-  const id = input.id && store[input.id] ? input.id : input.id || newId()
+  const id = input.id || newId()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/user-mcp-scripts/storage.ts` at line 75, In the ID
assignment expression, simplify the redundant conditional to use input.id when
present and newId() otherwise; update the const id initialization without
changing its fallback behavior.

87-95: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Whole-store read-modify-write can lose concurrent updates.

Every mutator re-reads the full store and writes it back, so a rapid toggle while a save is in flight (or a save concurrent with an import) drops one of the two writes. Serializing writes behind a single promise chain in this module removes the window cheaply.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/user-mcp-scripts/storage.ts` around lines 87 - 95,
Serialize all user MCP script store mutations in this module through a single
promise chain, including the read-modify-write flow in removeUserMcpScript and
the other mutators. Ensure each operation waits for the previous operation to
finish before reading and persisting the store, while preserving the existing
mutation results and API behavior.
packages/next-wxt/entrypoints/options/Options.vue (1)

70-73: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

overflow: visible applies to every tab, not just the scripts tab.

The comment scopes the intent to 页面 MCP 脚本, but this deep selector affects Skills / Token / 模型 content too. Worth a quick visual check on the other tabs, or scope it via a class on the tab content.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/entrypoints/options/Options.vue` around lines 70 - 73,
Scope the overflow override in the .options-tabs styling to the MCP scripts tab
content instead of applying it to every tab. Add or reuse a tab-specific class
or selector in the Options component, and keep overflow visible only for that
content while leaving Skills, Token, and model tabs unchanged.
packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue (4)

620-622: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Gutter re-renders one node per line on every keystroke.

lineNumbers reallocates the array and Vue re-diffs one div per line on each edit; a few-thousand-line script makes typing sluggish. v-for="n in sourceLineCount" drops the array allocation, and rendering the numbers as a single <pre> text block (or counter-increment) removes the per-line nodes entirely.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue` around lines 620
- 622, Optimize the line-number gutter around lineNumbers by removing the
per-line array allocation and individual div rendering. Use sourceLineCount
directly with a single preformatted text block or CSS counters, preserving
accurate numbering as the script changes.

102-108: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Spread getter is unnecessary with a reactive source.

watch(editForm, ...) on a reactive object is already deep; the () => ({ ...editForm }) getter just allocates a copy on every tick.

♻️ Simplify
-watch(
-  () => ({ ...editForm }),
-  () => {
-    if (isEditing.value) isDirty.value = true
-  },
-  { deep: true }
-)
+watch(editForm, () => {
+  if (isEditing.value) isDirty.value = true
+})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue` around lines 102
- 108, Update the watcher around editForm to watch the reactive object directly
instead of using the spread getter, while preserving the existing deep-change
callback that marks isDirty when isEditing is true.

211-241: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

openCreateForced duplicates openCreate, and the discard path skips clearValidate.

Both paths build the same default meta and reset state; only the dirty-guard differs. Extracting the body would also fix the divergence: openCreateForced and the id branch of confirmDiscard never call editFormRef.clearValidate(), so stale validation errors from the abandoned draft can persist into the newly opened script.

♻️ Extract shared draft initializer
+function applyNewDraft() {
+  selectedKey.value = '__new__'
+  fillFormFromMeta(createDefaultScriptMeta({ name: '我的页面工具', matches: ['*://example.com/*'] }))
+  collapseNames.value = ['meta']
+  nextTick(() => {
+    isDirty.value = false
+    editFormRef.value?.clearValidate?.()
+    focusEditor()
+  })
+}
+
 function openCreate() {
-  trySelect('__new__', () => {
-    selectedKey.value = '__new__'
-    const meta = createDefaultScriptMeta({ name: '我的页面工具', matches: ['*://example.com/*'] })
-    fillFormFromMeta(meta)
-    collapseNames.value = ['meta']
-    nextTick(() => {
-      isDirty.value = false
-      editFormRef.value?.clearValidate?.()
-      focusEditor()
-    })
-  })
+  trySelect('__new__', applyNewDraft)
 }

(then use applyNewDraft() in place of openCreateForced())

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue` around lines 211
- 241, Extract the shared new-script draft initialization from openCreate into
an applyNewDraft helper, including default metadata, form population, collapse
state, dirty-state reset, editor focus, and editFormRef.clearValidate(). Use
applyNewDraft() from both openCreate and openCreateForced, and ensure the
existing-id branch of confirmDiscard also clears validation when loading the
selected script.

623-631: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an accessible label to the code textarea.

The source editor has no aria-label or associated <label>, so screen readers announce it as an unlabeled text field.

♿ Label the editor
             <textarea
               ref="sourceEditorRef"
               v-model="editForm.source"
               class="source-editor"
+              aria-label="脚本源码(JavaScript)"
               spellcheck="false"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue` around lines 623
- 631, Add an accessible label to the textarea identified by sourceEditorRef in
the source editor template, using an aria-label or an associated label element
with descriptive text. Preserve the existing v-model and event bindings.
packages/next-wxt/user-mcp-scripts/match.ts (1)

81-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the unused RegExp factory.

matchPatternToRegExp is not consumed by the rest of the codebase; keep matchUrl as the single match implementation and delete the exported compiled-regex helper to avoid future drift.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/user-mcp-scripts/match.ts` around lines 81 - 89, Remove the
exported matchPatternToRegExp function and its associated unused helper logic
from match.ts. Keep matchUrl as the sole URL-pattern matching implementation,
ensuring no remaining imports or references depend on the deleted RegExp
factory.
packages/next-wxt/components.d.ts (1)

12-25: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Declare the individual TinyVue component packages used by the auto-generated declarations.

These components.d.ts entries match TinyVueSingleResolver’s per-component package mapping, but next-wxt only declares @opentiny/vue, so TinyAlert, TinyCollapse, TinyCollapseItem, TinyTag, and TinyTooltip are phantom type-only dependencies. Add the same sub-packages as devDependencies to avoid broken type-checks when installing/upgrading.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/next-wxt/components.d.ts` around lines 12 - 25, Update the next-wxt
package’s development dependencies to include the individual `@opentiny/vue`
component packages referenced by the TinyAlert, TinyCollapse, TinyCollapseItem,
TinyTag, and TinyTooltip declarations, matching TinyVueSingleResolver’s package
mapping. Keep the existing generated declarations unchanged and add the
corresponding sub-packages so type-checking resolves them directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue`:
- Around line 394-411: Update onSourceKeydown so Tab remains trapped only for
indentation when appropriate, while providing a keyboard escape path to move
focus out of the editor (such as an Esc-then-Tab flow), and document that
shortcut in the 提示 hint. Also normalize e.key with toLowerCase() for the
Ctrl/Cmd+S check so uppercase S is handled.
- Around line 356-363: Update the export flow around the anchor click in
UserMcpScriptsTab so the object URL remains valid until the download has
started. Defer URL.revokeObjectURL(url) instead of revoking it synchronously,
while preserving the existing generated filename and download behavior.
- Around line 284-305: Update the save flow around upsertUserMcpScript and
notifyReinject to capture the existing script’s matches before calling
upsertUserMcpScript, then pass that pre-save snapshot along with the new script
data so tabs matching old patterns are refreshed. Wrap the upsert await in error
handling and display thrown failures through Message.message instead of allowing
an unhandled rejection.

In `@packages/next-wxt/public/vendor/user-mcp-exec.js`:
- Around line 7-16: Replace the page-writable global execution bridge with an
extension-owned capability: in packages/next-wxt/public/vendor/user-mcp-exec.js
lines 7-16, never reuse a pre-existing window[KEY], establish immutable
ownership, and fail closed on collisions; in
packages/next-wxt/user-mcp-scripts/exec-bridge.ts lines 8-16, update the bridge
contract to use that capability rather than a predictable fixed global; in
packages/next-wxt/entrypoints/background/inject-user-mcp-scripts.ts lines 35-41,
pass script source only after verifying the extension-owned capability and
return failure when verification cannot be established.

In `@packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/design.md`:
- Line 42: Update the dependency statement in the design specification to match
the implementation: remove jsdom from the listed next-wxt devDependencies unless
browser APIs are intentionally required. Keep Vitest and the test script
documented, consistent with vitest.config.ts using the node environment.

In `@packages/next-wxt/test/user-mcp-scripts/csp-bridge-repro.test.ts`:
- Around line 23-27: Extend the test around buildBridgeInvokeSnippet to exercise
executeUserSourceInMainWorld from inject-user-mcp-scripts.ts, mocking or driving
the executor as needed. Assert that execution uses world: 'MAIN' and invokes
window.__NEXT_WXT_EXEC_USER_MCP_SCRIPT__ with the user source, while retaining
the existing snippet string assertions as supplemental coverage.

In `@packages/next-wxt/user-mcp-scripts/match.ts`:
- Around line 113-122: Update validateMatchPattern to reject match patterns
containing a port, preventing MATCH_RE from accepting patterns that the matching
logic cannot compare correctly. Preserve existing hostname and wildcard
validation behavior for portless patterns, and ensure invalid port-bearing
patterns return the established validation error.

In `@packages/next-wxt/user-mcp-scripts/storage.ts`:
- Around line 97-102: Update setUserMcpScriptEnabled to modify only the existing
script’s enabled flag directly in the store instead of calling
upsertUserMcpScript, preserving updatedAt and sidebar ordering. Keep the
missing-script error response and UpsertResult contract unchanged.
- Around line 153-164: The import loop in the script import flow must force
every successfully normalized imported script to disabled regardless of its
source enabled value, including scripts with replacesBuiltIn set. Track entries
rejected by normalizeScript or validateMatchPatterns in a skipped count, and
include that count alongside imported in the returned result so the UI can
report partial failures.

In `@packages/next-wxt/user-mcp-scripts/template.ts`:
- Around line 47-53: Update the toolSlug generation near the name normalization
so non-ASCII-only names receive a unique short suffix instead of sharing the
static user_mcp_hello fallback. Preserve the existing normalization and length
limit, ensure the resulting slug remains valid for the registration guard, and
keep deterministic slugs for names that already produce non-empty ASCII output.

---

Nitpick comments:
In `@packages/next-wxt/components.d.ts`:
- Around line 12-25: Update the next-wxt package’s development dependencies to
include the individual `@opentiny/vue` component packages referenced by the
TinyAlert, TinyCollapse, TinyCollapseItem, TinyTag, and TinyTooltip
declarations, matching TinyVueSingleResolver’s package mapping. Keep the
existing generated declarations unchanged and add the corresponding sub-packages
so type-checking resolves them directly.

In `@packages/next-wxt/entrypoints/options/Options.vue`:
- Around line 70-73: Scope the overflow override in the .options-tabs styling to
the MCP scripts tab content instead of applying it to every tab. Add or reuse a
tab-specific class or selector in the Options component, and keep overflow
visible only for that content while leaving Skills, Token, and model tabs
unchanged.

In `@packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue`:
- Around line 620-622: Optimize the line-number gutter around lineNumbers by
removing the per-line array allocation and individual div rendering. Use
sourceLineCount directly with a single preformatted text block or CSS counters,
preserving accurate numbering as the script changes.
- Around line 102-108: Update the watcher around editForm to watch the reactive
object directly instead of using the spread getter, while preserving the
existing deep-change callback that marks isDirty when isEditing is true.
- Around line 211-241: Extract the shared new-script draft initialization from
openCreate into an applyNewDraft helper, including default metadata, form
population, collapse state, dirty-state reset, editor focus, and
editFormRef.clearValidate(). Use applyNewDraft() from both openCreate and
openCreateForced, and ensure the existing-id branch of confirmDiscard also
clears validation when loading the selected script.
- Around line 623-631: Add an accessible label to the textarea identified by
sourceEditorRef in the source editor template, using an aria-label or an
associated label element with descriptive text. Preserve the existing v-model
and event bindings.

In `@packages/next-wxt/user-mcp-scripts/match.ts`:
- Around line 81-89: Remove the exported matchPatternToRegExp function and its
associated unused helper logic from match.ts. Keep matchUrl as the sole
URL-pattern matching implementation, ensuring no remaining imports or references
depend on the deleted RegExp factory.

In `@packages/next-wxt/user-mcp-scripts/storage.ts`:
- Line 75: In the ID assignment expression, simplify the redundant conditional
to use input.id when present and newId() otherwise; update the const id
initialization without changing its fallback behavior.
- Around line 87-95: Serialize all user MCP script store mutations in this
module through a single promise chain, including the read-modify-write flow in
removeUserMcpScript and the other mutators. Ensure each operation waits for the
previous operation to finish before reading and persisting the store, while
preserving the existing mutation results and API behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fffa1e11-9db4-4f21-8f95-842a422e982a

📥 Commits

Reviewing files that changed from the base of the PR and between c3a3843 and 09472fc.

📒 Files selected for processing (26)
  • docs/ai-extension/next-wxt.md
  • packages/next-wxt/components.d.ts
  • packages/next-wxt/entrypoints/background.ts
  • packages/next-wxt/entrypoints/background/inject-user-mcp-scripts.ts
  • packages/next-wxt/entrypoints/content.ts
  • packages/next-wxt/entrypoints/options/Options.vue
  • packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue
  • packages/next-wxt/mcp-servers/types.d.ts
  • packages/next-wxt/package.json
  • packages/next-wxt/public/vendor/user-mcp-exec.js
  • packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/design.md
  • packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/requirements.md
  • packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/tasks.md
  • packages/next-wxt/test/user-mcp-scripts/csp-bridge-repro.test.ts
  • packages/next-wxt/test/user-mcp-scripts/match.test.ts
  • packages/next-wxt/test/user-mcp-scripts/resolve.test.ts
  • packages/next-wxt/test/user-mcp-scripts/storage.test.ts
  • packages/next-wxt/user-mcp-scripts/exec-bridge.ts
  • packages/next-wxt/user-mcp-scripts/index.ts
  • packages/next-wxt/user-mcp-scripts/match.ts
  • packages/next-wxt/user-mcp-scripts/resolve.ts
  • packages/next-wxt/user-mcp-scripts/storage.ts
  • packages/next-wxt/user-mcp-scripts/template.ts
  • packages/next-wxt/user-mcp-scripts/types.ts
  • packages/next-wxt/vitest.config.ts
  • packages/next-wxt/wxt.config.ts

Comment thread packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue Outdated
Comment thread packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue Outdated
Comment thread packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue
Comment thread packages/next-wxt/public/vendor/user-mcp-exec.js Outdated
Comment thread packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/design.md Outdated
Comment thread packages/next-wxt/test/user-mcp-scripts/csp-bridge-repro.test.ts
Comment thread packages/next-wxt/user-mcp-scripts/match.ts
Comment thread packages/next-wxt/user-mcp-scripts/storage.ts
Comment thread packages/next-wxt/user-mcp-scripts/storage.ts Outdated
Comment thread packages/next-wxt/user-mcp-scripts/template.ts Outdated
@zzcr zzcr changed the title feat: 新增动态添加编辑mcpservers脚本功能 feat: 新增动态添加和编辑mcpservers脚本的功能 Jul 30, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/next-wxt/public/vendor/user-mcp-exec.js`:
- Around line 11-37: Replace the forgeable __NEXT_WXT_OWNED__ marker with an
extension-controlled, non-forgeable capability token shared by the bridge and
its verifier, and enforce the required injection/check ordering so page code
cannot supply an accepted function. Update install() in
packages/next-wxt/public/vendor/user-mcp-exec.js, the bridge ownership logic in
packages/next-wxt/user-mcp-scripts/exec-bridge.ts, and injection handling in
packages/next-wxt/entrypoints/background/inject-user-mcp-scripts.ts; document
and assert the ordering in wxt.config.ts and content.ts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cece898d-6830-4eb1-9ce0-e6f99922c651

📥 Commits

Reviewing files that changed from the base of the PR and between 09472fc and 4efb24e.

📒 Files selected for processing (9)
  • packages/next-wxt/entrypoints/background/inject-user-mcp-scripts.ts
  • packages/next-wxt/entrypoints/options/Options.vue
  • packages/next-wxt/entrypoints/options/UserMcpScriptsTab.vue
  • packages/next-wxt/public/vendor/user-mcp-exec.js
  • packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/design.md
  • packages/next-wxt/user-mcp-scripts/exec-bridge.ts
  • packages/next-wxt/user-mcp-scripts/match.ts
  • packages/next-wxt/user-mcp-scripts/storage.ts
  • packages/next-wxt/user-mcp-scripts/template.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/next-wxt/specs/REQ-20260730-user-mcp-scripts/design.md

Comment thread packages/next-wxt/public/vendor/user-mcp-exec.js Outdated
@zzcr zzcr changed the title feat: 新增动态添加和编辑mcpservers脚本的功能 feat(next-wxt): 支持 Options 在线编辑页面 MCP 脚本 Jul 30, 2026
@zzcr
zzcr merged commit e78423d into dev Jul 31, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant