Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(mcp-market): honor explicit project installation targets

Linuxdazhao8b320b4eb278
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 32ef8dcab..b79d099d2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -187,5 +187,7 @@ jobs:
env:
DEBUG_E2E: "1"
run: xvfb-run --auto-servernum pnpm test:e2e:trusted-extensions
+ - name: Run MCP market owner E2E
+ run: xvfb-run --auto-servernum node --test apps/desktop/test/mcp-market-owner-user-path.test.mjs
- name: Run File Manager theme E2E
run: xvfb-run --auto-servernum pnpm test:e2e:file-manager-theme
diff --git a/apps/desktop/src/components/settings/AgentMcpPage.tsx b/apps/desktop/src/components/settings/AgentMcpPage.tsx
index 091998c51..0b8d946cd 100644
--- a/apps/desktop/src/components/settings/AgentMcpPage.tsx
+++ b/apps/desktop/src/components/settings/AgentMcpPage.tsx
@@ -613,6 +613,7 @@ export function AgentMcpPage() {
const marketButton = (
<CapabilityButton
+ disabled={targetLevel === "project" && !selectedProjectPath}
onClick={() => setView("market")}
>
<IconServer size={14} />
@@ -623,7 +624,9 @@ export function AgentMcpPage() {
if (view === "market") {
return (
<McpMarketPanel
- installedIds={[...globalServers, ...projectServers].map((server) => server.id)}
+ level={targetLevel}
+ projectPath={targetLevel === "project" ? selectedProjectPath ?? undefined : undefined}
+ installedIds={(targetLevel === "project" ? projectServers : globalServers).map((server) => server.id)}
onBack={() => {
setView("servers");
void load();
diff --git a/apps/desktop/src/components/settings/McpMarketPanel.tsx b/apps/desktop/src/components/settings/McpMarketPanel.tsx
index 72693454c..f60e0e5d2 100644
--- a/apps/desktop/src/components/settings/McpMarketPanel.tsx
+++ b/apps/desktop/src/components/settings/McpMarketPanel.tsx
@@ -5,12 +5,12 @@ import {
allowInsecureUserEndpoints,
BUILTIN_MCP_CATALOG,
DEFAULT_MARKET_SOURCE,
- GLOBAL_SCOPE,
isSafeMarketSourceUrl,
mergeRegistryEntries,
resolveCatalogEntry,
sanitizeMarketSources,
validateMcpCatalogFile,
+ type AgentCapabilityLevel,
type MarketSource,
type McpCatalogCategory,
type McpCatalogEntry,
@@ -102,10 +102,14 @@ function loadSources(allowInsecureHttp = false): MarketSource[] {
* of its own, and the exact command is on screen before anything is saved.
*/
export function McpMarketPanel({
+ level,
+ projectPath,
installedIds,
onBack,
onInstalled,
}: {
+ level: AgentCapabilityLevel;
+ projectPath?: string;
installedIds: readonly string[];
onBack: () => void;
onInstalled: (id: string) => void;
@@ -286,10 +290,18 @@ export function McpMarketPanel({
const install = async () => {
if (!installFor || saving) return;
+ if (level === "project" && !projectPath) {
+ showToast(t("settings.selectProjectFirst"), { variant: "error" });
+ return;
+ }
setSaving(true);
try {
const input = resolveCatalogEntry(installFor, values);
- await api.upsertMcpServer({ ...input, level: "global", scope: GLOBAL_SCOPE });
+ await api.upsertMcpServer({
+ ...input,
+ level,
+ ...(level === "project" ? { projectPath } : {}),
+ });
showToast(t("settings.mcpMarket.installSuccess", { name: installFor.name }), {
variant: "success",
});
diff --git a/apps/desktop/test/mcp-market-owner-user-path.test.mjs b/apps/desktop/test/mcp-market-owner-user-path.test.mjs
new file mode 100644
index 000000000..97f5a453e
--- /dev/null
+++ b/apps/desktop/test/mcp-market-owner-user-path.test.mjs
@@ -0,0 +1,195 @@
+import assert from "node:assert/strict";
+import { spawn } from "node:child_process";
+import { createRequire } from "node:module";
+import { mkdtemp, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import test from "node:test";
+import { repositoryRoot, resolveElectronBinary } from "../../../scripts/e2e/boot.mjs";
+
+const root = repositoryRoot();
+const { build } = createRequire(join(root, "packages/agent-runtime/package.json"))("esbuild");
+const fixture = String.raw`
+import React from "react";
+import { createRoot } from "react-dom/client";
+import { flushSync } from "react-dom";
+import i18n from "i18next";
+import { initReactI18next } from "react-i18next";
+import { catalogs, flattenCatalog } from "@pi-desktop/i18n";
+import { BUILTIN_MCP_CATALOG, IPC } from "@pi-desktop/shared";
+import { AgentMcpPage } from "../../apps/desktop/src/components/settings/AgentMcpPage";
+import { McpMarketPanel } from "../../apps/desktop/src/components/settings/McpMarketPanel";
+import { ToastHost } from "../../apps/desktop/src/components/Toast";
+import { useAppStore } from "../../apps/desktop/src/stores/app-store";
+
+const projectPath = "/projects/market-owner-a";
+const entry = BUILTIN_MCP_CATALOG.servers.find((item) => !item.requiredEnv?.length);
+const settings = { defaultMode: "agent", theme: "light", language: "en" };
+let records = [], writes = [], hasProject = true;
+Object.defineProperty(window, "AudioContext", { configurable: true, value: undefined });
+window.piDesktop = {
+ platform: "darwin",
+ on() { return () => {}; },
+ async invoke(channel, input) {
+ let data;
+ switch (channel) {
+ case IPC.invoke.projectList:
+ data = { projects: hasProject ? [{ id: 1, path: projectPath, name: "Market Project" }] : [] };
+ break;
+ case IPC.invoke.mcpList:
+ data = { servers: records.filter((record) => record.level === input.level &&
+ (record.level === "global" || record.projectPath === input.projectPath)), statuses: [] };
+ break;
+ case IPC.invoke.settingsGet:
+ data = settings;
+ break;
+ case IPC.invoke.mcpMarketSearch:
+ data = { entries: [], exhausted: true };
+ break;
+ case IPC.invoke.mcpUpsert:
+ writes.push(input);
+ data = { server: { ...input, enabled: true } };
+ records.push(data.server);
+ break;
+ default:
+ throw new Error("Unexpected fixture IPC: " + channel);
+ }
+ return { ok: true, data };
+ },
+};
+await i18n.use(initReactI18next).init({
+ lng: "en", keySeparator: false,
+ resources: { en: { translation: flattenCatalog(catalogs.en) } },
+ interpolation: { escapeValue: false },
+});
+const root = createRoot(document.getElementById("root"));
+const assert = (value, message) => { if (!value) throw new Error(message); };
+async function until(predicate, message) {
+ const deadline = performance.now() + 5000;
+ while (!predicate() && performance.now() < deadline) await new Promise(requestAnimationFrame);
+ assert(predicate(), message);
+}
+const click = (node) => { assert(node, "Missing action"); flushSync(() => node.click()); };
+const button = (label) => [...document.querySelectorAll("button")]
+ .find((node) => node.textContent.trim() === label);
+const marketAction = () => [...document.querySelectorAll(".mcpm-card")]
+ .find((node) => node.querySelector(".mcpm-name")?.textContent === entry.name)
+ ?.querySelector("button");
+async function openMarket() {
+ click(button(i18n.t("settings.mcpMarket.browse")));
+ await until(marketAction, "Market entry did not render");
+}
+async function install() {
+ assert(!marketAction().disabled, "An entry in another owner must not block installation");
+ click(marketAction());
+ click(document.querySelector('[role="dialog"] .ext-sheet-actions button.mcpm-install:not(.is-ghost)'));
+ await until(() => !document.querySelector(".mcpm"), "Install did not return to MCP settings");
+}
+window.mcpMarketOwnerProbe = async () => {
+ const results = [];
+ for (const [filter, project, otherOwner] of [
+ ["project", projectPath, false], ["all", projectPath, false],
+ ["global", projectPath, false], ["all", null, false],
+ ["project", projectPath, true], ["all", projectPath, true],
+ ]) {
+ flushSync(() => root.render(null));
+ hasProject = Boolean(project);
+ writes = [];
+ const level = filter === "project" ? "project" : "global";
+ records = otherOwner ? [{ ...entry, label: entry.name, enabled: true,
+ level: level === "global" ? "project" : "global", projectPath }] : [];
+ useAppStore.setState({ settings, workspace: project ? { path: project, name: "Market Project" } : null });
+ flushSync(() => root.render(<><AgentMcpPage /><ToastHost /></>));
+ await until(() => document.querySelector('.agent-capability-segment button[role="radio"]'), "MCP filters missing");
+ click([...document.querySelectorAll('.agent-capability-segment button[role="radio"]')]
+ .find((node) => node.textContent.trim().startsWith(i18n.t("settings.capabilityFilter" + filter[0].toUpperCase() + filter.slice(1)))));
+ await openMarket();
+ await install();
+ assert(writes.length === 1, "Market must save one server");
+ assert(writes[0].level === level, filter + " installation wrote to " + writes[0].level);
+ assert(writes[0].projectPath === (level === "project" ? project : undefined), "Wrong project owner");
+ await until(() => [...document.querySelectorAll(".agent-capability-name")]
+ .some((node) => node.textContent === entry.name), "Installed server is not visible");
+ await openMarket();
+ await until(() => marketAction()?.disabled, "Installed state must follow the destination owner");
+ results.push({ filter, project, otherOwner, level: writes[0].level });
+ }
+ flushSync(() => root.render(null));
+ hasProject = false;
+ writes = [];
+ records = [];
+ useAppStore.setState({ workspace: null });
+ flushSync(() => root.render(<AgentMcpPage />));
+ click([...document.querySelectorAll('.agent-capability-segment button[role="radio"]')]
+ .find((node) => node.textContent.trim().startsWith(i18n.t("settings.capabilityFilterProject"))));
+ assert(button(i18n.t("settings.mcpMarket.browse")).disabled, "Project market requires a project");
+ flushSync(() => root.render(<><McpMarketPanel level="project" installedIds={[]} onBack={() => {}} onInstalled={() => {}} /><ToastHost /></>));
+ await until(marketAction, "Market guard fixture missing");
+ click(marketAction());
+ click(document.querySelector('[role="dialog"] .ext-sheet-actions button.mcpm-install:not(.is-ghost)'));
+ await until(() => [...document.querySelectorAll(".toast-message")]
+ .some((node) => node.textContent === i18n.t("settings.selectProjectFirst")), "Missing project must report an error");
+ assert(writes.length === 0, "Missing project must never save globally");
+ return { results, missingProjectBlocked: true };
+};
+`;
+
+test("MCP market installation follows the explicit filter and keeps All global", {
+ timeout: 60_000,
+ skip: process.platform === "linux" && !process.env.DISPLAY ? "Electron requires a display" : false,
+}, async () => {
+ const temp = await mkdtemp(join(tmpdir(), "pi-mcp-market-owner-"));
+ try {
+ await build({
+ stdin: { contents: fixture, resolveDir: join(root, "scripts/e2e"), loader: "tsx" },
+ outfile: join(temp, "renderer.js"), bundle: true, platform: "browser", format: "esm", jsx: "automatic",
+ define: { "process.env.NODE_ENV": '"production"', "import.meta.env.DEV": "true" },
+ alias: {
+ "@pi-desktop/i18n": join(root, "packages/i18n/src"),
+ "@pi-desktop/shared": join(root, "packages/shared/src"),
+ react: join(root, "apps/desktop/node_modules/react"),
+ "react-dom": join(root, "apps/desktop/node_modules/react-dom"),
+ i18next: join(root, "apps/desktop/node_modules/i18next"),
+ "react-i18next": join(root, "apps/desktop/node_modules/react-i18next"),
+ },
+ nodePaths: [join(root, "apps/desktop/node_modules")],
+ });
+ await writeFile(join(temp, "index.html"), '<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src \'self\'; style-src \'self\' \'unsafe-inline\'"><div id="root"></div><script type="module" src="renderer.js"></script>');
+ await writeFile(join(temp, "main.cjs"), `
+const { app, BrowserWindow } = require("electron");
+const path = require("node:path");
+app.setPath("userData", path.join(__dirname, "profile"));
+app.whenReady().then(async () => {
+ const win = new BrowserWindow({ show: false, webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false, backgroundThrottling: false } });
+ win.webContents.on("console-message", (event) => console.error(event.message));
+ try {
+ await win.loadFile(path.join(__dirname, "index.html"));
+ const result = await win.webContents.executeJavaScript("window.mcpMarketOwnerProbe()");
+ console.log("MCP_MARKET_OWNER " + JSON.stringify(result));
+ app.exit(0);
+ } catch (error) { console.error(error?.stack ?? error); app.exit(1); }
+});
+`);
+ const env = { ...process.env };
+ delete env.ELECTRON_RUN_AS_NODE;
+ const child = spawn(resolveElectronBinary(root).electronBinary, [join(temp, "main.cjs")], {
+ env, stdio: ["ignore", "pipe", "pipe"],
+ });
+ let output = "";
+ for (const stream of [child.stdout, child.stderr]) stream.on("data", (chunk) => { output += chunk; });
+ const timer = setTimeout(() => child.kill("SIGKILL"), 30_000);
+ let code;
+ try {
+ code = await new Promise((resolve, reject) => {
+ child.once("error", reject);
+ child.once("close", resolve);
+ });
+ } finally { clearTimeout(timer); }
+ assert.equal(code, 0, output);
+ const line = output.split(/\r?\n/).find((line) => line.startsWith("MCP_MARKET_OWNER "));
+ assert(line, output);
+ const result = JSON.parse(line.slice("MCP_MARKET_OWNER ".length));
+ assert.equal(result.results.length, 6);
+ assert.equal(result.missingProjectBlocked, true);
+ } finally { await rm(temp, { recursive: true, force: true }); }
+});
diff --git a/apps/desktop/test/mcp-market-panel.test.mjs b/apps/desktop/test/mcp-market-panel.test.mjs
index 50d966b01..59d13fbec 100644
--- a/apps/desktop/test/mcp-market-panel.test.mjs
+++ b/apps/desktop/test/mcp-market-panel.test.mjs
@@ -15,8 +15,6 @@ const [panel, page, en, zh] = await Promise.all([
test("market panel installs through the existing upsert path only", () => {
assert.match(panel, /resolveCatalogEntry\(/);
assert.match(panel, /api\.upsertMcpServer\(/);
- assert.match(panel, /level: "global"/);
- assert.match(panel, /scope: GLOBAL_SCOPE/);
// No other write path may appear.
assert.doesNotMatch(panel, /mcpImport|writeFile|host\.call\(/);
});
@@ -56,7 +54,6 @@ test("a failed query keeps the last successful list with its timestamp", () => {
test("installed state comes from matching server ids", () => {
assert.match(panel, /installedIds\.includes\(entry\.id\)/);
- assert.match(page, /installedIds=\{\[\.\.\.globalServers, \.\.\.projectServers\]/);
});
test("agents page wires the market view with reload on exit", () => {
diff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.md
index 8ab811897..76394c01b 100644
--- a/docs/spec/04-ux/06-settings-ia.md
+++ b/docs/spec/04-ux/06-settings-ia.md
@@ -758,7 +758,12 @@ system while preserving their different data ownership:
opens inline on the MCP page. Imported servers follow the current Global /
Project filter and selected project; secrets and header values are never
shown in candidate rows.
-- MCP Market offers Retry after a failed query or partial source failure. It
+- MCP Market installs into the same destination as Add: Global under All or
+ Global, and the selected project under Project. Its installed badges reflect
+ only that destination, so an entry in another level can still be installed
+ here. Project installation requires a selected project and never falls back
+ to Global.
+ MCP Market offers Retry after a failed query or partial source failure. It
repeats the current search through the existing market request path and
announces loading while the request runs. After a successful load, a later
failure keeps that list on screen with the time it was taken and still
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index f3e3e63b8..636f63e6d 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -17135,11 +17135,31 @@ plugin-form fixtures in an isolated temporary directory at runtime.
| E2E-MCP-MARKET-NET-BOUNDARY | The URL guard rejects credentials, cloud metadata, unspecified, multicast and reserved forms (trailing dot included) even when the user typed them, and rejects loopback, private, special-use IPv4, v4-mapped, ULA, site-local and link-local forms for *third-party* hops — a redirect target or a catalog body; the same forms typed by the user into a source field are accepted, with plain `http` behind `networkPolicy.allowInsecureUserEndpoints`; direct/unknown routes pin the checked address by default, while a fully proxied route uses the session transport and an explicit `allowFakeIp` opt-in can cover transparent-router fake-IP sources without allowing real private answers | deterministic guard assertions; source-contract coverage for DNS pin, proxy route selection, explicit fake-IP scope and bounded responses |
| E2E-MCP-MARKET-SEMANTICS | Registry records map to install templates preserving package versions, named/positional runtime/package arguments and required/optional env variables; a remote header variable is recognized in both the registry's `{name}` and the catalog's `${NAME}` spelling, prompts for declared editable values, preserves unbound brace literals, and resolves header-local defaults, fixed values, and optional flags without merging same-named inputs across headers (ADR registry-header-variable-spelling) | deterministic mapping assertions |
| E2E-MCP-MARKET-INSTALL | Builtin catalog entry resolves through `resolveCatalogEntry` and installs via the host `mcp.upsert` RPC; record lands in `~/.agents/servers/` | real host binary, isolated temp HOME |
+| E2E-MCP-MARKET-explicit-project-owner | Select Project on the MCP page, open Market, and install a builtin entry; the upsert carries the selected project and the saved row appears in that project. All and Global retain global installation, and an entry in another level does not block installation | real React page and market in isolated Electron; IPC boundary fixture (`apps/desktop/test/mcp-market-owner-user-path.test.mjs`) |
| E2E-MCP-MARKET-HEADER-SCOPE | Registry header-local `{token}` resolves only in its header; same-named URL path/query tokens remain literal through mapping, resolution, host upsert/list and persistence. URL templates retain only legacy `${NAME}` substitution. When `headerBindings` exists (even empty or partial), unbound tokens in every header stay literal and never consume another header's input or default | shared regressions plus real host binary with isolated temporary storage; remote entry disabled, no network call |
| E2E-MCP-MARKET-partial-header-bindings-stay-literal | Resolve a catalog with only Authorization bound and another header using the same `{token}` / `${token}`; an undeclared `${UNBOUND}` in a third header also remains literal through host upsert/list and disk persistence | real host binary, disabled remote entry, synthetic input and isolated temporary storage; no network call |
| E2E-MARKET-CATALOG-RETRY | In Skill Market and MCP Market, a failed query and then a partial source failure expose Retry; clicking it announces loading, refreshes the same query, and clears the failure when the source recovers | real React components in Electron with deterministic mocked market API responses; no live network |
+#### E2E-MCP-MARKET-explicit-project-owner: Market installation respects an explicit Project filter
+
+- **Preconditions**: MCP settings with a selected project; isolated Electron
+ profile and deterministic IPC responses, without live market or MCP calls.
+- **Steps**: Select Project, open Market, install a builtin entry, and reopen
+ Market. Repeat with All and Global, with no project under All, and with the
+ same entry already present in the other level. Select Project with no
+ project, then try an install directly through the panel's public interface.
+- **Expected**: Project sends `level: "project"` and the selected `projectPath`;
+ All and Global send `level: "global"` without a project owner. The installed
+ row appears on return, and reopening Market marks it installed only for the
+ target level. A record in another level never blocks installation. With no
+ project selected, the Project market action is disabled and the panel guard
+ reports the missing selection without writing.
+- **Specs linked**: `04-ux/06-settings-ia.md`, ADR 0112.
+- **Acceptance**: Quality.
+- **Milestone**: M6+.
+- **Status**: Automated (`node --test apps/desktop/test/mcp-market-owner-user-path.test.mjs`).
+
#### E2E-SKILL-MARKET-NET-BOUNDARY: A user-supplied source reaches the LAN, third-party content does not
- **Preconditions**: Shared public-network helpers and the main-process
diff --git a/docs/zh-CN/spec/04-ux/06-settings-ia.md b/docs/zh-CN/spec/04-ux/06-settings-ia.md
index c28fbe500..c2db6b7f7 100644
--- a/docs/zh-CN/spec/04-ux/06-settings-ia.md
+++ b/docs/zh-CN/spec/04-ux/06-settings-ia.md
@@ -456,7 +456,7 @@ Token 用量**不是设置目的地**(D335 / ADR 0173)。已完成回合历
默认、不可用、回退或无实际 Shell 文案,并且从不授权过时的 ID/dialect
21. 信息页提供「问题反馈」,打开已预填版本和操作系统的 GitHub bug 表单;设置搜索可索引该行
22. 技能页的市场视图浏览公网 HTTPS 目录、预览组装后的文档,并只通过 `skills.create` 安装;超限展开文档拒绝写入,来源角标跟随 `sourceId`;预览失败时面板给出可读原因与重试入口(安装按钮可以禁用,但不得无解释地禁用);来源被公网策略守卫拒绝时明确说明,而不是笼统报「不可达」。目录查询全部失败或仅部分来源失败时都提供重试按钮;点击后按当前搜索和已配置来源重查,并在请求期间播报加载状态。成功加载过后再遇失败时,列表保留上次成功加载的结果并标注时间,重试入口不变;该列表不回答其他搜索词,重试成功后即消失
-23. MCP 市场查询全部失败或部分来源失败时提供重试按钮;点击后重跑当前搜索,并在请求期间播报加载状态。成功加载过后再遇失败时,列表保留上次成功加载的结果并标注时间,重试入口不变
+23. MCP 市场安装遵循添加按钮的目标:All 和 Global 保存到全局,Project 保存到所选项目。已安装标记只检查目标层级,其他层级中的同名条目不阻止安装。未选择项目时禁止项目安装,不回退到全局。查询全部失败或部分来源失败时提供重试按钮;点击后重跑当前搜索,并在请求期间播报加载状态。成功加载过后再遇失败时,列表保留上次成功加载的结果并标注时间,重试入口不变
## 5. Chrome 指标常规
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 76d37dd6c..666bb68e1 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -8844,11 +8844,22 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture
| E2E-MCP-MARKET-NET-BOUNDARY | URL guard 拒绝凭据、云元数据、unspecified、multicast、reserved 及尾点绕过形态——即使由用户自己填写;对**第三方跳**(重定向目标、目录正文)拒绝回环、私网、special-use IPv4、v4-mapped、ULA、site-local 与 link-local;同一形态由用户填进源地址字段时被接受,明文 `http` 需 `networkPolicy.allowInsecureUserEndpoints`;direct/unknown 默认固定已检查的地址,完整 proxied 线路使用 session 传输,显式 `allowFakeIp` 可覆盖透明路由器 fake-IP 源但不允许真实私网答案 | 确定性 guard 断言;DNS pin、代理线路选择、fake-IP 选项范围与响应上限 source-contract 覆盖 |
| E2E-MCP-MARKET-SEMANTICS | Registry 记录映射为安装模板时保留包版本、named/positional runtime/package 参数与 required/optional 环境变量语义;远端 header 变量同时识别注册表的 `{name}` 与目录的 `${NAME}` 两种写法,仅为已声明的可编辑值显示输入,保留未声明花括号字面量,并按各 header 的作用域处理默认值、固定值与可选标记,不合并不同 header 的同名输入(ADR registry-header-variable-spelling) | 确定性映射断言 |
| E2E-MCP-MARKET-INSTALL | 内置目录条目经 `resolveCatalogEntry` 解析并通过宿主 `mcp.upsert` RPC 安装;记录落盘 `~/.agents/servers/` | 真实宿主二进制,隔离临时 HOME |
+| E2E-MCP-MARKET-explicit-project-owner | 在 MCP 页选择 Project,打开市场并安装内置条目;请求携带所选项目,返回后显示项目记录。All 和 Global 保持全局安装,其他层级中的同名条目不阻止安装 | 隔离 Electron 中的真实 React 页面和市场;IPC 边界模拟(`apps/desktop/test/mcp-market-owner-user-path.test.mjs`) |
| E2E-MCP-MARKET-HEADER-SCOPE | Registry header-local `{token}` resolves only in its header; same-named URL path/query tokens remain literal through mapping, resolution, host upsert/list and persistence. URL templates retain only legacy `${NAME}` substitution. When `headerBindings` exists (even empty or partial), unbound tokens in every header stay literal and never consume another header's input or default | shared regressions plus real host binary with isolated temporary storage; remote entry disabled, no network call |
| E2E-MCP-MARKET-partial-header-bindings-stay-literal | Resolve a catalog with only Authorization bound and another header using the same `{token}` / `${token}`; an undeclared `${UNBOUND}` in a third header also remains literal through host upsert/list and disk persistence | real host binary, disabled remote entry, synthetic input and isolated temporary storage; no network call |
| E2E-MARKET-CATALOG-RETRY | 技能市场和 MCP 市场查询全部失败后、以及部分来源失败时都显示重试;点击后播报加载、重跑当前查询,并在来源恢复后清除失败状态 | Electron 中的真实 React 组件使用确定性的模拟市场 API 响应;不访问公网 |
+#### E2E-MCP-MARKET-explicit-project-owner:市场安装遵循明确选择的 Project 筛选
+
+- **前提条件**:MCP 设置已选择项目;使用隔离 Electron 配置和确定性 IPC 响应,不访问真实市场或调用 MCP。
+- **步骤**:选择 Project,打开市场,安装内置条目后重新打开市场。分别验证 All、Global、All 下未选择项目,以及另一层级已存在同名条目的情况。未选择项目时选择 Project,再通过面板公开接口尝试安装。
+- **预期**:Project 请求携带 `level: "project"` 和所选 `projectPath`;All、Global 请求携带 `level: "global"`,不传项目归属。返回后显示已安装记录,重新打开市场时仅按目标层级标记已安装。其他层级中的记录不阻止安装。未选择项目时,Project 市场入口禁用,面板保护逻辑提示缺少项目且不写入。
+- **关联规格**:`04-ux/06-settings-ia.md`、ADR 0112。
+- **验收**:质量。
+- **里程碑**:M6+。
+- **状态**:已自动化(`node --test apps/desktop/test/mcp-market-owner-user-path.test.mjs`)。
+
#### E2E-SKILL-MARKET-NET-BOUNDARY:用户自填源可达局域网,第三方内容不行
- **前提条件**:共享 public-network helper,以及可注入 fetch/DNS/线路 的主进程公网 HTTPS 客户端。
diff --git a/scripts/e2e/market-retry.tsx b/scripts/e2e/market-retry.tsx
index 9b708c3fe..3836a0ae7 100644
--- a/scripts/e2e/market-retry.tsx
+++ b/scripts/e2e/market-retry.tsx
@@ -90,7 +90,7 @@ function mount(panel: "skill" | "mcp") {
{panel === "skill" ? (
<SkillMarketPanel installedIds={[]} onBack={() => {}} onInstalled={() => {}} />
) : (
- <McpMarketPanel installedIds={[]} onBack={() => {}} onInstalled={() => {}} />
+ <McpMarketPanel level="global" installedIds={[]} onBack={() => {}} onInstalled={() => {}} />
)}
</I18nextProvider>,
),