Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): give each desktop channel its own MCP entry (#5249)

tim-inkeep15a13bad44cd
diff --git a/.changeset/beta-own-mcp-entry.md b/.changeset/beta-own-mcp-entry.md
new file mode 100644
index 000000000..5c3ceb526
--- /dev/null
+++ b/.changeset/beta-own-mcp-entry.md
@@ -0,0 +1,6 @@
+---
+"@inkeep/open-knowledge": patch
+"@inkeep/open-knowledge-desktop": patch
+---
+
+OpenKnowledge Beta now registers its own `open-knowledge-beta` MCP server and no longer overwrites Stable's `open-knowledge` entry. In the `OpenKnowledge Beta` app, [reconnect your editors](https://openknowledge.ai/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry), approve the Beta tools once, and remove the old `open-knowledge` entry if you don't run Stable. Older Beta installs still named `OpenKnowledge` keep `open-knowledge`.
diff --git a/docs/content/integrations/antigravity.mdx b/docs/content/integrations/antigravity.mdx
index f0dfbf62a..ee1e15d67 100644
--- a/docs/content/integrations/antigravity.mdx
+++ b/docs/content/integrations/antigravity.mdx
@@ -75,4 +75,6 @@ For the complete tool surface, see the [MCP reference](/docs/reference/mcp).
| `write` / `edit` -> "Hocuspocus server is not running" | OK server not started | Run `ok start` (or leave the desktop app running) and retry |
| Preview "doesn't open" | used the route-only `/#/…` path in a browser | Call `preview_url` for the full URL |
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
New to OpenKnowledge itself? Start with the [quickstart](/docs/get-started/quickstart) for `ok init` and `ok start`.
diff --git a/docs/content/integrations/claude-code.mdx b/docs/content/integrations/claude-code.mdx
index fc33c9c6b..9bad2992b 100644
--- a/docs/content/integrations/claude-code.mdx
+++ b/docs/content/integrations/claude-code.mdx
@@ -29,6 +29,8 @@ Open the project in Claude Code and ask:
If Claude Code doesn't use the OpenKnowledge `exec` tool, restart it so it picks up the new MCP entry. If it's still missing and `ok init` reported your config was `left unchanged`, OpenKnowledge couldn't edit `~/.claude.json` safely and left it untouched — the summary names the reason in parentheses; fix the config and re-run `ok init`.
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
## Live editing
When Claude Code writes to a doc, you'll see the change land live in OpenKnowledge. Just ask Claude Code to open it for you.
diff --git a/docs/content/integrations/codex.mdx b/docs/content/integrations/codex.mdx
index 63ff1d4bb..b3afa3c75 100644
--- a/docs/content/integrations/codex.mdx
+++ b/docs/content/integrations/codex.mdx
@@ -41,6 +41,8 @@ Open the project in Codex and ask:
If you don't see the tool, check that the project is trusted first, then restart Codex. If it's still missing and `ok init` reported your config was `left unchanged`, the reason in parentheses says why `~/.codex/config.toml` (or `$CODEX_HOME/config.toml` if set) was left untouched. For config problems, fix the file and re-run `ok init`; for `no format-preserving writer available`, your config isn't the problem — OpenKnowledge can't rewrite the file safely on this platform, so add an `open-knowledge` entry to `mcp_servers` by hand (command: `ok mcp`).
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
## Scheduled runs
The ChatGPT desktop app runs Codex on a schedule from its **Scheduled** view. Tasks run unattended under your default sandbox, against your local project or an isolated background worktree, and the app must be running for tasks that need local files. See OpenAI's [scheduled tasks](https://learn.chatgpt.com/docs/automations) docs. Codex CLI has no scheduler of its own; use [`codex exec`](https://learn.chatgpt.com/docs/non-interactive-mode) from OS cron instead. Described as of August 2026, while the ChatGPT and Codex surfaces are still changing quickly.
diff --git a/docs/content/integrations/cursor.mdx b/docs/content/integrations/cursor.mdx
index 1033d057e..cfa3f73a9 100644
--- a/docs/content/integrations/cursor.mdx
+++ b/docs/content/integrations/cursor.mdx
@@ -16,6 +16,8 @@ Cursor lists a project-level `.cursor/mcp.json` server as **Disabled** until you
If you registered OpenKnowledge project-level only, or want the project entry active: open **Customize → MCPs**, pick `open-knowledge`, and switch on its `.cursor/mcp.json` source.
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
Described as of September 2026 (Cursor 3.19); Cursor renames this settings area often.
## Open with AI
diff --git a/docs/content/integrations/github-copilot-cli.mdx b/docs/content/integrations/github-copilot-cli.mdx
index 2deba3376..6537542f0 100644
--- a/docs/content/integrations/github-copilot-cli.mdx
+++ b/docs/content/integrations/github-copilot-cli.mdx
@@ -16,6 +16,8 @@ If the Copilot config directory does not exist yet, launch Copilot CLI once and
It also installs the project skill at `.github/skills/open-knowledge/SKILL.md` so Copilot can follow the project's OpenKnowledge workflow.
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
## Folder trust
The machine-wide entry `ok init` writes to `~/.copilot/mcp-config.json`, or to `$COPILOT_HOME/mcp-config.json` when `COPILOT_HOME` is set, is not affected by folder trust.
diff --git a/docs/content/integrations/hermes.mdx b/docs/content/integrations/hermes.mdx
index d5ef83daf..77352c4b5 100644
--- a/docs/content/integrations/hermes.mdx
+++ b/docs/content/integrations/hermes.mdx
@@ -16,6 +16,8 @@ After `ok init` writes the config, restart Hermes (or run `/reload-mcp` in-sessi
`ok init` writes the OpenKnowledge server into `~/.hermes/config.yaml` under `mcp_servers`, using the same resilient launcher every other editor gets — it finds `ok` whether you installed the desktop app or the npm CLI, so there's no PATH to configure. Hermes keeps its whole config (models, tool filters, other MCP servers) in that one YAML file, so OK edits only its own `open-knowledge` entry and leaves the rest — your comments included — in place.
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
<Callout type="info">
Hermes is detected by the presence of `~/.hermes/`. If `ok init` shows Hermes as `config root
missing; skipped`, launch Hermes once so it creates its home directory, then re-run `ok init`.
diff --git a/docs/content/integrations/lm-studio.mdx b/docs/content/integrations/lm-studio.mdx
index fe6f77ddc..a93a1fabd 100644
--- a/docs/content/integrations/lm-studio.mdx
+++ b/docs/content/integrations/lm-studio.mdx
@@ -12,6 +12,8 @@ icon: LuCpu
After `ok init` writes the config, open LM Studio's **Program** tab and enable the `open-knowledge` server (LM Studio spawns a process per MCP server on save). The model you chat with must support tool use — see [Pick a tool-capable model](#pick-a-tool-capable-model).
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
`ok init` writes the OpenKnowledge server into LM Studio's `mcp.json`, using the same resilient launcher every other editor gets — it finds `ok` whether you installed the desktop app or the npm CLI, so there's no PATH to configure. LM Studio follows Cursor's `mcp.json` notation, so the entry lands under a top-level `mcpServers` map.
<Callout type="info">
diff --git a/docs/content/integrations/openclaw.mdx b/docs/content/integrations/openclaw.mdx
index 4e920c48a..a20aef24d 100644
--- a/docs/content/integrations/openclaw.mdx
+++ b/docs/content/integrations/openclaw.mdx
@@ -147,4 +147,6 @@ For the complete tool surface, see the [MCP reference](/docs/reference/mcp).
| `write` / `edit` -> "Hocuspocus server is not running" | OK server not started | Run `ok start` (or leave the desktop app running) and retry |
| Preview "doesn't open" | used the route-only `/#/…` path in a browser | Call `preview_url` for the full URL |
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
New to OpenKnowledge itself? Start with the [quickstart](/docs/get-started/quickstart) for `ok init` and `ok start`.
diff --git a/docs/content/integrations/opencode.mdx b/docs/content/integrations/opencode.mdx
index ae4606473..87fa9368c 100644
--- a/docs/content/integrations/opencode.mdx
+++ b/docs/content/integrations/opencode.mdx
@@ -12,6 +12,8 @@ icon: custom/OpenCode
OpenCode reads MCP servers from `opencode.json` in the project root, or `~/.config/opencode/opencode.json` for a global install. `ok init` writes the `open-knowledge` server under the top-level `mcp` key in both, using the same resilient launcher every other editor gets. It also installs the OpenKnowledge skill to `.opencode/skills/open-knowledge/`, which OpenCode scans automatically.
+OpenKnowledge Beta registers as `open-knowledge-beta` instead; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
## Use a local model
OpenCode is model-agnostic and talks to any OpenAI-compatible endpoint, so you can pair OpenKnowledge with a model running entirely on your machine — no cloud round-trip. Point OpenCode at [Ollama](https://ollama.com), [LM Studio](https://lmstudio.ai), or a self-hosted server in the same `opencode.json` that holds the OpenKnowledge MCP entry:
diff --git a/docs/content/integrations/pi.mdx b/docs/content/integrations/pi.mdx
index 16781f639..96cd335f1 100644
--- a/docs/content/integrations/pi.mdx
+++ b/docs/content/integrations/pi.mdx
@@ -13,6 +13,8 @@ Run `ok init` in your project (or open the project in the OpenKnowledge desktop
- **`.pi/extensions/open-knowledge.ts`** — the bridge extension. On session start it launches OpenKnowledge's MCP server with the same resilient launcher every other editor uses, then registers each OpenKnowledge tool as a native Pi tool under an `ok_` prefix (`ok_exec`, `ok_search`, `ok_write`, …). The prefix keeps OpenKnowledge's `edit` / `write` from shadowing Pi's built-in file tools.
- **`.pi/skills/open-knowledge/`** — the OpenKnowledge skill, in the [Agent Skills](https://pi.dev/docs/latest) format Pi reads natively from `.pi/skills/`.
+OpenKnowledge Beta writes `.pi/extensions/open-knowledge-beta.ts` instead and registers its tools as `ok-beta_*`; see [Beta uses its own entry](/docs/reference/what-open-knowledge-writes#beta-uses-its-own-entry).
+
These files are managed by OpenKnowledge. Running `ok init` again refreshes them in place, while `ok deinit` removes them.
## Trust the project
@@ -25,6 +27,6 @@ Run `pi` in the project, and ask:
<CopyPrompt>List the first 5 documents you come across in this project.</CopyPrompt>
-Pi should call the OpenKnowledge `ok_exec` tool and respond with some of your documents.
+Pi should call the OpenKnowledge `ok_exec` tool (`ok-beta_exec` in OpenKnowledge Beta) and respond with some of your documents.
-If the `ok_` tools are missing: make sure you trusted the folder, then `/reload` (or restart `pi`). The first tool call can take a moment on a fresh machine — the launcher may be installing the OpenKnowledge CLI via `npx`. If Pi shows an "Open Knowledge tools unavailable" notice, install [Node.js 24+](https://nodejs.org) or the OpenKnowledge desktop app and reload.
+If the `ok_` tools (`ok-beta_` in Beta) are missing: make sure you trusted the folder, then `/reload` (or restart `pi`). The first tool call can take a moment on a fresh machine — the launcher may be installing the OpenKnowledge CLI via `npx`. If Pi shows an "Open Knowledge tools unavailable" notice, install [Node.js 24+](https://nodejs.org) or the OpenKnowledge desktop app and reload.
diff --git a/docs/content/reference/what-open-knowledge-writes.mdx b/docs/content/reference/what-open-knowledge-writes.mdx
index c3a6c5fd6..143c713a4 100644
--- a/docs/content/reference/what-open-knowledge-writes.mdx
+++ b/docs/content/reference/what-open-knowledge-writes.mdx
@@ -98,6 +98,14 @@ Both are **consent-gated**, but at different moments. Declining `open-knowledge-
When you initialize or open a project, the app scaffolds the same project files the CLI's `ok init` creates, and registers the `open-knowledge` MCP server with the AI editors it detects. The MCP registration is **surgical** — it touches only its own entry and leaves your other settings, comments, and formatting byte-for-byte intact. "Its own entry" means the one named `open-knowledge`; if that name is already taken by something OpenKnowledge does not recognize, see [Opt-outs in one place](#opt-outs-in-one-place).
+#### Beta uses its own entry
+
+Each product registers under its own name, so Stable and Beta can both be connected to the same editor without overwriting each other. Stable uses `open-knowledge`; Beta uses `open-knowledge-beta`, with its own launcher that runs OpenKnowledge Beta and falls back to `npx @inkeep/open-knowledge@beta`. Everywhere this page names the `open-knowledge` entry, Beta's app, repair sweeps, and `ok-beta init` act only on `open-knowledge-beta`, and Beta's Pi bridge is `.pi/extensions/open-knowledge-beta.ts`. Agents see Beta's tools as `mcp__open-knowledge-beta__*`, and Pi sees them as `ok-beta_*`.
+
+Earlier releases of the separately installed `OpenKnowledge Beta` app registered under `open-knowledge`, and updating does not move that entry. If an editor's config has no `open-knowledge-beta` entry, reconnect that editor from **Settings → Agent connections** in OpenKnowledge Beta, then remove the old `open-knowledge` entry from the file listed under [`ok init`](#ok-init) if you don't also run Stable. An older Beta install still named `OpenKnowledge` keeps using `open-knowledge`; leave that entry in place.
+
+A CLI process decides which product it belongs to in this order: the `OK_CHANNEL` environment variable (`stable` or `beta`; any other value is an error), then the name of the executable it runs as, and otherwise Stable. The CLI bundled in OpenKnowledge Beta resolves as Beta from its executable name, and Beta's launcher sets `OK_CHANNEL=beta` before it falls back to npx. A CLI run under plain Node, such as `npx @inkeep/open-knowledge@beta init` typed by hand, resolves as Stable and writes the `open-knowledge` entry unless you set `OK_CHANNEL=beta`.
+
| Path | What it is | Scope |
| --- | --- | --- |
| `.ok/`, `.ok/config.yml` | Project directory and its [config](./configuration.mdx) | In-project, committed |
diff --git a/packages/app/src/components/ProjectAiToolsField.tsx b/packages/app/src/components/ProjectAiToolsField.tsx
index 408cb9025..8250a32ba 100644
--- a/packages/app/src/components/ProjectAiToolsField.tsx
+++ b/packages/app/src/components/ProjectAiToolsField.tsx
@@ -1,9 +1,9 @@
import {
EDITOR_LABELS,
- EDITOR_PROJECT_CONFIG_PATH,
EDITOR_PROJECT_SKILL_ROOT,
type EditorId,
RESERVED_PROJECT_SKILL_NAME,
+ STABLE_EDITOR_PROJECT_CONFIG_PATH,
} from '@inkeep/open-knowledge-core';
import { i18n } from '@lingui/core';
import { Trans, useLingui } from '@lingui/react/macro';
@@ -111,7 +111,7 @@ export function ProjectAiToolsField({
{}
<ul className="flex flex-col gap-2" data-testid={`${testIdPrefix}-details`}>
{status.editors.map((id) => {
- const configPath = EDITOR_PROJECT_CONFIG_PATH[id];
+ const configPath = STABLE_EDITOR_PROJECT_CONFIG_PATH[id];
const skillRoot = EDITOR_PROJECT_SKILL_ROOT[id];
return (
<li
diff --git a/packages/app/src/components/TerminalPanel.launch.dom.test.tsx b/packages/app/src/components/TerminalPanel.launch.dom.test.tsx
index be7232418..b1f3f4e6c 100644
--- a/packages/app/src/components/TerminalPanel.launch.dom.test.tsx
+++ b/packages/app/src/components/TerminalPanel.launch.dom.test.tsx
@@ -81,6 +81,7 @@ const WIRED: ClaudeReadiness = {
claude: 'present',
mcpPreApprovable: true,
okToolsAutoApprovable: true,
+ mcpServerName: 'open-knowledge',
};
const WIRED_FOREIGN_PROJECT: ClaudeReadiness = {
claude: 'present',
@@ -91,9 +92,14 @@ const WIRED_GLOBAL_ONLY: ClaudeReadiness = {
claude: 'present',
mcpPreApprovable: false,
okToolsAutoApprovable: true,
+ mcpServerName: 'open-knowledge',
};
const ON_PATH: CliReadiness = { onPath: 'present' };
-const CODEX_OK_CONFIGURED: CliReadiness = { onPath: 'present', okServerConfigured: true };
+const CODEX_OK_CONFIGURED: CliReadiness = {
+ onPath: 'present',
+ okServerConfigured: true,
+ mcpServerName: 'open-knowledge',
+};
function makeBridge(
preflight: ClaudeReadiness = WIRED,
@@ -607,6 +613,28 @@ describe('TerminalPanel "Open in terminal" launch (baked into the PTY spawn)', (
);
});
+ test('codex auto-approves only the server name main checked, and nothing without one', async () => {
+ const beta = makeBridge(WIRED, {
+ ...CODEX_OK_CONFIGURED,
+ mcpServerName: 'open-knowledge-beta',
+ });
+ render(
+ <TerminalPanel bridge={beta.bridge} launch={{ prompt: 'hi', cli: 'codex', nonce: 1 }} />,
+ );
+ await waitFor(() => expect(beta.terminal.create).toHaveBeenCalledTimes(1));
+ expect(bakedLaunch(beta.terminal.create)).toBe(
+ `codex -c 'mcp_servers.open-knowledge-beta.default_tools_approval_mode="approve"' 'hi'`,
+ );
+ cleanup();
+
+ const unnamed = makeBridge(WIRED, { onPath: 'present', okServerConfigured: true });
+ render(
+ <TerminalPanel bridge={unnamed.bridge} launch={{ prompt: 'hi', cli: 'codex', nonce: 1 }} />,
+ );
+ await waitFor(() => expect(unnamed.terminal.create).toHaveBeenCalledTimes(1));
+ expect(bakedLaunch(unnamed.terminal.create)).toBe("codex 'hi'");
+ });
+
test('codex stays BARE (no -c) when OK is not configured in codex — the launch never breaks', async () => {
const { bridge, terminal } = makeBridge(WIRED, {
onPath: 'present',
@@ -752,11 +780,13 @@ describe('the two --settings halves are gated independently, across all four MCP
claude: 'present',
mcpPreApprovable: true,
okToolsAutoApprovable: true,
+ mcpServerName: 'open-knowledge',
};
const BOTH_SCOPES: ClaudeReadiness = {
claude: 'present',
mcpPreApprovable: true,
okToolsAutoApprovable: true,
+ mcpServerName: 'open-knowledge',
};
const NEITHER_SCOPE: ClaudeReadiness = {
claude: 'present',
@@ -809,6 +839,19 @@ describe('the two --settings halves are gated independently, across all four MCP
expect(baked).not.toContain('--settings');
});
+ test('names only the server main checked: a Beta verdict never approves open-knowledge', async () => {
+ const baked = await bakeClaudeLaunch({ ...BOTH_SCOPES, mcpServerName: 'open-knowledge-beta' });
+ expect(baked).toContain('"enabledMcpjsonServers":["open-knowledge-beta"]');
+ expect(baked).toContain('"mcp__open-knowledge-beta__delete"');
+ expect(baked?.replaceAll('open-knowledge-beta', '')).not.toContain('open-knowledge');
+ });
+
+ test('a verdict that carries no server name bakes a bare launch, never a guessed name', async () => {
+ const { mcpServerName: _omitted, ...unnamed } = BOTH_SCOPES;
+ const baked = await bakeClaudeLaunch(unnamed);
+ expect(baked).toBe("claude 'hi'");
+ });
+
test('toggle OFF on a global-only install: neither half, so the launch is bare', async () => {
const { bridge, terminal } = makeBridge(WIRED_GLOBAL_ONLY);
renderWithAutoApproveOff(
diff --git a/packages/app/src/components/TerminalPanel.tsx b/packages/app/src/components/TerminalPanel.tsx
index 908bfde9c..e003ce150 100644
--- a/packages/app/src/components/TerminalPanel.tsx
+++ b/packages/app/src/components/TerminalPanel.tsx
@@ -622,6 +622,7 @@ function TerminalSession({
if (!cancelled) setConnectionCli('claude');
return buildLaunch({
mcpPreApprove: fresh.mcpPreApprovable === true,
+ mcpServerName: fresh.mcpServerName,
autoApproveOkTools:
autoApproveOkToolsRef.current && fresh.okToolsAutoApprovable === true,
});
@@ -652,6 +653,7 @@ function TerminalSession({
intent.cli === 'codex' &&
res.okServerConfigured === true &&
autoApproveOkToolsRef.current,
+ mcpServerName: res.mcpServerName,
});
}
if (!cancelled) {
diff --git a/packages/app/src/components/settings/AgentConnectionDialogs.dom.test.tsx b/packages/app/src/components/settings/AgentConnectionDialogs.dom.test.tsx
index f64f91052..4f9208d6e 100644
--- a/packages/app/src/components/settings/AgentConnectionDialogs.dom.test.tsx
+++ b/packages/app/src/components/settings/AgentConnectionDialogs.dom.test.tsx
@@ -12,7 +12,7 @@ import * as actualLinguiMacro from '@lingui/react/macro';
import { cleanup, render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { type ReactNode, useState } from 'react';
-import { afterEach, describe, expect, test, vi } from 'vitest';
+import { afterEach, describe, expect, onTestFinished, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
import type { ApplyAgentConnectionsResult } from '@/lib/agent-connections';
import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
@@ -679,6 +679,24 @@ describe('AgentConnectionDialogs', () => {
expect(dialog.querySelector(`#${describedBy}`)?.textContent).toMatch(/replaces it/i);
});
+ test('a replaceable entry names the server key this channel writes', async () => {
+ vi.stubGlobal('okDesktop', { mcpServerName: 'open-knowledge-beta' });
+ onTestFinished(() => {
+ vi.unstubAllGlobals();
+ });
+ const mcp = satisfierId('cursor', 'mcp', 'project');
+ const snapshot = withSurfaceStates(snapshotWith(), { [mcp]: 'foreign-replaceable' });
+ const user = userEvent.setup();
+ await renderConfigureDialog(async () => result(snapshot), 'cursor');
+
+ const dialog = await screen.findByRole('dialog', { name: 'Cursor' });
+ await user.hover(within(dialog).getByRole('button', { name: 'Why this needs attention' }));
+ const tooltip = await screen.findAllByRole('tooltip');
+ expect(tooltip[0].textContent).toContain(
+ 'Replaces the existing open-knowledge-beta entry in this file. Other servers in the file are left alone.',
+ );
+ });
+
test('the remove dialog prints a path, never the internal pathId key', async () => {
const snapshot = snapshotWith(diskSatisfierIds('claude'));
await renderRemoveDialog(async () => result(snapshot), 'claude');
diff --git a/packages/app/src/components/settings/AgentConnectionDialogs.tsx b/packages/app/src/components/settings/AgentConnectionDialogs.tsx
index 9de8981e0..5b559f7e0 100644
--- a/packages/app/src/components/settings/AgentConnectionDialogs.tsx
+++ b/packages/app/src/components/settings/AgentConnectionDialogs.tsx
@@ -51,7 +51,7 @@ import { Label } from '@/components/ui/label';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { connectionPathDisplay, sharedPathDisplays } from '@/lib/agent-connection-paths';
import type { ApplyAgentConnectionsResult } from '@/lib/agent-connections';
-import { guidanceText, troubleshootingText } from '@/lib/agent-guidance-copy';
+import { guidanceText, mcpServerLabel, troubleshootingText } from '@/lib/agent-guidance-copy';
import { formatToolList } from '@/lib/tool-list-format';
import { groupHeadingFor } from './group-heading';
@@ -437,9 +437,10 @@ function PartControl({
: blockedReasons[reason];
}
+ const server = mcpServerLabel();
const foreignInfo =
cell.state === 'foreign-replaceable'
- ? t`Replaces the existing "open-knowledge" entry in this file. Other servers in the file are left alone.`
+ ? t`Replaces the existing ${server} entry in this file. Other servers in the file are left alone.`
: null;
const alsoAffects =
diff --git a/packages/app/src/lib/agent-connection-paths.ts b/packages/app/src/lib/agent-connection-paths.ts
index 3fe630590..df345987d 100644
--- a/packages/app/src/lib/agent-connection-paths.ts
+++ b/packages/app/src/lib/agent-connection-paths.ts
@@ -1,10 +1,10 @@
import {
AGENTS_SKILLS_ROOT,
- EDITOR_PROJECT_CONFIG_PATH,
EDITOR_PROJECT_SKILL_ROOT,
EDITOR_USER_SKILL_ROOT,
parsePathId,
RESERVED_PROJECT_SKILL_NAME,
+ STABLE_EDITOR_PROJECT_CONFIG_PATH,
} from '@inkeep/open-knowledge-core';
export function connectionPathDisplay(pathId: string | undefined): string | null {
@@ -16,7 +16,7 @@ export function connectionPathDisplay(pathId: string | undefined): string | null
switch (location.kind) {
case 'editor-project-config':
- return EDITOR_PROJECT_CONFIG_PATH[location.editor];
+ return STABLE_EDITOR_PROJECT_CONFIG_PATH[location.editor];
case 'editor-project-skill-root': {
const root = EDITOR_PROJECT_SKILL_ROOT[location.editor];
return root === null ? null : `${root}/${RESERVED_PROJECT_SKILL_NAME}/`;
diff --git a/packages/app/src/lib/agent-guidance-copy.test.ts b/packages/app/src/lib/agent-guidance-copy.test.ts
index 362d7427b..15eeddab7 100644
--- a/packages/app/src/lib/agent-guidance-copy.test.ts
+++ b/packages/app/src/lib/agent-guidance-copy.test.ts
@@ -4,7 +4,7 @@ import {
GUIDANCE_KEYS,
guidanceId,
} from '@inkeep/open-knowledge-core';
-import { describe, expect, test } from 'vitest';
+import { describe, expect, test, vi } from 'vitest';
import { followupHintText } from '@/lib/agent-followup-hint';
import { guidanceText, troubleshootingText } from '@/lib/agent-guidance-copy';
@@ -77,10 +77,36 @@ describe('guidance and troubleshooting copy', () => {
id: guidanceId('troubleshooting.cursor.project-entry-not-loaded'),
params: { agent: 'cursor' },
});
- expect(text).toContain('pick open-knowledge');
+ expect(text).toContain('pick open-knowledge and');
expect(text).toContain('Customize → MCPs');
});
+ test("Cursor's note names the server key its reference carries", () => {
+ vi.stubGlobal('window', { okDesktop: { mcpServerName: 'open-knowledge-beta' } });
+ try {
+ const text = troubleshootingText({
+ id: guidanceId('troubleshooting.cursor.project-entry-not-loaded'),
+ params: { agent: 'cursor', server: 'team-knowledge' },
+ });
+ expect(text).toContain('pick team-knowledge and');
+ } finally {
+ vi.unstubAllGlobals();
+ }
+ });
+
+ test("Cursor's note names the desktop channel's own server key", () => {
+ vi.stubGlobal('window', { okDesktop: { mcpServerName: 'open-knowledge-beta' } });
+ try {
+ const text = troubleshootingText({
+ id: guidanceId('troubleshooting.cursor.project-entry-not-loaded'),
+ params: { agent: 'cursor' },
+ });
+ expect(text).toContain('pick open-knowledge-beta and');
+ } finally {
+ vi.unstubAllGlobals();
+ }
+ });
+
test('a ref without an agent or with an unknown id renders nothing', () => {
expect(guidanceText(undefined)).toBeNull();
expect(guidanceText({ id: guidanceId('guidance.mcp.user-config') })).toBeNull();
diff --git a/packages/app/src/lib/agent-guidance-copy.ts b/packages/app/src/lib/agent-guidance-copy.ts
index fd3ae17c8..fb74f4ec0 100644
--- a/packages/app/src/lib/agent-guidance-copy.ts
+++ b/packages/app/src/lib/agent-guidance-copy.ts
@@ -1,6 +1,19 @@
-import { EDITOR_LABELS, type GuidanceRef } from '@inkeep/open-knowledge-core';
+import { DESKTOP_PRODUCTS, EDITOR_LABELS, type GuidanceRef } from '@inkeep/open-knowledge-core';
import { t } from '@lingui/core/macro';
+function desktopMcpServerName(): string | null {
+ return (typeof window === 'undefined' ? null : window.okDesktop?.mcpServerName) || null;
+}
+
+export function mcpServerLabel(): string {
+ return desktopMcpServerName() ?? 'OpenKnowledge';
+}
+
+function cursorServerKey(param: unknown): string {
+ if (typeof param === 'string' && param !== '') return param;
+ return desktopMcpServerName() ?? DESKTOP_PRODUCTS.stable.mcpServerName;
+}
+
function labelOf(id: unknown): string | null {
if (typeof id !== 'string') return null;
return EDITOR_LABELS[id as keyof typeof EDITOR_LABELS] ?? id;
@@ -66,11 +79,13 @@ export function troubleshootingText(ref: GuidanceRef | undefined): string | null
id: 'troubleshooting.claude-desktop.per-tool-approval',
message: `${agent} asks you to approve each OpenKnowledge tool the first time it is used.`,
});
- case 'troubleshooting.cursor.project-entry-not-loaded':
+ case 'troubleshooting.cursor.project-entry-not-loaded': {
+ const server = cursorServerKey(ref.params?.server);
return t({
id: 'troubleshooting.cursor.project-entry-not-loaded',
- message: `If ${agent} shows no OpenKnowledge tools, open Customize → MCPs, pick open-knowledge and switch on its .cursor/mcp.json source; ${agent} leaves project servers off until you do.`,
+ message: `If ${agent} shows no OpenKnowledge tools, open Customize → MCPs, pick ${server} and switch on its .cursor/mcp.json source; ${agent} leaves project servers off until you do.`,
});
+ }
case 'troubleshooting.codex.folder-trust':
return t({
id: 'troubleshooting.codex.folder-trust',
diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.json
index ee802c05e..077af351e 100644
--- a/packages/app/src/locales/ar/messages.json
+++ b/packages/app/src/locales/ar/messages.json
@@ -2917,9 +2917,6 @@
"S33tz3": ["غير متصل"],
"S3qu11": ["كان تجربة أو مشروعًا لمرة واحدة"],
"S48xcO": ["معلّق"],
- "S6SbxA": [
- "يستبدل إدخال \"open-knowledge\" الموجود في هذا الملف. تُترك الخوادم الأخرى في الملف دون تغيير."
- ],
"S6eHlw": ["افتح مشروعًا أولًا."],
"S6l5dv": ["تعذّر بدء إنشاء عنصر جديد"],
"S9Vnum": ["إزالة ", ["patternText"]],
@@ -6000,7 +5997,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"إذا لم يعرض ",
["agent"],
- " أدوات OpenKnowledge، فافتح Customize → MCPs واختر open-knowledge وفعّل مصدره .cursor/mcp.json؛ إذ يترك ",
+ " أدوات OpenKnowledge، فافتح Customize → MCPs واختر ",
+ ["server"],
+ " وفعّل مصدره .cursor/mcp.json؛ إذ يترك ",
["agent"],
" خوادم المشروع معطّلة حتى تفعّلها."
],
@@ -6088,6 +6087,11 @@
"uM6jnS": ["فشلت الاستعادة"],
"uNGmQn": ["تعذّر تشغيل الاختبار. تأكد من أن OpenKnowledge لا يزال يعمل."],
"uO9WLl": ["دفع"],
+ "uOKoBM": [
+ "يستبدل إدخال ",
+ ["server"],
+ " الموجود في هذا الملف. تُترك الخوادم الأخرى في الملف دون تغيير."
+ ],
"uPJml1": ["القراءة فقط مسموح بها"],
"uQNW00": ["HEAD منفصل — اسحب فرعًا للمتابعة"],
"uQewpR": [
diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.po
index cf1a2e938..3ab16e1a6 100644
--- a/packages/app/src/locales/ar/messages.po
+++ b/packages/app/src/locales/ar/messages.po
@@ -7404,7 +7404,7 @@ msgstr "إذا لم يعرض {agent} أدوات OpenKnowledge، فتحقق من
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "إذا لم يعرض {agent} أدوات OpenKnowledge، فافتح Customize → MCPs واختر open-knowledge وفعّل مصدره .cursor/mcp.json؛ إذ يترك {agent} خوادم المشروع معطّلة حتى تفعّلها."
+msgstr "إذا لم يعرض {agent} أدوات OpenKnowledge، فافتح Customize → MCPs واختر {server} وفعّل مصدره .cursor/mcp.json؛ إذ يترك {agent} خوادم المشروع معطّلة حتى تفعّلها."
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "هل تستبدل هذه الروابط الرمزية بنسخ مستقلة؟"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "يستبدل إدخال \"open-knowledge\" الموجود في هذا الملف. تُترك الخوادم الأخرى في الملف دون تغيير."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "يستبدل إدخال {server} الموجود في هذا الملف. تُترك الخوادم الأخرى في الملف دون تغيير."
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.json
index cb963f794..17cb43956 100644
--- a/packages/app/src/locales/bn/messages.json
+++ b/packages/app/src/locales/bn/messages.json
@@ -2476,9 +2476,6 @@
"S33tz3": ["যুক্ত নয়"],
"S3qu11": ["এটি একটি পরীক্ষামূলক বা একবারের প্রকল্প ছিল"],
"S48xcO": ["অপেক্ষমাণ"],
- "S6SbxA": [
- "এই ফাইলে বিদ্যমান \"open-knowledge\" এন্ট্রিটি প্রতিস্থাপন করে। ফাইলের অন্য সার্ভারগুলি অপরিবর্তিত থাকে।"
- ],
"S6eHlw": ["আগে একটি প্রকল্প খুলুন।"],
"S6l5dv": ["নতুন আইটেম তৈরি শুরু করা যায়নি"],
"S9Vnum": [["patternText"], " সরান"],
@@ -5075,7 +5072,9 @@
],
"troubleshooting.cursor.project-entry-not-loaded": [
["agent"],
- "-এ OpenKnowledge টুল না দেখালে, Customize → MCPs খুলুন, open-knowledge বেছে নিন এবং তার .cursor/mcp.json উৎসটি চালু করুন; আপনি চালু না করা পর্যন্ত ",
+ "-এ OpenKnowledge টুল না দেখালে, Customize → MCPs খুলুন, ",
+ ["server"],
+ " বেছে নিন এবং তার .cursor/mcp.json উৎসটি চালু করুন; আপনি চালু না করা পর্যন্ত ",
["agent"],
" প্রকল্পের সার্ভার বন্ধ রাখে।"
],
@@ -5147,6 +5146,11 @@
"uM6jnS": ["ফিরিয়ে আনা ব্যর্থ"],
"uNGmQn": ["পরীক্ষা চালানো যায়নি। OpenKnowledge এখনও চলছে কি না দেখুন।"],
"uO9WLl": ["পাঠান"],
+ "uOKoBM": [
+ "এই ফাইলে বিদ্যমান ",
+ ["server"],
+ " এন্ট্রিটি প্রতিস্থাপন করে। ফাইলের অন্য সার্ভারগুলি অপরিবর্তিত থাকে।"
+ ],
"uPJml1": ["শুধু-পড়া অনুমোদিত"],
"uQNW00": ["বিচ্ছিন্ন HEAD — আবার শুরু করতে কোনো ব্রাঞ্চ চেক আউট করুন"],
"uQewpR": [
diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.po
index dba9cdd98..b16878250 100644
--- a/packages/app/src/locales/bn/messages.po
+++ b/packages/app/src/locales/bn/messages.po
@@ -7400,7 +7400,7 @@ msgstr "{agent}-এ OpenKnowledge টুল না দেখালে, দেখ
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "{agent}-এ OpenKnowledge টুল না দেখালে, Customize → MCPs খুলুন, open-knowledge বেছে নিন এবং তার .cursor/mcp.json উৎসটি চালু করুন; আপনি চালু না করা পর্যন্ত {agent} প্রকল্পের সার্ভার বন্ধ রাখে।"
+msgstr "{agent}-এ OpenKnowledge টুল না দেখালে, Customize → MCPs খুলুন, {server} বেছে নিন এবং তার .cursor/mcp.json উৎসটি চালু করুন; আপনি চালু না করা পর্যন্ত {agent} প্রকল্পের সার্ভার বন্ধ রাখে।"
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12033,8 +12033,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "এই সিমলিংকগুলো স্বতন্ত্র অনুলিপি দিয়ে বদলাবেন?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "এই ফাইলে বিদ্যমান \"open-knowledge\" এন্ট্রিটি প্রতিস্থাপন করে। ফাইলের অন্য সার্ভারগুলি অপরিবর্তিত থাকে।"
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "এই ফাইলে বিদ্যমান {server} এন্ট্রিটি প্রতিস্থাপন করে। ফাইলের অন্য সার্ভারগুলি অপরিবর্তিত থাকে।"
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 2e2a19e9c..6dd6708d2 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -2557,9 +2557,6 @@
"S33tz3": ["Not connected"],
"S3qu11": ["It was a trial or one-off project"],
"S48xcO": ["pending"],
- "S6SbxA": [
- "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
- ],
"S6eHlw": ["Open a project first."],
"S6l5dv": ["Could not start creating a new item"],
"S9Vnum": ["Remove ", ["patternText"]],
@@ -5264,7 +5261,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"If ",
["agent"],
- " shows no OpenKnowledge tools, open Customize → MCPs, pick open-knowledge and switch on its .cursor/mcp.json source; ",
+ " shows no OpenKnowledge tools, open Customize → MCPs, pick ",
+ ["server"],
+ " and switch on its .cursor/mcp.json source; ",
["agent"],
" leaves project servers off until you do."
],
@@ -5337,6 +5336,11 @@
"uM6jnS": ["Restore failed"],
"uNGmQn": ["Couldn't run the test. Check that OpenKnowledge is still running."],
"uO9WLl": ["Push"],
+ "uOKoBM": [
+ "Replaces the existing ",
+ ["server"],
+ " entry in this file. Other servers in the file are left alone."
+ ],
"uPJml1": ["Read-only allowed"],
"uQNW00": ["Detached HEAD — checkout a branch to resume"],
"uQewpR": [
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 211d4ac9d..f5dcfb096 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -7404,7 +7404,7 @@ msgstr "If {agent} shows no OpenKnowledge tools, check that its MCP config path
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "If {agent} shows no OpenKnowledge tools, open Customize → MCPs, pick open-knowledge and switch on its .cursor/mcp.json source; {agent} leaves project servers off until you do."
+msgstr "If {agent} shows no OpenKnowledge tools, open Customize → MCPs, pick {server} and switch on its .cursor/mcp.json source; {agent} leaves project servers off until you do."
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "Replace these symlinks with independent copies?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.json
index c231e7936..b3b77e796 100644
--- a/packages/app/src/locales/es/messages.json
+++ b/packages/app/src/locales/es/messages.json
@@ -2937,9 +2937,6 @@
"S33tz3": ["Sin conexión"],
"S3qu11": ["Era una prueba o un proyecto puntual"],
"S48xcO": ["pendiente"],
- "S6SbxA": [
- "Sustituye la entrada \"open-knowledge\" existente en este archivo. Los demás servidores del archivo no se modifican."
- ],
"S6eHlw": ["Abre primero un proyecto."],
"S6l5dv": ["No se pudo empezar a crear un elemento nuevo"],
"S9Vnum": ["Quitar ", ["patternText"]],
@@ -6051,7 +6048,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"Si ",
["agent"],
- " no muestra las herramientas de OpenKnowledge, abre Customize → MCPs, elige open-knowledge y activa su origen .cursor/mcp.json; ",
+ " no muestra las herramientas de OpenKnowledge, abre Customize → MCPs, elige ",
+ ["server"],
+ " y activa su origen .cursor/mcp.json; ",
["agent"],
" deja apagados los servidores de proyecto hasta que lo hagas."
],
@@ -6133,6 +6132,11 @@
"uM6jnS": ["Falló la restauración"],
"uNGmQn": ["No se pudo ejecutar la prueba. Comprueba que OpenKnowledge siga en marcha."],
"uO9WLl": ["Push"],
+ "uOKoBM": [
+ "Sustituye la entrada ",
+ ["server"],
+ " existente en este archivo. Los demás servidores del archivo no se modifican."
+ ],
"uPJml1": ["Solo lectura permitido"],
"uQNW00": ["HEAD desacoplado: extrae una rama para continuar"],
"uQewpR": [
diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.po
index 9a1032a0c..d0598b4c4 100644
--- a/packages/app/src/locales/es/messages.po
+++ b/packages/app/src/locales/es/messages.po
@@ -7404,7 +7404,7 @@ msgstr "Si {agent} no muestra las herramientas de OpenKnowledge, comprueba que l
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "Si {agent} no muestra las herramientas de OpenKnowledge, abre Customize → MCPs, elige open-knowledge y activa su origen .cursor/mcp.json; {agent} deja apagados los servidores de proyecto hasta que lo hagas."
+msgstr "Si {agent} no muestra las herramientas de OpenKnowledge, abre Customize → MCPs, elige {server} y activa su origen .cursor/mcp.json; {agent} deja apagados los servidores de proyecto hasta que lo hagas."
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "¿Reemplazar estos enlaces simbólicos por copias independientes?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "Sustituye la entrada \"open-knowledge\" existente en este archivo. Los demás servidores del archivo no se modifican."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "Sustituye la entrada {server} existente en este archivo. Los demás servidores del archivo no se modifican."
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.json
index 616b7d63d..bb921aceb 100644
--- a/packages/app/src/locales/fr/messages.json
+++ b/packages/app/src/locales/fr/messages.json
@@ -2983,9 +2983,6 @@
"S33tz3": ["Non connecté"],
"S3qu11": ["C'était un essai ou un projet ponctuel"],
"S48xcO": ["en attente"],
- "S6SbxA": [
- "Remplace l'entrée \"open-knowledge\" existante dans ce fichier. Les autres serveurs du fichier ne sont pas modifiés."
- ],
"S6eHlw": ["Ouvrez d'abord un projet."],
"S6l5dv": ["Impossible de commencer la création d'un nouvel élément"],
"S9Vnum": ["Retirer ", ["patternText"]],
@@ -6120,7 +6117,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"Si ",
["agent"],
- " n'affiche aucun outil OpenKnowledge, ouvrez Customize → MCPs, sélectionnez open-knowledge et activez sa source .cursor/mcp.json ; ",
+ " n'affiche aucun outil OpenKnowledge, ouvrez Customize → MCPs, sélectionnez ",
+ ["server"],
+ " et activez sa source .cursor/mcp.json ; ",
["agent"],
" laisse les serveurs de projet désactivés tant que vous ne le faites pas."
],
@@ -6205,6 +6204,11 @@
"uM6jnS": ["Échec de la restauration"],
"uNGmQn": ["Impossible d'exécuter le test. Vérifiez qu'OpenKnowledge fonctionne toujours."],
"uO9WLl": ["Pousser"],
+ "uOKoBM": [
+ "Remplace l'entrée ",
+ ["server"],
+ " existante dans ce fichier. Les autres serveurs du fichier ne sont pas modifiés."
+ ],
"uPJml1": ["Lecture seule autorisée"],
"uQNW00": ["HEAD détachée — extrayez une branche pour reprendre"],
"uQewpR": [
diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.po
index 46a6a4042..71568ea26 100644
--- a/packages/app/src/locales/fr/messages.po
+++ b/packages/app/src/locales/fr/messages.po
@@ -7404,7 +7404,7 @@ msgstr "Si {agent} n'affiche aucun outil OpenKnowledge, vérifiez que le chemin
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "Si {agent} n'affiche aucun outil OpenKnowledge, ouvrez Customize → MCPs, sélectionnez open-knowledge et activez sa source .cursor/mcp.json ; {agent} laisse les serveurs de projet désactivés tant que vous ne le faites pas."
+msgstr "Si {agent} n'affiche aucun outil OpenKnowledge, ouvrez Customize → MCPs, sélectionnez {server} et activez sa source .cursor/mcp.json ; {agent} laisse les serveurs de projet désactivés tant que vous ne le faites pas."
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "Remplacer ces liens symboliques par des copies indépendantes ?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "Remplace l'entrée \"open-knowledge\" existante dans ce fichier. Les autres serveurs du fichier ne sont pas modifiés."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "Remplace l'entrée {server} existante dans ce fichier. Les autres serveurs du fichier ne sont pas modifiés."
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.json
index 9ab00e52f..c1b876443 100644
--- a/packages/app/src/locales/hi/messages.json
+++ b/packages/app/src/locales/hi/messages.json
@@ -2474,9 +2474,6 @@
"S33tz3": ["जुड़ा नहीं"],
"S3qu11": ["यह एक परीक्षण या एक-बार का प्रोजेक्ट था"],
"S48xcO": ["लंबित"],
- "S6SbxA": [
- "इस फ़ाइल की मौजूदा \"open-knowledge\" प्रविष्टि को बदल देता है। फ़ाइल के अन्य सर्वर अपरिवर्तित रहते हैं।"
- ],
"S6eHlw": ["पहले कोई प्रोजेक्ट खोलें।"],
"S6l5dv": ["नया आइटम बनाना शुरू नहीं किया जा सका"],
"S9Vnum": [["patternText"], " हटाएँ"],
@@ -5061,7 +5058,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"अगर ",
["agent"],
- " में OpenKnowledge टूल नहीं दिखते, तो Customize → MCPs खोलें, open-knowledge चुनें और उसका .cursor/mcp.json स्रोत चालू करें; जब तक आप ऐसा नहीं करते, ",
+ " में OpenKnowledge टूल नहीं दिखते, तो Customize → MCPs खोलें, ",
+ ["server"],
+ " चुनें और उसका .cursor/mcp.json स्रोत चालू करें; जब तक आप ऐसा नहीं करते, ",
["agent"],
" प्रोजेक्ट सर्वर बंद रखता है।"
],
@@ -5136,6 +5135,11 @@
"uM6jnS": ["बहाली विफल"],
"uNGmQn": ["परीक्षण नहीं चलाया जा सका। जाँचें कि OpenKnowledge अब भी चल रहा है।"],
"uO9WLl": ["भेजें"],
+ "uOKoBM": [
+ "इस फ़ाइल की मौजूदा ",
+ ["server"],
+ " प्रविष्टि को बदल देता है। फ़ाइल के अन्य सर्वर अपरिवर्तित रहते हैं।"
+ ],
"uPJml1": ["केवल-पढ़ने की अनुमति है"],
"uQNW00": ["अलग किया हुआ HEAD — फिर से शुरू करने के लिए कोई ब्रांच चेक आउट करें"],
"uQewpR": [
diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.po
index 6744e4aec..37d9c34d8 100644
--- a/packages/app/src/locales/hi/messages.po
+++ b/packages/app/src/locales/hi/messages.po
@@ -7400,7 +7400,7 @@ msgstr "अगर {agent} में OpenKnowledge टूल नहीं दि
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "अगर {agent} में OpenKnowledge टूल नहीं दिखते, तो Customize → MCPs खोलें, open-knowledge चुनें और उसका .cursor/mcp.json स्रोत चालू करें; जब तक आप ऐसा नहीं करते, {agent} प्रोजेक्ट सर्वर बंद रखता है।"
+msgstr "अगर {agent} में OpenKnowledge टूल नहीं दिखते, तो Customize → MCPs खोलें, {server} चुनें और उसका .cursor/mcp.json स्रोत चालू करें; जब तक आप ऐसा नहीं करते, {agent} प्रोजेक्ट सर्वर बंद रखता है।"
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12033,8 +12033,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "इन सिमलिंक को स्वतंत्र प्रतियों से बदलें?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "इस फ़ाइल की मौजूदा \"open-knowledge\" प्रविष्टि को बदल देता है। फ़ाइल के अन्य सर्वर अपरिवर्तित रहते हैं।"
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "इस फ़ाइल की मौजूदा {server} प्रविष्टि को बदल देता है। फ़ाइल के अन्य सर्वर अपरिवर्तित रहते हैं।"
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.json
index 23484d14d..d0fa35e70 100644
--- a/packages/app/src/locales/id/messages.json
+++ b/packages/app/src/locales/id/messages.json
@@ -2563,9 +2563,6 @@
"S33tz3": ["Tidak terhubung"],
"S3qu11": ["Itu hanya percobaan atau proyek sekali pakai"],
"S48xcO": ["tertunda"],
- "S6SbxA": [
- "Mengganti entri \"open-knowledge\" yang ada di file ini. Server lain dalam file ini tidak diubah."
- ],
"S6eHlw": ["Buka proyek terlebih dahulu."],
"S6l5dv": ["Pembuatan item baru tidak dapat dimulai"],
"S9Vnum": ["Hapus ", ["patternText"]],
@@ -5275,7 +5272,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"Jika ",
["agent"],
- " tidak menampilkan alat OpenKnowledge, buka Customize → MCPs, pilih open-knowledge dan nyalakan sumber .cursor/mcp.json miliknya; ",
+ " tidak menampilkan alat OpenKnowledge, buka Customize → MCPs, pilih ",
+ ["server"],
+ " dan nyalakan sumber .cursor/mcp.json miliknya; ",
["agent"],
" membiarkan server proyek mati sampai Anda melakukannya."
],
@@ -5351,6 +5350,11 @@
"uM6jnS": ["Gagal memulihkan"],
"uNGmQn": ["Pengujiannya tidak bisa dijalankan. Pastikan OpenKnowledge masih berjalan."],
"uO9WLl": ["Push"],
+ "uOKoBM": [
+ "Mengganti entri ",
+ ["server"],
+ " yang ada di file ini. Server lain dalam file ini tidak diubah."
+ ],
"uPJml1": ["Hanya-baca diizinkan"],
"uQNW00": ["HEAD terlepas — ambil sebuah cabang untuk melanjutkan"],
"uQewpR": [
diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.po
index 003124804..3bab2fb77 100644
--- a/packages/app/src/locales/id/messages.po
+++ b/packages/app/src/locales/id/messages.po
@@ -7400,7 +7400,7 @@ msgstr "Jika {agent} tidak menampilkan alat OpenKnowledge, periksa apakah jalur
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "Jika {agent} tidak menampilkan alat OpenKnowledge, buka Customize → MCPs, pilih open-knowledge dan nyalakan sumber .cursor/mcp.json miliknya; {agent} membiarkan server proyek mati sampai Anda melakukannya."
+msgstr "Jika {agent} tidak menampilkan alat OpenKnowledge, buka Customize → MCPs, pilih {server} dan nyalakan sumber .cursor/mcp.json miliknya; {agent} membiarkan server proyek mati sampai Anda melakukannya."
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12033,8 +12033,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "Ganti symlink-symlink ini dengan salinan mandiri?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "Mengganti entri \"open-knowledge\" yang ada di file ini. Server lain dalam file ini tidak diubah."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "Mengganti entri {server} yang ada di file ini. Server lain dalam file ini tidak diubah."
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.json
index f9405d942..9d3a4056f 100644
--- a/packages/app/src/locales/ko/messages.json
+++ b/packages/app/src/locales/ko/messages.json
@@ -2447,9 +2447,6 @@
"S33tz3": ["연결되지 않음"],
"S3qu11": ["시험 삼아 사용했거나 일회성 프로젝트였습니다"],
"S48xcO": ["대기 중"],
- "S6SbxA": [
- "이 파일의 기존 \"open-knowledge\" 항목을 대체합니다. 파일의 다른 서버는 그대로 유지됩니다."
- ],
"S6eHlw": ["먼저 프로젝트를 여세요."],
"S6l5dv": ["새 항목 만들기를 시작하지 못했습니다"],
"S9Vnum": [["patternText"], " 제거"],
@@ -5041,7 +5038,9 @@
],
"troubleshooting.cursor.project-entry-not-loaded": [
["agent"],
- "에 OpenKnowledge 도구가 보이지 않으면 Customize → MCPs를 열고 open-knowledge를 선택한 뒤 해당 .cursor/mcp.json 소스를 켜세요. ",
+ "에 OpenKnowledge 도구가 보이지 않으면 Customize → MCPs를 열고 ",
+ ["server"],
+ "를 선택한 뒤 해당 .cursor/mcp.json 소스를 켜세요. ",
["agent"],
"은(는) 직접 켜기 전까지 프로젝트 서버를 꺼 둡니다."
],
@@ -5113,6 +5112,11 @@
"uM6jnS": ["복원 실패"],
"uNGmQn": ["테스트를 실행하지 못했습니다. OpenKnowledge가 계속 실행 중인지 확인합니다."],
"uO9WLl": ["푸시"],
+ "uOKoBM": [
+ "이 파일의 기존 ",
+ ["server"],
+ " 항목을 대체합니다. 파일의 다른 서버는 그대로 유지됩니다."
+ ],
"uPJml1": ["읽기 전용 허용됨"],
"uQNW00": ["HEAD가 분리되었습니다. 계속하려면 브랜치를 체크아웃하세요."],
"uQewpR": [
diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.po
index 975219df0..760ddd8dc 100644
--- a/packages/app/src/locales/ko/messages.po
+++ b/packages/app/src/locales/ko/messages.po
@@ -7404,7 +7404,7 @@ msgstr "{agent}에 OpenKnowledge 도구가 보이지 않으면 설정에 있는
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "{agent}에 OpenKnowledge 도구가 보이지 않으면 Customize → MCPs를 열고 open-knowledge를 선택한 뒤 해당 .cursor/mcp.json 소스를 켜세요. {agent}은(는) 직접 켜기 전까지 프로젝트 서버를 꺼 둡니다."
+msgstr "{agent}에 OpenKnowledge 도구가 보이지 않으면 Customize → MCPs를 열고 {server}를 선택한 뒤 해당 .cursor/mcp.json 소스를 켜세요. {agent}은(는) 직접 켜기 전까지 프로젝트 서버를 꺼 둡니다."
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "이 심볼릭 링크를 독립적인 복사본으로 바꿀까요?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "이 파일의 기존 \"open-knowledge\" 항목을 대체합니다. 파일의 다른 서버는 그대로 유지됩니다."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "이 파일의 기존 {server} 항목을 대체합니다. 파일의 다른 서버는 그대로 유지됩니다."
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 10a98f0fb..8191e299b 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -2557,9 +2557,6 @@
"S33tz3": ["Ńōţ ćōńńēćţēď"],
"S3qu11": ["Ĩţ ŵàś à ţŕĩàĺ ōŕ ōńē-ōƒƒ ƥŕōĴēćţ"],
"S48xcO": ["ƥēńďĩńĝ"],
- "S6SbxA": [
- "Ŕēƥĺàćēś ţĥē ēxĩśţĩńĝ \"ōƥēń-ķńōŵĺēďĝē\" ēńţŕŷ ĩń ţĥĩś ƒĩĺē. Ōţĥēŕ śēŕvēŕś ĩń ţĥē ƒĩĺē àŕē ĺēƒţ àĺōńē."
- ],
"S6eHlw": ["Ōƥēń à ƥŕōĴēćţ ƒĩŕśţ."],
"S6l5dv": ["Ćōũĺď ńōţ śţàŕţ ćŕēàţĩńĝ à ńēŵ ĩţēḿ"],
"S9Vnum": ["Ŕēḿōvē ", ["patternText"]],
@@ -5264,7 +5261,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"Ĩƒ ",
["agent"],
- " śĥōŵś ńō ŌƥēńĶńōŵĺēďĝē ţōōĺś, ōƥēń Ćũśţōḿĩźē → ḾĆƤś, ƥĩćķ ōƥēń-ķńōŵĺēďĝē àńď śŵĩţćĥ ōń ĩţś .ćũŕśōŕ/ḿćƥ.Ĵśōń śōũŕćē; ",
+ " śĥōŵś ńō ŌƥēńĶńōŵĺēďĝē ţōōĺś, ōƥēń Ćũśţōḿĩźē → ḾĆƤś, ƥĩćķ ",
+ ["server"],
+ " àńď śŵĩţćĥ ōń ĩţś .ćũŕśōŕ/ḿćƥ.Ĵśōń śōũŕćē; ",
["agent"],
" ĺēàvēś ƥŕōĴēćţ śēŕvēŕś ōƒƒ ũńţĩĺ ŷōũ ďō."
],
@@ -5337,6 +5336,11 @@
"uM6jnS": ["Ŕēśţōŕē ƒàĩĺēď"],
"uNGmQn": ["Ćōũĺďń'ţ ŕũń ţĥē ţēśţ. Ćĥēćķ ţĥàţ ŌƥēńĶńōŵĺēďĝē ĩś śţĩĺĺ ŕũńńĩńĝ."],
"uO9WLl": ["Ƥũśĥ"],
+ "uOKoBM": [
+ "Ŕēƥĺàćēś ţĥē ēxĩśţĩńĝ ",
+ ["server"],
+ " ēńţŕŷ ĩń ţĥĩś ƒĩĺē. Ōţĥēŕ śēŕvēŕś ĩń ţĥē ƒĩĺē àŕē ĺēƒţ àĺōńē."
+ ],
"uPJml1": ["Ŕēàď-ōńĺŷ àĺĺōŵēď"],
"uQNW00": ["Ďēţàćĥēď ĤĒÀĎ — ćĥēćķōũţ à ƀŕàńćĥ ţō ŕēśũḿē"],
"uQewpR": [
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 8f4044bd1..8472dab41 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -12033,7 +12033,7 @@ msgid "Replace these symlinks with independent copies?"
msgstr ""
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
msgstr ""
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.json
index e87df7182..45d7496d0 100644
--- a/packages/app/src/locales/pt-BR/messages.json
+++ b/packages/app/src/locales/pt-BR/messages.json
@@ -2898,9 +2898,6 @@
"S33tz3": ["Não conectado"],
"S3qu11": ["Era um teste ou um projeto pontual"],
"S48xcO": ["pendente"],
- "S6SbxA": [
- "Substitui a entrada \"open-knowledge\" existente neste arquivo. Os outros servidores do arquivo permanecem inalterados."
- ],
"S6eHlw": ["Abra um projeto primeiro."],
"S6l5dv": ["Não foi possível começar a criar um novo item"],
"S9Vnum": ["Remover ", ["patternText"]],
@@ -5936,7 +5933,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"Se o ",
["agent"],
- " não mostrar as ferramentas do OpenKnowledge, abra Customize → MCPs, escolha o open-knowledge e ative a origem .cursor/mcp.json dele; o ",
+ " não mostrar as ferramentas do OpenKnowledge, abra Customize → MCPs, escolha o ",
+ ["server"],
+ " e ative a origem .cursor/mcp.json dele; o ",
["agent"],
" deixa os servidores de projeto desligados até você fazer isso."
],
@@ -6019,6 +6018,11 @@
"uM6jnS": ["Falha ao restaurar"],
"uNGmQn": ["Não deu para executar o teste. Verifique se o OpenKnowledge ainda está rodando."],
"uO9WLl": ["Push"],
+ "uOKoBM": [
+ "Substitui a entrada ",
+ ["server"],
+ " existente neste arquivo. Os outros servidores do arquivo permanecem inalterados."
+ ],
"uPJml1": ["Somente leitura permitido"],
"uQNW00": ["HEAD desanexado — extraia um ramo para continuar"],
"uQewpR": [
diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.po
index 49351db98..ef1cc3219 100644
--- a/packages/app/src/locales/pt-BR/messages.po
+++ b/packages/app/src/locales/pt-BR/messages.po
@@ -7400,7 +7400,7 @@ msgstr "Se o {agent} não mostrar as ferramentas do OpenKnowledge, confira se o
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "Se o {agent} não mostrar as ferramentas do OpenKnowledge, abra Customize → MCPs, escolha o open-knowledge e ative a origem .cursor/mcp.json dele; o {agent} deixa os servidores de projeto desligados até você fazer isso."
+msgstr "Se o {agent} não mostrar as ferramentas do OpenKnowledge, abra Customize → MCPs, escolha o {server} e ative a origem .cursor/mcp.json dele; o {agent} deixa os servidores de projeto desligados até você fazer isso."
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12033,8 +12033,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "Substituir estes links simbólicos por cópias independentes?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "Substitui a entrada \"open-knowledge\" existente neste arquivo. Os outros servidores do arquivo permanecem inalterados."
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "Substitui a entrada {server} existente neste arquivo. Os outros servidores do arquivo permanecem inalterados."
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.json
index e1ea7477c..a4b9f78ce 100644
--- a/packages/app/src/locales/ur/messages.json
+++ b/packages/app/src/locales/ur/messages.json
@@ -2599,9 +2599,6 @@
"S33tz3": ["منسلک نہیں"],
"S3qu11": ["یہ ایک آزمائشی یا ایک بار کا پروجیکٹ تھا"],
"S48xcO": ["زیرِ التوا"],
- "S6SbxA": [
- "اس فائل میں موجود \"open-knowledge\" اندراج کو تبدیل کرتا ہے۔ فائل کے دیگر سرورز میں کوئی تبدیلی نہیں ہوتی۔"
- ],
"S6eHlw": ["پہلے کوئی پروجیکٹ کھولیں۔"],
"S6l5dv": ["نیا آئٹم بنانا شروع نہیں ہو سکا"],
"S9Vnum": [["patternText"], " ہٹائیں"],
@@ -5344,7 +5341,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"اگر ",
["agent"],
- " میں OpenKnowledge ٹولز نظر نہ آئیں تو Customize → MCPs کھولیں، open-knowledge منتخب کریں اور اس کا .cursor/mcp.json ماخذ آن کریں؛ جب تک آپ ایسا نہ کریں، ",
+ " میں OpenKnowledge ٹولز نظر نہ آئیں تو Customize → MCPs کھولیں، ",
+ ["server"],
+ " منتخب کریں اور اس کا .cursor/mcp.json ماخذ آن کریں؛ جب تک آپ ایسا نہ کریں، ",
["agent"],
" پروجیکٹ سرورز بند رکھتا ہے۔"
],
@@ -5419,6 +5418,11 @@
"uM6jnS": ["بحالی ناکام"],
"uNGmQn": ["ٹیسٹ نہیں چل سکا۔ دیکھیں کہ OpenKnowledge اب بھی چل رہا ہے۔"],
"uO9WLl": ["پُش کریں"],
+ "uOKoBM": [
+ "اس فائل میں موجود ",
+ ["server"],
+ " اندراج کو تبدیل کرتا ہے۔ فائل کے دیگر سرورز میں کوئی تبدیلی نہیں ہوتی۔"
+ ],
"uPJml1": ["صرف پڑھنے کی اجازت ہے"],
"uQNW00": ["منقطع HEAD — جاری رکھنے کے لیے کوئی برانچ چیک آؤٹ کریں"],
"uQewpR": [
diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.po
index 2d5695a40..45334715f 100644
--- a/packages/app/src/locales/ur/messages.po
+++ b/packages/app/src/locales/ur/messages.po
@@ -7404,7 +7404,7 @@ msgstr "اگر {agent} میں OpenKnowledge ٹولز نظر نہ آئیں تو
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "اگر {agent} میں OpenKnowledge ٹولز نظر نہ آئیں تو Customize → MCPs کھولیں، open-knowledge منتخب کریں اور اس کا .cursor/mcp.json ماخذ آن کریں؛ جب تک آپ ایسا نہ کریں، {agent} پروجیکٹ سرورز بند رکھتا ہے۔"
+msgstr "اگر {agent} میں OpenKnowledge ٹولز نظر نہ آئیں تو Customize → MCPs کھولیں، {server} منتخب کریں اور اس کا .cursor/mcp.json ماخذ آن کریں؛ جب تک آپ ایسا نہ کریں، {agent} پروجیکٹ سرورز بند رکھتا ہے۔"
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "کیا ان سِم لنکس کو خودمختار نقول سے بدل دیا جائے؟"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "اس فائل میں موجود \"open-knowledge\" اندراج کو تبدیل کرتا ہے۔ فائل کے دیگر سرورز میں کوئی تبدیلی نہیں ہوتی۔"
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "اس فائل میں موجود {server} اندراج کو تبدیل کرتا ہے۔ فائل کے دیگر سرورز میں کوئی تبدیلی نہیں ہوتی۔"
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.json
index dc9a6e19e..4d960d4cd 100644
--- a/packages/app/src/locales/zh-Hans/messages.json
+++ b/packages/app/src/locales/zh-Hans/messages.json
@@ -2225,7 +2225,6 @@
"S33tz3": ["未连接"],
"S3qu11": ["那只是一次试用或一次性项目"],
"S48xcO": ["待处理"],
- "S6SbxA": ["替换此文件中现有的 \"open-knowledge\" 条目。文件中的其他服务器保持不变。"],
"S6eHlw": ["请先打开一个项目。"],
"S6l5dv": ["无法开始创建新项目"],
"S9Vnum": ["移除 ", ["patternText"]],
@@ -4576,7 +4575,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"如果 ",
["agent"],
- " 没有显示 OpenKnowledge 工具,请打开 Customize → MCPs,选择 open-knowledge 并开启它的 .cursor/mcp.json 来源;在你开启之前,",
+ " 没有显示 OpenKnowledge 工具,请打开 Customize → MCPs,选择 ",
+ ["server"],
+ " 并开启它的 .cursor/mcp.json 来源;在你开启之前,",
["agent"],
" 会保持项目服务器关闭。"
],
@@ -4641,6 +4642,7 @@
"uM6jnS": ["恢复失败"],
"uNGmQn": ["无法运行测试。请确认 OpenKnowledge 仍在运行。"],
"uO9WLl": ["推送"],
+ "uOKoBM": ["替换此文件中现有的 ", ["server"], " 条目。文件中的其他服务器保持不变。"],
"uPJml1": ["已允许只读命令"],
"uQNW00": ["HEAD 处于游离状态——请检出一个分支以继续"],
"uQewpR": ["无法重启服务器——它正以另一个账户运行。请重启电脑清除后再打开这个项目。"],
diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.po
index e380c71e4..72e16d5bc 100644
--- a/packages/app/src/locales/zh-Hans/messages.po
+++ b/packages/app/src/locales/zh-Hans/messages.po
@@ -7404,7 +7404,7 @@ msgstr "如果 {agent} 没有显示 OpenKnowledge 工具,请检查它设置中
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "如果 {agent} 没有显示 OpenKnowledge 工具,请打开 Customize → MCPs,选择 open-knowledge 并开启它的 .cursor/mcp.json 来源;在你开启之前,{agent} 会保持项目服务器关闭。"
+msgstr "如果 {agent} 没有显示 OpenKnowledge 工具,请打开 Customize → MCPs,选择 {server} 并开启它的 .cursor/mcp.json 来源;在你开启之前,{agent} 会保持项目服务器关闭。"
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "要把这些符号链接替换为独立副本吗?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "替换此文件中现有的 \"open-knowledge\" 条目。文件中的其他服务器保持不变。"
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "替换此文件中现有的 {server} 条目。文件中的其他服务器保持不变。"
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.json
index 202af7f91..2af09153c 100644
--- a/packages/app/src/locales/zh-Hant/messages.json
+++ b/packages/app/src/locales/zh-Hant/messages.json
@@ -2243,7 +2243,6 @@
"S33tz3": ["未連接"],
"S3qu11": ["那只是一次試用或一次性的專案"],
"S48xcO": ["待處理"],
- "S6SbxA": ["取代此檔案中現有的 \"open-knowledge\" 項目。檔案中的其他伺服器維持不變。"],
"S6eHlw": ["請先開啟一個專案。"],
"S6l5dv": ["無法開始建立新項目"],
"S9Vnum": ["移除 ", ["patternText"]],
@@ -4594,7 +4593,9 @@
"troubleshooting.cursor.project-entry-not-loaded": [
"如果 ",
["agent"],
- " 沒有顯示 OpenKnowledge 工具,請開啟 Customize → MCPs,選擇 open-knowledge 並開啟它的 .cursor/mcp.json 來源;在你開啟之前,",
+ " 沒有顯示 OpenKnowledge 工具,請開啟 Customize → MCPs,選擇 ",
+ ["server"],
+ " 並開啟它的 .cursor/mcp.json 來源;在你開啟之前,",
["agent"],
" 會讓專案伺服器保持關閉。"
],
@@ -4659,6 +4660,7 @@
"uM6jnS": ["還原失敗"],
"uNGmQn": ["無法執行測試。請確認 OpenKnowledge 仍在執行。"],
"uO9WLl": ["推送"],
+ "uOKoBM": ["取代此檔案中現有的 ", ["server"], " 項目。檔案中的其他伺服器維持不變。"],
"uPJml1": ["已允許唯讀命令"],
"uQNW00": ["HEAD 處於分離狀態——請簽出一個分支再繼續"],
"uQewpR": [
diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.po
index 312aa9797..eafe59364 100644
--- a/packages/app/src/locales/zh-Hant/messages.po
+++ b/packages/app/src/locales/zh-Hant/messages.po
@@ -7404,7 +7404,7 @@ msgstr "如果 {agent} 沒有顯示 OpenKnowledge 工具,請檢查它設定中
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
msgid "troubleshooting.cursor.project-entry-not-loaded"
-msgstr "如果 {agent} 沒有顯示 OpenKnowledge 工具,請開啟 Customize → MCPs,選擇 open-knowledge 並開啟它的 .cursor/mcp.json 來源;在你開啟之前,{agent} 會讓專案伺服器保持關閉。"
+msgstr "如果 {agent} 沒有顯示 OpenKnowledge 工具,請開啟 Customize → MCPs,選擇 {server} 並開啟它的 .cursor/mcp.json 來源;在你開啟之前,{agent} 會讓專案伺服器保持關閉。"
#. js-lingui-explicit-id
#: src/lib/agent-guidance-copy.ts
@@ -12037,8 +12037,8 @@ msgid "Replace these symlinks with independent copies?"
msgstr "要把這些符號連結換成獨立的副本嗎?"
#: src/components/settings/AgentConnectionDialogs.tsx
-msgid "Replaces the existing \"open-knowledge\" entry in this file. Other servers in the file are left alone."
-msgstr "取代此檔案中現有的 \"open-knowledge\" 項目。檔案中的其他伺服器維持不變。"
+msgid "Replaces the existing {server} entry in this file. Other servers in the file are left alone."
+msgstr "取代此檔案中現有的 {server} 項目。檔案中的其他伺服器維持不變。"
#. placeholder {0}: formatToolList( replacing.map((e) => e.label), i18n.locale, )
#: src/components/McpConsentDialogBody.tsx
diff --git a/packages/app/tests/stress/fixtures/handoff-mocks.ts b/packages/app/tests/stress/fixtures/handoff-mocks.ts
index 199ded88e..e45c33db9 100644
--- a/packages/app/tests/stress/fixtures/handoff-mocks.ts
+++ b/packages/app/tests/stress/fixtures/handoff-mocks.ts
@@ -562,6 +562,7 @@ export async function installHandoffMocks(page: Page, cfg: HandoffMockConfig): P
platform: 'darwin' as const,
appVersion: 'test-0.0.0',
instanceLabel: null,
+ mcpServerName: null,
getPathForFile: () => null,
setDisplayLockCrashKey: () => undefined,
} satisfies OkDesktopBridge;
diff --git a/packages/cli/src/commands/channel-mcp-key.test.ts b/packages/cli/src/commands/channel-mcp-key.test.ts
new file mode 100644
index 000000000..6301f10fd
--- /dev/null
+++ b/packages/cli/src/commands/channel-mcp-key.test.ts
@@ -0,0 +1,233 @@
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { dirname, join } from 'node:path';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import {
+ buildPiExtensionSource,
+ isOwnPiExtensionSource,
+ isPiExtensionSourceUpToDate,
+} from '../integrations/pi-extension.ts';
+import {
+ buildManagedServerEntry,
+ CHAIN_V2,
+ CHAIN_WIN_V1,
+ EDITOR_TARGETS,
+ isEntryUpToDate,
+ isOwnManagedEntry,
+} from './editors.ts';
+import { writeEditorMcpConfig } from './init.ts';
+
+const STABLE_UNIX_CHAIN = `# ok-mcp-v2
+USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
+[ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
+BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
+[ -f "$BUNDLE" ] && [ -x "$BUNDLE" ] && exec "$BUNDLE" mcp
+DEB_BUNDLE="/opt/OpenKnowledge/resources/cli/bin/ok.sh"
+[ -f "$DEB_BUNDLE" ] && [ -x "$DEB_BUNDLE" ] && exec "$DEB_BUNDLE" mcp
+command -v npx >/dev/null 2>&1 && exec npx -y @inkeep/open-knowledge@latest mcp
+for d in "$HOME/.nvm/versions/node"/*/bin "$HOME/.fnm/node-versions"/*/installation/bin "$HOME/.asdf/installs/nodejs"/*/bin /opt/homebrew/bin /usr/local/bin "$HOME/.local/bin" "$HOME/.volta/bin"; do
+ [ -f "$d/npx" ] && [ -x "$d/npx" ] && exec "$d/npx" -y @inkeep/open-knowledge@latest mcp
+done
+echo "OpenKnowledge: install OK Desktop or Node.js 24+, then restart your editor" >&2
+exit 127`;
+
+const STABLE_WIN_CHAIN = `# ok-mcp-win-v1
+if ($env:PATHEXT -notmatch 'CMD') { $env:PATHEXT = '.COM;.EXE;.BAT;.CMD;' + $env:PATHEXT }
+if ($env:APPDATA) {
+ $shim = Join-Path $env:APPDATA 'npm\\ok.cmd'
+ if (Test-Path -LiteralPath $shim -PathType Leaf) { & $shim mcp; exit $LASTEXITCODE }
+}
+$ok = Get-Command ok.cmd -CommandType Application -ErrorAction SilentlyContinue
+if ($ok) { & $ok.Source mcp; exit $LASTEXITCODE }
+$npx = Get-Command npx.cmd -CommandType Application -ErrorAction SilentlyContinue
+if ($npx) { & $npx.Source -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
+$dirs = @()
+if ($env:ProgramFiles) { $dirs += Join-Path $env:ProgramFiles 'nodejs' }
+if ($env:NVM_SYMLINK) { $dirs += $env:NVM_SYMLINK }
+if ($env:LOCALAPPDATA) {
+ $dirs += Join-Path $env:LOCALAPPDATA 'fnm\\aliases\\default'
+ $dirs += Join-Path $env:LOCALAPPDATA 'Volta\\bin'
+ $dirs += Join-Path $env:LOCALAPPDATA 'pnpm'
+}
+if ($env:USERPROFILE) { $dirs += Join-Path $env:USERPROFILE 'scoop\\shims' }
+foreach ($d in $dirs) {
+ $probe = Join-Path $d 'npx.cmd'
+ if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
+}
+[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
+exit 127`;
+
+const BETA_UNIX_CHAIN = `# ok-mcp-beta-v2
+export OK_CHANNEL=beta
+USER_BUNDLE="$HOME/Applications/OpenKnowledge Beta.app/Contents/Resources/cli/bin/ok.sh"
+[ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
+BUNDLE="/Applications/OpenKnowledge Beta.app/Contents/Resources/cli/bin/ok.sh"
+[ -f "$BUNDLE" ] && [ -x "$BUNDLE" ] && exec "$BUNDLE" mcp
+DEB_BUNDLE="/opt/OpenKnowledge Beta/resources/cli/bin/ok.sh"
+[ -f "$DEB_BUNDLE" ] && [ -x "$DEB_BUNDLE" ] && exec "$DEB_BUNDLE" mcp
+command -v npx >/dev/null 2>&1 && exec npx -y @inkeep/open-knowledge@beta mcp
+for d in "$HOME/.nvm/versions/node"/*/bin "$HOME/.fnm/node-versions"/*/installation/bin "$HOME/.asdf/installs/nodejs"/*/bin /opt/homebrew/bin /usr/local/bin "$HOME/.local/bin" "$HOME/.volta/bin"; do
+ [ -f "$d/npx" ] && [ -x "$d/npx" ] && exec "$d/npx" -y @inkeep/open-knowledge@beta mcp
+done
+echo "OpenKnowledge: install OK Desktop or Node.js 24+, then restart your editor" >&2
+exit 127`;
+
+const BETA_WIN_CHAIN = `# ok-mcp-beta-win-v1
+$env:OK_CHANNEL = 'beta'
+if ($env:PATHEXT -notmatch 'CMD') { $env:PATHEXT = '.COM;.EXE;.BAT;.CMD;' + $env:PATHEXT }
+if ($env:APPDATA) {
+ $shim = Join-Path $env:APPDATA 'npm\\ok-beta.cmd'
+ if (Test-Path -LiteralPath $shim -PathType Leaf) { & $shim mcp; exit $LASTEXITCODE }
+}
+$ok = Get-Command ok-beta.cmd -CommandType Application -ErrorAction SilentlyContinue
+if ($ok) { & $ok.Source mcp; exit $LASTEXITCODE }
+$npx = Get-Command npx.cmd -CommandType Application -ErrorAction SilentlyContinue
+if ($npx) { & $npx.Source -y '@inkeep/open-knowledge@beta' mcp; exit $LASTEXITCODE }
+$dirs = @()
+if ($env:ProgramFiles) { $dirs += Join-Path $env:ProgramFiles 'nodejs' }
+if ($env:NVM_SYMLINK) { $dirs += $env:NVM_SYMLINK }
+if ($env:LOCALAPPDATA) {
+ $dirs += Join-Path $env:LOCALAPPDATA 'fnm\\aliases\\default'
+ $dirs += Join-Path $env:LOCALAPPDATA 'Volta\\bin'
+ $dirs += Join-Path $env:LOCALAPPDATA 'pnpm'
+}
+if ($env:USERPROFILE) { $dirs += Join-Path $env:USERPROFILE 'scoop\\shims' }
+foreach ($d in $dirs) {
+ $probe = Join-Path $d 'npx.cmd'
+ if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@beta' mcp; exit $LASTEXITCODE }
+}
+[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge@beta), then restart your editor')
+exit 127`;
+
+describe('per-channel MCP registration', () => {
+ let home: string;
+
+ beforeEach(() => {
+ home = mkdtempSync(join(tmpdir(), 'ok-channel-key-'));
+ });
+
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ rmSync(home, { recursive: true, force: true });
+ });
+
+ function writeClaude(): Record<string, unknown> {
+ const result = writeEditorMcpConfig(
+ EDITOR_TARGETS.claude,
+ '',
+ { mode: 'published', platformName: 'darwin', skipAvailabilityCheck: true },
+ home,
+ );
+ expect(result.action).not.toBe('failed');
+ return JSON.parse(readFileSync(EDITOR_TARGETS.claude.configPath('', home), 'utf-8')).mcpServers;
+ }
+
+ it('beta writes its own key and chain, leaving the stable entry byte-for-byte', () => {
+ writeClaude();
+ const stableEntry = JSON.stringify(
+ JSON.parse(readFileSync(EDITOR_TARGETS.claude.configPath('', home), 'utf-8')).mcpServers[
+ 'open-knowledge'
+ ],
+ );
+
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const servers = writeClaude();
+
+ expect(JSON.stringify(servers['open-knowledge'])).toBe(stableEntry);
+ const beta = servers['open-knowledge-beta'] as { args: string[] };
+ expect(beta.args[2]).toMatch(/^# ok-mcp-beta-v2\n/);
+ expect(beta.args[2]).toContain('/Applications/OpenKnowledge Beta.app/');
+ expect(beta.args[2]).toContain('@inkeep/open-knowledge@beta mcp');
+ });
+
+ it('stable repair leaves the beta entry alone', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ writeClaude();
+ const path = EDITOR_TARGETS.claude.configPath('', home);
+ const betaEntry = JSON.stringify(
+ JSON.parse(readFileSync(path, 'utf-8')).mcpServers['open-knowledge-beta'],
+ );
+
+ vi.stubEnv('OK_CHANNEL', 'stable');
+ const servers = writeClaude();
+
+ expect(JSON.stringify(servers['open-knowledge-beta'])).toBe(betaEntry);
+ expect((servers['open-knowledge'] as { args: string[] }).args[2]).toBe(STABLE_UNIX_CHAIN);
+ });
+
+ it('stable chains are pinned byte-for-byte to the shipped launcher', () => {
+ expect(CHAIN_V2).toBe(STABLE_UNIX_CHAIN);
+ expect(CHAIN_WIN_V1).toBe(STABLE_WIN_CHAIN);
+ const unix = buildManagedServerEntry({ mode: 'published', platformName: 'darwin' });
+ const win = buildManagedServerEntry({ mode: 'published', platformName: 'win32' });
+ expect((unix.args as string[])[2]).toBe(STABLE_UNIX_CHAIN);
+ expect((win.args as string[])[3]).toBe(STABLE_WIN_CHAIN);
+ });
+
+ it('beta chains are pinned byte-for-byte so no launch target falls back to stable', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const unix = buildManagedServerEntry({ mode: 'published', platformName: 'linux' });
+ const win = buildManagedServerEntry({ mode: 'published', platformName: 'win32' });
+ expect((unix.args as string[])[2]).toBe(BETA_UNIX_CHAIN);
+ expect((win.args as string[])[3]).toBe(BETA_WIN_CHAIN);
+ });
+
+ it('each channel only counts its own chain as current and owned', () => {
+ const stableEntry = buildManagedServerEntry({ mode: 'published', platformName: 'darwin' });
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const betaEntry = buildManagedServerEntry({ mode: 'published', platformName: 'darwin' });
+ const betaWin = buildManagedServerEntry({ mode: 'published', platformName: 'win32' });
+
+ expect(isEntryUpToDate(betaEntry)).toBe(true);
+ expect(isOwnManagedEntry(betaEntry)).toBe(true);
+ expect(isEntryUpToDate(stableEntry)).toBe(false);
+ expect(isOwnManagedEntry(stableEntry)).toBe(false);
+ expect((betaWin.args as string[])[3]).toMatch(/^# ok-mcp-beta-win-v1\n/);
+ expect((betaWin.args as string[])[3]).toContain('Get-Command ok-beta.cmd');
+ expect((betaWin.args as string[])[3].split('\n')[1]).toBe("$env:OK_CHANNEL = 'beta'");
+ expect((betaEntry.args as string[])[2].split('\n')[1]).toBe('export OK_CHANNEL=beta');
+
+ vi.stubEnv('OK_CHANNEL', 'stable');
+ expect(isEntryUpToDate(betaEntry)).toBe(false);
+ expect(isOwnManagedEntry(betaEntry)).toBe(false);
+ });
+
+ it('beta writes a new entry even when the config already holds stable', () => {
+ const path = EDITOR_TARGETS.claude.configPath('', home);
+ mkdirSync(dirname(path), { recursive: true });
+ writeFileSync(
+ path,
+ JSON.stringify({ mcpServers: { 'open-knowledge': { command: 'custom' } } }),
+ 'utf-8',
+ );
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const servers = writeClaude();
+ expect(servers['open-knowledge']).toEqual({ command: 'custom' });
+ expect(servers['open-knowledge-beta']).toBeDefined();
+ });
+
+ it('each channel owns its own Pi bridge file and never claims the other one', () => {
+ const stableSource = buildPiExtensionSource({ mode: 'published' });
+ const stablePath = EDITOR_TARGETS.pi.projectConfigPath('/p');
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const betaSource = buildPiExtensionSource({ mode: 'published' });
+ const betaPath = EDITOR_TARGETS.pi.projectConfigPath('/p');
+
+ expect(stablePath).toBe(join('/p', '.pi', 'extensions', 'open-knowledge.ts'));
+ expect(betaPath).toBe(join('/p', '.pi', 'extensions', 'open-knowledge-beta.ts'));
+ expect(betaSource.split('\n')[0]).toBe('// ok-pi-bridge-beta-v1');
+ expect(betaSource).toContain('# ok-mcp-beta-v2');
+ expect(betaSource).toContain('const TOOL_PREFIX = "ok-beta_"');
+ expect(stableSource).toContain('const TOOL_PREFIX = "ok_"');
+ expect(isOwnPiExtensionSource(betaSource)).toBe(true);
+ expect(isPiExtensionSourceUpToDate(betaSource)).toBe(true);
+ expect(isOwnPiExtensionSource(stableSource)).toBe(false);
+ expect(isPiExtensionSourceUpToDate(stableSource)).toBe(false);
+
+ vi.stubEnv('OK_CHANNEL', 'stable');
+ expect(stableSource.split('\n')[0]).toBe('// ok-pi-bridge-v1');
+ expect(isOwnPiExtensionSource(stableSource)).toBe(true);
+ expect(isOwnPiExtensionSource(betaSource)).toBe(false);
+ expect(isPiExtensionSourceUpToDate(betaSource)).toBe(false);
+ });
+});
diff --git a/packages/cli/src/commands/editors.ts b/packages/cli/src/commands/editors.ts
index 4b85e8987..baa22d118 100644
--- a/packages/cli/src/commands/editors.ts
+++ b/packages/cli/src/commands/editors.ts
@@ -6,8 +6,16 @@ import {
EDITOR_LABELS as CORE_EDITOR_LABELS,
HOSTS_WITH_USER_SKILL_DIR as CORE_HOSTS_WITH_USER_SKILL_DIR,
type EditorId as CoreEditorId,
+ currentDesktopProduct,
+ currentMcpServerName,
+ DESKTOP_PRODUCTS,
+ type DesktopProduct,
+ type DesktopProductName,
+ mcpChainMarkerPrefix,
+ OK_CHANNEL_ENV,
+ piExtensionProjectPath,
+ resolveDesktopProductName,
} from '@inkeep/open-knowledge-core';
-import { MCP_SERVER_NAME } from '@inkeep/open-knowledge-server';
import { getTomlConfigEngine } from '../native/toml-config-engine.ts';
export type EditorId = CoreEditorId;
@@ -21,38 +29,56 @@ const DEV_MCP_ENV = {
OK_LOG_FILE: '/tmp/ok-mcp.log',
} as const;
-export const CHAIN_VERSION_SENTINEL = '# ok-mcp-v2';
+const UNIX_CHAIN_REVISION = 2;
+const WIN_CHAIN_REVISION = 1;
-export const CHAIN_V2 = `# ok-mcp-v2
-USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
+const OK_MCP_CHAIN_MARKER = '# ok-mcp';
+
+const OK_PACKAGE_SPEC = '@inkeep/open-knowledge';
+
+function unixChainSentinel(product: DesktopProduct): string {
+ return `${mcpChainMarkerPrefix('unix-chain', product.mcpChainTag)}${UNIX_CHAIN_REVISION}`;
+}
+
+function winChainSentinel(product: DesktopProduct): string {
+ return `${mcpChainMarkerPrefix('windows-chain', product.mcpChainTag)}${WIN_CHAIN_REVISION}`;
+}
+
+function buildUnixChain(name: DesktopProductName): string {
+ const product = DESKTOP_PRODUCTS[name];
+ const npxSpec = `${OK_PACKAGE_SPEC}@${product.npmDistTag}`;
+ const channelLine = name === 'stable' ? '' : `\nexport ${OK_CHANNEL_ENV}=${name}`;
+ return `${unixChainSentinel(product)}${channelLine}
+USER_BUNDLE="$HOME/Applications/${product.productName}.app/Contents/Resources/cli/bin/ok.sh"
[ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
-BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
+BUNDLE="/Applications/${product.productName}.app/Contents/Resources/cli/bin/ok.sh"
[ -f "$BUNDLE" ] && [ -x "$BUNDLE" ] && exec "$BUNDLE" mcp
-DEB_BUNDLE="/opt/OpenKnowledge/resources/cli/bin/ok.sh"
+DEB_BUNDLE="/opt/${product.productName}/resources/cli/bin/ok.sh"
[ -f "$DEB_BUNDLE" ] && [ -x "$DEB_BUNDLE" ] && exec "$DEB_BUNDLE" mcp
-command -v npx >/dev/null 2>&1 && exec npx -y @inkeep/open-knowledge@latest mcp
+command -v npx >/dev/null 2>&1 && exec npx -y ${npxSpec} mcp
for d in "$HOME/.nvm/versions/node"/*/bin "$HOME/.fnm/node-versions"/*/installation/bin "$HOME/.asdf/installs/nodejs"/*/bin /opt/homebrew/bin /usr/local/bin "$HOME/.local/bin" "$HOME/.volta/bin"; do
- [ -f "$d/npx" ] && [ -x "$d/npx" ] && exec "$d/npx" -y @inkeep/open-knowledge@latest mcp
+ [ -f "$d/npx" ] && [ -x "$d/npx" ] && exec "$d/npx" -y ${npxSpec} mcp
done
echo "OpenKnowledge: install OK Desktop or Node.js 24+, then restart your editor" >&2
exit 127`;
+}
-export const CHAIN_WIN_VERSION_SENTINEL = '# ok-mcp-win-v1';
-
-const OK_MCP_CHAIN_MARKER = '# ok-mcp';
-
-const OK_PACKAGE_SPEC = '@inkeep/open-knowledge';
-
-export const CHAIN_WIN_V1 = `# ok-mcp-win-v1
+function buildWinChain(name: DesktopProductName): string {
+ const product = DESKTOP_PRODUCTS[name];
+ const npxSpec = `${OK_PACKAGE_SPEC}@${product.npmDistTag}`;
+ const cmd = `${product.cliCommandNames[0]}.cmd`;
+ const installSpec = product.npmDistTag === 'latest' ? OK_PACKAGE_SPEC : npxSpec;
+ const channelLine = name === 'stable' ? '' : `\n$env:${OK_CHANNEL_ENV} = '${name}'`;
+ return `${winChainSentinel(product)}${channelLine}
if ($env:PATHEXT -notmatch 'CMD') { $env:PATHEXT = '.COM;.EXE;.BAT;.CMD;' + $env:PATHEXT }
if ($env:APPDATA) {
- $shim = Join-Path $env:APPDATA 'npm\\ok.cmd'
+ $shim = Join-Path $env:APPDATA 'npm\\${cmd}'
if (Test-Path -LiteralPath $shim -PathType Leaf) { & $shim mcp; exit $LASTEXITCODE }
}
-$ok = Get-Command ok.cmd -CommandType Application -ErrorAction SilentlyContinue
+$ok = Get-Command ${cmd} -CommandType Application -ErrorAction SilentlyContinue
if ($ok) { & $ok.Source mcp; exit $LASTEXITCODE }
$npx = Get-Command npx.cmd -CommandType Application -ErrorAction SilentlyContinue
-if ($npx) { & $npx.Source -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
+if ($npx) { & $npx.Source -y '${npxSpec}' mcp; exit $LASTEXITCODE }
$dirs = @()
if ($env:ProgramFiles) { $dirs += Join-Path $env:ProgramFiles 'nodejs' }
if ($env:NVM_SYMLINK) { $dirs += $env:NVM_SYMLINK }
@@ -64,14 +90,31 @@ if ($env:LOCALAPPDATA) {
if ($env:USERPROFILE) { $dirs += Join-Path $env:USERPROFILE 'scoop\\shims' }
foreach ($d in $dirs) {
$probe = Join-Path $d 'npx.cmd'
- if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
+ if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '${npxSpec}' mcp; exit $LASTEXITCODE }
}
-[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
+[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g ${installSpec}), then restart your editor')
exit 127`;
+}
+
+export const CHAIN_VERSION_SENTINEL = unixChainSentinel(DESKTOP_PRODUCTS.stable);
+
+export const CHAIN_V2 = buildUnixChain('stable');
+
+export const CHAIN_WIN_VERSION_SENTINEL = winChainSentinel(DESKTOP_PRODUCTS.stable);
+
+export const CHAIN_WIN_V1 = buildWinChain('stable');
+
+export function piExtensionOwnershipMarker(product: DesktopProduct): string {
+ return `// ok-pi-bridge${product.mcpChainTag}`;
+}
+
+export function piExtensionVersionSentinel(product: DesktopProduct): string {
+ return `${piExtensionOwnershipMarker(product)}-v1`;
+}
-export const PI_EXTENSION_OWNERSHIP_MARKER = '// ok-pi-bridge';
+export const PI_EXTENSION_OWNERSHIP_MARKER = piExtensionOwnershipMarker(DESKTOP_PRODUCTS.stable);
-export const PI_EXTENSION_VERSION_SENTINEL = `${PI_EXTENSION_OWNERSHIP_MARKER}-v1`;
+export const PI_EXTENSION_VERSION_SENTINEL = piExtensionVersionSentinel(DESKTOP_PRODUCTS.stable);
export const PI_MANAGED_FILE_ENTRY_COMMAND = 'ok-pi-managed-extension';
@@ -88,13 +131,14 @@ export interface McpInstallOptions {
export function isEntryUpToDate(entry: unknown): boolean {
if (typeof entry !== 'object' || entry === null) return false;
+ const product = currentDesktopProduct();
const e = entry as Record<string, unknown>;
if (e.command === '/bin/sh') {
if (!Array.isArray(e.args)) return false;
if (e.args[0] !== '-l' || e.args[1] !== '-c') return false;
const body = e.args[2];
- return scriptBodyOpensWith(body, CHAIN_VERSION_SENTINEL);
+ return scriptBodyOpensWith(body, unixChainSentinel(product));
}
if (e.command === 'powershell') {
@@ -103,14 +147,14 @@ export function isEntryUpToDate(entry: unknown): boolean {
return false;
}
const body = e.args[3];
- return scriptBodyOpensWith(body, CHAIN_WIN_VERSION_SENTINEL);
+ return scriptBodyOpensWith(body, winChainSentinel(product));
}
if (e.type === 'local' && Array.isArray(e.command)) {
if (e.command[0] === '/bin/sh') {
if (e.command[1] !== '-l' || e.command[2] !== '-c') return false;
const body = e.command[3];
- return scriptBodyOpensWith(body, CHAIN_VERSION_SENTINEL);
+ return scriptBodyOpensWith(body, unixChainSentinel(product));
}
if (e.command[0] === 'powershell') {
if (
@@ -121,7 +165,7 @@ export function isEntryUpToDate(entry: unknown): boolean {
return false;
}
const body = e.command[4];
- return scriptBodyOpensWith(body, CHAIN_WIN_VERSION_SENTINEL);
+ return scriptBodyOpensWith(body, winChainSentinel(product));
}
return false;
}
@@ -129,7 +173,7 @@ export function isEntryUpToDate(entry: unknown): boolean {
if (e.command === PI_MANAGED_FILE_ENTRY_COMMAND) {
if (!Array.isArray(e.args)) return false;
const text = e.args[0];
- return typeof text === 'string' && text.startsWith(PI_EXTENSION_VERSION_SENTINEL);
+ return typeof text === 'string' && text.startsWith(piExtensionVersionSentinel(product));
}
return false;
@@ -173,12 +217,17 @@ export function buildManagedServerEntry(options: McpInstallOptions = {}): Record
if (platformName === 'win32') {
return {
command: 'powershell',
- args: ['-NoProfile', '-NonInteractive', '-Command', CHAIN_WIN_V1],
+ args: [
+ '-NoProfile',
+ '-NonInteractive',
+ '-Command',
+ buildWinChain(resolveDesktopProductName()),
+ ],
};
}
return {
command: '/bin/sh',
- args: ['-l', '-c', CHAIN_V2],
+ args: ['-l', '-c', buildUnixChain(resolveDesktopProductName())],
};
}
@@ -197,13 +246,19 @@ function buildOpenCodeEntry(options: McpInstallOptions = {}): Record<string, unk
return {
type: 'local',
enabled: true,
- command: ['powershell', '-NoProfile', '-NonInteractive', '-Command', CHAIN_WIN_V1],
+ command: [
+ 'powershell',
+ '-NoProfile',
+ '-NonInteractive',
+ '-Command',
+ buildWinChain(resolveDesktopProductName()),
+ ],
};
}
return {
type: 'local',
enabled: true,
- command: ['/bin/sh', '-l', '-c', CHAIN_V2],
+ command: ['/bin/sh', '-l', '-c', buildUnixChain(resolveDesktopProductName())],
};
}
@@ -567,7 +622,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveClaudeCodeConfigPath({ home }),
format: 'json',
topLevelKey: 'mcpServers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => join(home ?? homedir(), '.claude'),
@@ -580,7 +635,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveClaudeDesktopConfigPath({ home }),
format: 'json',
topLevelKey: 'mcpServers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => dirname(resolveClaudeDesktopConfigPath({ home })),
@@ -591,7 +646,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveCursorConfigPath({ home }),
format: 'json',
topLevelKey: 'mcpServers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => dirname(resolveCursorConfigPath({ home })),
@@ -604,7 +659,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveCodexConfigPath({ home }),
format: 'toml',
topLevelKey: 'mcp_servers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => dirname(resolveCodexConfigPath({ home })),
@@ -617,7 +672,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveCopilotConfigPath({ home }),
format: 'json',
topLevelKey: 'mcpServers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => dirname(resolveCopilotConfigPath({ home })),
@@ -629,7 +684,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveOpenCodeConfigPath({ home }),
format: 'json',
topLevelKey: 'mcp',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildOpenCodeEntry(options),
scope: 'global',
detectPath: (_cwd, home) => dirname(resolveOpenCodeConfigPath({ home })),
@@ -643,7 +698,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
format: 'json',
topLevelKey: 'mcp',
serverMapSubKey: 'servers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => join(home ?? homedir(), '.openclaw'),
@@ -654,15 +709,15 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
label: EDITOR_LABELS.pi,
configPath: () => {
throw new Error(
- "Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).",
+ `Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at ${piExtensionProjectPath(currentDesktopProduct())} (run \`ok init\` in the project).`,
);
},
format: 'file',
topLevelKey: 'mcpServers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
scope: 'project',
detectPath: (_cwd, home) => resolvePiAgentDirPath({ home }),
- projectConfigPath: (cwd) => join(cwd, '.pi', 'extensions', 'open-knowledge.ts'),
+ projectConfigPath: (cwd) => join(cwd, piExtensionProjectPath(currentDesktopProduct())),
projectSkillPath: (cwd) => join(cwd, '.pi', 'skills', 'open-knowledge', 'SKILL.md'),
},
antigravity: {
@@ -671,7 +726,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveAntigravityConfigPath({ home }),
format: 'json',
topLevelKey: 'mcpServers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => join(home ?? homedir(), '.gemini'),
@@ -683,7 +738,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveLmStudioConfigPath({ home }),
format: 'json',
topLevelKey: 'mcpServers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => dirname(resolveLmStudioConfigPath({ home })),
@@ -695,7 +750,7 @@ export const EDITOR_TARGETS: Record<EditorId, EditorMcpTarget> & { pi: ManagedFi
configPath: (_cwd, home) => resolveHermesConfigPath({ home }),
format: 'yaml',
topLevelKey: 'mcp_servers',
- serverName: () => MCP_SERVER_NAME,
+ serverName: () => currentMcpServerName(),
buildEntry: (_cwd, options) => buildManagedServerEntry(options),
scope: 'global',
detectPath: (_cwd, home) => join(home ?? homedir(), '.hermes'),
diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts
index 6ab4bdb87..64e10e297 100644
--- a/packages/cli/src/commands/init.ts
+++ b/packages/cli/src/commands/init.ts
@@ -3,6 +3,7 @@ import { homedir } from 'node:os';
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
import { inspect } from 'node:util';
import {
+ currentMcpServerName,
type McpLauncherDeclineReason,
OPENKNOWLEDGE_SKILLS_REPO,
} from '@inkeep/open-knowledge-core';
@@ -21,7 +22,6 @@ import {
HomeProjectRootError,
initContent,
installUserSkill,
- MCP_SERVER_NAME,
ONBOARDING_BUNDLE_IDS,
ProjectGitInitError,
removeProjectSkillGitignoreBlock,
@@ -1562,7 +1562,8 @@ export function formatInitResult(result: InitCommandResult, cwd: string): string
const displayPath = editor.configPath.startsWith(cwd)
? relative(cwd, editor.configPath)
: editor.configPath.replace(/^\/Users\/[^/]+/, '~');
- const serverNameNote = editor.serverName === MCP_SERVER_NAME ? '' : ` (${editor.serverName})`;
+ const serverNameNote =
+ editor.serverName === currentMcpServerName() ? '' : ` (${editor.serverName})`;
const scopeTag = editor.configScope === 'project' ? ' (project)' : '';
const labelWithScope = `${editor.label}${scopeTag}`;
const pad = ' '.repeat(Math.max(1, 20 - labelWithScope.length));
diff --git a/packages/cli/src/commands/mcp-chain-validation.test.ts b/packages/cli/src/commands/mcp-chain-validation.test.ts
index 55c579722..20ff0d776 100644
--- a/packages/cli/src/commands/mcp-chain-validation.test.ts
+++ b/packages/cli/src/commands/mcp-chain-validation.test.ts
@@ -2,8 +2,22 @@ import { spawnSync } from 'node:child_process';
import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
-import { describe, expect, it } from 'vitest';
-import { CHAIN_V2 } from './editors.ts';
+import { DESKTOP_PRODUCTS, type DesktopProductName } from '@inkeep/open-knowledge-core';
+import { describe, expect, it, vi } from 'vitest';
+import { buildManagedServerEntry } from './editors.ts';
+
+const CHANNELS = ['stable', 'beta'] as const satisfies readonly DesktopProductName[];
+
+function chainFor(channel: DesktopProductName): string {
+ vi.stubEnv('OK_CHANNEL', channel);
+ try {
+ const args = buildManagedServerEntry({ mode: 'published', platformName: 'darwin' }).args;
+ if (!Array.isArray(args) || typeof args[2] !== 'string') throw new Error('expected a chain');
+ return args[2];
+ } finally {
+ vi.unstubAllEnvs();
+ }
+}
const SKIP_PERSONA = process.platform !== 'darwin';
@@ -25,22 +39,23 @@ function replaceOrThrow(input: string, search: string | RegExp, replacement: str
return next;
}
-function instrumentChain(opts: InstrumentOpts = {}): string {
+function instrumentChain(channel: DesktopProductName, opts: InstrumentOpts = {}): string {
+ const product = DESKTOP_PRODUCTS[channel];
let chain = replaceOrThrow(
- CHAIN_V2,
+ chainFor(channel),
'exec "$USER_BUNDLE" mcp',
'echo "HIT:user-bundle:$USER_BUNDLE" && exit 0',
);
chain = replaceOrThrow(chain, 'exec "$BUNDLE" mcp', 'echo "HIT:bundle:$BUNDLE" && exit 0');
chain = replaceOrThrow(
chain,
- 'exec npx -y @inkeep/open-knowledge@latest mcp',
- 'echo "HIT:npx:$(command -v npx)" && exit 0',
+ `exec npx -y @inkeep/open-knowledge@${product.npmDistTag} mcp`,
+ 'echo "HIT:npx:$(command -v npx):channel=$OK_CHANNEL" && exit 0',
);
chain = replaceOrThrow(
chain,
- 'exec "$d/npx" -y @inkeep/open-knowledge@latest mcp',
- 'echo "HIT:glob:$d/npx" && exit 0',
+ `exec "$d/npx" -y @inkeep/open-knowledge@${product.npmDistTag} mcp`,
+ 'echo "HIT:glob:$d/npx:channel=$OK_CHANNEL" && exit 0',
);
if (opts.suppressNpxPath) {
chain = replaceOrThrow(
@@ -64,12 +79,12 @@ function instrumentChain(opts: InstrumentOpts = {}): string {
}
chain = replaceOrThrow(
chain,
- 'USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"',
+ `USER_BUNDLE="$HOME/Applications/${product.productName}.app/Contents/Resources/cli/bin/ok.sh"`,
`USER_BUNDLE="${opts.bundleOverride}__user_bundle__"`,
);
chain = replaceOrThrow(
chain,
- 'BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"',
+ `BUNDLE="/Applications/${product.productName}.app/Contents/Resources/cli/bin/ok.sh"`,
`BUNDLE="${opts.bundleOverride}"`,
);
}
@@ -79,11 +94,11 @@ function instrumentChain(opts: InstrumentOpts = {}): string {
interface RunOpts {
home: string;
path: string | null;
- chainOverride?: string;
+ chainOverride: string;
}
function runChain(opts: RunOpts): { stdout: string; stderr: string; status: number | null } {
- const chain = opts.chainOverride ?? instrumentChain();
+ const chain = opts.chainOverride;
const env: NodeJS.ProcessEnv = { HOME: opts.home };
if (opts.path !== null) env.PATH = opts.path;
const result = spawnSync('/bin/sh', ['-l', '-c', chain], { env, encoding: 'utf8' });
@@ -98,11 +113,11 @@ function setupTmp(label: string): string {
return mkdtempSync(join(tmpdir(), `mcp-chain-${label}-`));
}
-describe('CHAIN_V2 POSIX shell grammar (cross-platform)', () => {
+describe.each(CHANNELS)('%s chain POSIX shell grammar (cross-platform)', (channel) => {
it('bundle missing, no npx, no version-manager dirs → exit 127 + stderr', () => {
const tmpHome = setupTmp('nofall');
try {
- const chain = instrumentChain({
+ const chain = instrumentChain(channel, {
suppressNpxPath: true,
restrictGlobToHome: true,
bundleOverride: join(tmpHome, 'no-such-bundle.sh'),
@@ -124,7 +139,7 @@ describe('CHAIN_V2 POSIX shell grammar (cross-platform)', () => {
try {
const dirBundle = join(tmpHome, 'fake-bundle');
mkdirSync(dirBundle);
- const chain = instrumentChain({ bundleOverride: dirBundle });
+ const chain = instrumentChain(channel, { bundleOverride: dirBundle });
const { stdout } = runChain({ home: tmpHome, path: '/usr/bin:/bin', chainOverride: chain });
expect(stdout).not.toContain('HIT:bundle:');
} finally {
@@ -138,7 +153,7 @@ describe('CHAIN_V2 POSIX shell grammar (cross-platform)', () => {
const noxBundle = join(tmpHome, 'bundle.sh');
writeFileSync(noxBundle, '#!/bin/sh\necho should-not-run\n');
chmodSync(noxBundle, 0o644);
- const chain = instrumentChain({ bundleOverride: noxBundle });
+ const chain = instrumentChain(channel, { bundleOverride: noxBundle });
const { stdout } = runChain({ home: tmpHome, path: '/usr/bin:/bin', chainOverride: chain });
expect(stdout).not.toContain('HIT:bundle:');
} finally {
@@ -149,7 +164,7 @@ describe('CHAIN_V2 POSIX shell grammar (cross-platform)', () => {
it('unmatched glob does NOT abort the shell (regression for zsh-glob-error bug)', () => {
const tmpHome = setupTmp('zshglob');
try {
- const chain = instrumentChain({
+ const chain = instrumentChain(channel, {
suppressNpxPath: true,
restrictGlobToHome: true,
bundleOverride: join(tmpHome, 'no-such-bundle.sh'),
@@ -167,6 +182,32 @@ describe('CHAIN_V2 POSIX shell grammar (cross-platform)', () => {
}
});
+ it("the npx fallback runs with this chain's channel", () => {
+ const tmpHome = setupTmp('npxchannel');
+ try {
+ const bin = join(tmpHome, 'bin');
+ mkdirSync(bin);
+ const fakeNpx = join(bin, 'npx');
+ writeFileSync(fakeNpx, '#!/bin/sh\nexit 0\n');
+ chmodSync(fakeNpx, 0o755);
+ const chain = instrumentChain(channel, {
+ restrictGlobToHome: true,
+ bundleOverride: join(tmpHome, 'no-such-bundle.sh'),
+ });
+ const { stdout, status } = runChain({
+ home: tmpHome,
+ path: `${bin}:/usr/bin:/bin`,
+ chainOverride: chain,
+ });
+ expect(status).toBe(0);
+ expect(stdout).toContain(
+ `HIT:npx:${fakeNpx}:channel=${channel === 'stable' ? '' : channel}\n`,
+ );
+ } finally {
+ rmSync(tmpHome, { recursive: true, force: true });
+ }
+ });
+
it('bundle process crashes — exit code propagates, no fallback fires', () => {
const tmpHome = setupTmp('crash');
try {
@@ -174,14 +215,15 @@ describe('CHAIN_V2 POSIX shell grammar (cross-platform)', () => {
writeFileSync(crashBundle, '#!/bin/sh\nexit 42\n');
chmodSync(crashBundle, 0o755);
+ const productName = DESKTOP_PRODUCTS[channel].productName;
let chain = replaceOrThrow(
- CHAIN_V2,
- 'USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"',
+ chainFor(channel),
+ `USER_BUNDLE="$HOME/Applications/${productName}.app/Contents/Resources/cli/bin/ok.sh"`,
`USER_BUNDLE="${join(tmpHome, 'no-such-user-bundle.sh')}"`,
);
chain = replaceOrThrow(
chain,
- 'BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"',
+ `BUNDLE="/Applications/${productName}.app/Contents/Resources/cli/bin/ok.sh"`,
`BUNDLE="${crashBundle}"`,
);
const { stdout, status } = runChain({
@@ -197,46 +239,50 @@ describe('CHAIN_V2 POSIX shell grammar (cross-platform)', () => {
});
});
-describe.skipIf(SKIP_PERSONA)('CHAIN_V2 macOS persona behavior (darwin only)', () => {
- it('bundle missing, npx on login PATH → npx branch fires', () => {
- const tmpHome = setupTmp('npx');
- try {
- const { stdout, status } = runChain({
- home: tmpHome,
- path: '/usr/bin:/bin:/usr/sbin:/sbin',
- });
- expect([0, 127]).toContain(status ?? -1);
- if (status === 0) {
- expect(stdout).toMatch(/HIT:(bundle|npx|glob):/);
+describe.skipIf(SKIP_PERSONA).each(CHANNELS)(
+ '%s chain macOS persona behavior (darwin only)',
+ (channel) => {
+ it('bundle missing, npx on login PATH → npx branch fires', () => {
+ const tmpHome = setupTmp('npx');
+ try {
+ const { stdout, status } = runChain({
+ home: tmpHome,
+ path: '/usr/bin:/bin:/usr/sbin:/sbin',
+ chainOverride: instrumentChain(channel),
+ });
+ expect([0, 127]).toContain(status ?? -1);
+ if (status === 0) {
+ expect(stdout).toMatch(/HIT:(bundle|npx|glob):/);
+ }
+ } finally {
+ rmSync(tmpHome, { recursive: true, force: true });
}
- } finally {
- rmSync(tmpHome, { recursive: true, force: true });
- }
- });
+ });
- it('bundle missing, no npx on PATH, but version-manager glob fires', () => {
- const tmpHome = setupTmp('glob');
- try {
- const nvmBin = join(tmpHome, '.nvm', 'versions', 'node', 'v24.0.0', 'bin');
- mkdirSync(nvmBin, { recursive: true });
- const fakeNpx = join(nvmBin, 'npx');
- writeFileSync(fakeNpx, '#!/bin/sh\necho fake-npx-should-not-run\n');
- chmodSync(fakeNpx, 0o755);
+ it('bundle missing, no npx on PATH, but version-manager glob fires', () => {
+ const tmpHome = setupTmp('glob');
+ try {
+ const nvmBin = join(tmpHome, '.nvm', 'versions', 'node', 'v24.0.0', 'bin');
+ mkdirSync(nvmBin, { recursive: true });
+ const fakeNpx = join(nvmBin, 'npx');
+ writeFileSync(fakeNpx, '#!/bin/sh\necho fake-npx-should-not-run\n');
+ chmodSync(fakeNpx, 0o755);
- const chain = instrumentChain({
- suppressNpxPath: true,
- restrictGlobToHome: true,
- bundleOverride: join(tmpHome, 'no-such-bundle.sh'),
- });
- const { stdout, status } = runChain({
- home: tmpHome,
- path: '/usr/bin:/bin',
- chainOverride: chain,
- });
- expect(status).toBe(0);
- expect(stdout).toContain(`HIT:glob:${fakeNpx}`);
- } finally {
- rmSync(tmpHome, { recursive: true, force: true });
- }
- });
-});
+ const chain = instrumentChain(channel, {
+ suppressNpxPath: true,
+ restrictGlobToHome: true,
+ bundleOverride: join(tmpHome, 'no-such-bundle.sh'),
+ });
+ const { stdout, status } = runChain({
+ home: tmpHome,
+ path: '/usr/bin:/bin',
+ chainOverride: chain,
+ });
+ expect(status).toBe(0);
+ expect(stdout).toContain(`HIT:glob:${fakeNpx}`);
+ } finally {
+ rmSync(tmpHome, { recursive: true, force: true });
+ }
+ });
+ },
+);
diff --git a/packages/cli/src/integrations/pi-extension.ts b/packages/cli/src/integrations/pi-extension.ts
index 16b3bd915..a528202c8 100644
--- a/packages/cli/src/integrations/pi-extension.ts
+++ b/packages/cli/src/integrations/pi-extension.ts
@@ -1,19 +1,26 @@
+import {
+ currentDesktopProduct,
+ DESKTOP_PRODUCTS,
+ piToolNamespace,
+} from '@inkeep/open-knowledge-core';
import {
buildManagedServerEntry,
type McpInstallOptions,
- PI_EXTENSION_OWNERSHIP_MARKER,
- PI_EXTENSION_VERSION_SENTINEL,
PI_MANAGED_FILE_ENTRY_COMMAND,
+ piExtensionOwnershipMarker,
+ piExtensionVersionSentinel,
} from '../commands/editors.ts';
-const PI_EXTENSION_DEV_HEADER = `${PI_EXTENSION_OWNERSHIP_MARKER}-dev`;
-
export function isOwnPiExtensionSource(text: string): boolean {
- return text.startsWith(PI_EXTENSION_OWNERSHIP_MARKER);
+ const marker = piExtensionOwnershipMarker(currentDesktopProduct());
+ if (!text.startsWith(marker)) return false;
+ return Object.values(DESKTOP_PRODUCTS)
+ .map(piExtensionOwnershipMarker)
+ .every((other) => other.length <= marker.length || !text.startsWith(other));
}
export function isPiExtensionSourceUpToDate(text: string): boolean {
- return text.startsWith(PI_EXTENSION_VERSION_SENTINEL);
+ return text.startsWith(piExtensionVersionSentinel(currentDesktopProduct()));
}
export function isOwnPiManagedFileEntry(entry: unknown): boolean {
@@ -30,7 +37,11 @@ export function makePiManagedFileEntry(text: string): Record<string, unknown> {
export function buildPiExtensionSource(options: McpInstallOptions = {}): string {
const dev = options.mode === 'dev';
- const header = dev ? PI_EXTENSION_DEV_HEADER : PI_EXTENSION_VERSION_SENTINEL;
+ const product = currentDesktopProduct();
+ const header = dev
+ ? `${piExtensionOwnershipMarker(product)}-dev`
+ : piExtensionVersionSentinel(product);
+ const toolPrefix = `${piToolNamespace(product)}_`;
const launchers = {
unix: buildManagedServerEntry({ ...options, platformName: 'darwin' }),
win32: buildManagedServerEntry({ ...options, platformName: 'win32' }),
@@ -44,7 +55,7 @@ export function buildPiExtensionSource(options: McpInstallOptions = {}): string
* On session start it spawns Open Knowledge's MCP stdio server via OK's
* resilient launcher (bundle, then npx, then version-manager probes), performs
* the MCP handshake, and registers each MCP tool as a Pi tool under an
- * \`ok_\` prefix (Pi has no MCP namespacing; the prefix keeps OK's \`edit\` /
+ * \`${toolPrefix}\` prefix (Pi has no MCP namespacing; the prefix keeps OK's \`edit\` /
* \`write\` from shadowing Pi's built-in tools).
*/
import { spawn } from "node:child_process";
@@ -52,7 +63,7 @@ import type { ChildProcessWithoutNullStreams } from "node:child_process";
const LAUNCHERS = ${JSON.stringify(launchers, null, 2)} as const;
-const TOOL_PREFIX = "ok_";
+const TOOL_PREFIX = ${JSON.stringify(toolPrefix)};
// First contact may cold-install the CLI through npx — allow a generous window.
const INIT_TIMEOUT_MS = 120000;
const STDERR_TAIL_LIMIT = 2000;
diff --git a/packages/cli/src/integrations/registry-apply.test.ts b/packages/cli/src/integrations/registry-apply.test.ts
index 6e9303a0f..2122d5d55 100644
--- a/packages/cli/src/integrations/registry-apply.test.ts
+++ b/packages/cli/src/integrations/registry-apply.test.ts
@@ -20,7 +20,7 @@ import {
type SatisfierId,
} from '@inkeep/open-knowledge-core';
import { loggerFactory, logsCurrentPath } from '@inkeep/open-knowledge-server';
-import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { EDITOR_TARGETS } from '../commands/editors.ts';
import { ensurePiBridge, probePiBridgeState } from '../commands/pi-acp-bridge.ts';
import { type CliWriteContext, createCliStepExecutor } from './registry-apply.ts';
@@ -170,6 +170,28 @@ it.skipIf(process.platform === 'win32' || process.getuid?.() === 0)(
},
);
+describe('a Beta Pi bridge', () => {
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
+ it('is written beside a Stable bridge without touching it, and only its own file reads back satisfied', async () => {
+ const stablePath = join(ctx.cwd, '.pi', 'extensions', 'open-knowledge.ts');
+ const betaPath = join(ctx.cwd, '.pi', 'extensions', 'open-knowledge-beta.ts');
+ await run([{ satisfierId: 'pi/mcp/project/managed-file', desired: 'present' }]);
+ const stableBytes = readFileSync(stablePath, 'utf-8');
+
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ expect(await stateOf('pi/mcp/project/managed-file')).not.toBe('satisfied');
+ const report = await run([{ satisfierId: 'pi/mcp/project/managed-file', desired: 'present' }]);
+
+ expect(actionFor(report, 'pi/mcp/project/managed-file')?.action).toBe('written');
+ expect(readFileSync(stablePath, 'utf-8')).toBe(stableBytes);
+ expect(readFileSync(betaPath, 'utf-8').split('\n')[0]).toBe('// ok-pi-bridge-beta-v1');
+ expect(await stateOf('pi/mcp/project/managed-file')).toBe('satisfied');
+ });
+});
+
describe('a project MCP artifact', () => {
it('is written by the same primitive a single toggle uses, and reads back satisfied', async () => {
const report = await run([
diff --git a/packages/cli/src/integrations/registry-apply.ts b/packages/cli/src/integrations/registry-apply.ts
index 4a13201ee..1433befda 100644
--- a/packages/cli/src/integrations/registry-apply.ts
+++ b/packages/cli/src/integrations/registry-apply.ts
@@ -1,7 +1,5 @@
import { homedir } from 'node:os';
-import { join } from 'node:path';
import {
- EDITOR_PROJECT_CONFIG_PATH,
type EditorId,
type ExecutedOutcome,
type PlannedStep,
@@ -129,9 +127,8 @@ function applyProjectMcp(
ctx: CliWriteContext,
desired: PlannedStep['desired'],
): ExecutedOutcome {
- const relative = EDITOR_PROJECT_CONFIG_PATH[editor];
- if (relative === null) return missing();
- const projectPath = join(ctx.cwd, relative);
+ const projectPath = EDITOR_TARGETS[editor].projectConfigPath?.(ctx.cwd);
+ if (projectPath === undefined) return missing();
if (desired === 'absent') {
return removeMcp(editor, ctx.cwd, ctx.home, projectPath, ctx.env);
diff --git a/packages/cli/src/integrations/registry-probes.ts b/packages/cli/src/integrations/registry-probes.ts
index 4847dc795..16fdec053 100644
--- a/packages/cli/src/integrations/registry-probes.ts
+++ b/packages/cli/src/integrations/registry-probes.ts
@@ -4,7 +4,6 @@ import { join } from 'node:path';
import {
AGENTS_SKILLS_ROOT,
buildProbeSnapshot,
- EDITOR_PROJECT_CONFIG_PATH,
EDITOR_PROJECT_SKILL_ROOT,
EDITOR_USER_SKILL_ROOT,
type EditorId,
@@ -197,10 +196,10 @@ export function createCliProbeResolver(ctx: CliProbeContext): ProbeResolver {
case 'editor-user-config':
return mcpEntryAnswer(editor, item.strictness, cwd, home);
case 'editor-project-config': {
- const relative = EDITOR_PROJECT_CONFIG_PATH[editor];
- return relative === null
+ const projectPath = EDITOR_TARGETS[editor].projectConfigPath?.(cwd);
+ return projectPath === undefined
? null
- : mcpEntryAnswer(editor, item.strictness, cwd, home, join(cwd, relative));
+ : mcpEntryAnswer(editor, item.strictness, cwd, home, projectPath);
}
}
};
diff --git a/packages/core/src/acp/tool-call-input.test.ts b/packages/core/src/acp/tool-call-input.test.ts
index 04e44ba23..a0feb95f5 100644
--- a/packages/core/src/acp/tool-call-input.test.ts
+++ b/packages/core/src/acp/tool-call-input.test.ts
@@ -66,12 +66,20 @@ describe('identifyOpenKnowledgeToolCall', () => {
for (const title of [
'mcp__open-knowledge__write',
'mcp__open-knowledge-dev__write',
+ 'mcp__open-knowledge-beta__write',
'mcp.open_knowledge.write',
'ok_write',
+ 'ok-beta_write',
]) {
expect(identifyOpenKnowledgeToolCall({ title, rawInput: {} }, 'known')?.tool).toBe('write');
}
- for (const title of ['mcp__ok__write', 'mcp__ok-dev__write', 'mcp.ok.write', 'ok-dev_write']) {
+ for (const title of [
+ 'mcp__ok__write',
+ 'mcp__ok-dev__write',
+ 'mcp.ok.write',
+ 'ok-dev_write',
+ 'mcp__open-knowledge-payments__write',
+ ]) {
expect(identifyOpenKnowledgeToolCall({ title, rawInput: {} }, 'known')).toBeNull();
}
expect(
diff --git a/packages/core/src/acp/tool-call-input.ts b/packages/core/src/acp/tool-call-input.ts
index 7f4763ffa..47b294131 100644
--- a/packages/core/src/acp/tool-call-input.ts
+++ b/packages/core/src/acp/tool-call-input.ts
@@ -1,4 +1,10 @@
-import { OPEN_KNOWLEDGE_MCP_TOOLS, type OpenKnowledgeMcpTool } from '../constants/mcp.ts';
+import { piToolNamespace } from '../constants/editors.ts';
+import {
+ MCP_SERVER_NAME,
+ OPEN_KNOWLEDGE_MCP_TOOLS,
+ type OpenKnowledgeMcpTool,
+} from '../constants/mcp.ts';
+import { DESKTOP_PRODUCTS } from '../constants/product.ts';
export function asRecord(value: unknown): Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value)
@@ -50,9 +56,20 @@ const OPEN_KNOWLEDGE_TOOLS: ReadonlySet<string> = new Set(OPEN_KNOWLEDGE_MCP_TOO
const ANY_OPEN_KNOWLEDGE_SERVER = /^(?:open[-_ ]?knowledge|ok)(?:[-_][a-z]+)*$/;
-const KNOWN_OPEN_KNOWLEDGE_SERVER = /^open[-_ ]?knowledge(?:-dev)?$/;
+const KNOWN_SERVER_SUFFIXES = [
+ '-dev',
+ ...Object.values(DESKTOP_PRODUCTS)
+ .map((product) => product.mcpServerName.slice(MCP_SERVER_NAME.length))
+ .filter((suffix) => suffix !== ''),
+];
-const PI_BRIDGE_PREFIX = 'ok';
+const KNOWN_OPEN_KNOWLEDGE_SERVER = new RegExp(
+ `^open[-_ ]?knowledge(?:${KNOWN_SERVER_SUFFIXES.join('|')})?$`,
+);
+
+const PI_BRIDGE_NAMESPACES: ReadonlySet<string> = new Set(
+ Object.values(DESKTOP_PRODUCTS).map(piToolNamespace),
+);
const OPEN_KNOWLEDGE_TITLE =
/^(mcp[^a-z0-9]+)?((?:open[-_ ]?knowledge|ok)(?:-[a-z]+)*)[^a-z0-9]+([a-z_]+)$/;
@@ -79,7 +96,7 @@ export function identifyOpenKnowledgeToolCall(
if (titleServer === null) return null;
const knownServer = titleViaMcp
? serverPattern.test(titleServer)
- : titleServer === PI_BRIDGE_PREFIX && inputServer === null;
+ : PI_BRIDGE_NAMESPACES.has(titleServer) && inputServer === null;
if (!knownServer) return null;
if (!isOpenKnowledgeTool(titleTool)) return null;
const inputTool = unwrapped?.tool ?? null;
diff --git a/packages/core/src/agent-registry/guidance.ts b/packages/core/src/agent-registry/guidance.ts
index eb40df242..3879135d2 100644
--- a/packages/core/src/agent-registry/guidance.ts
+++ b/packages/core/src/agent-registry/guidance.ts
@@ -23,7 +23,9 @@ export const GUIDANCE_IDS = {
'troubleshooting.claude.project-entry-not-approved': { params: z.strictObject(agentParam) },
'troubleshooting.claude-desktop.per-tool-approval': { params: z.strictObject(agentParam) },
- 'troubleshooting.cursor.project-entry-not-loaded': { params: z.strictObject(agentParam) },
+ 'troubleshooting.cursor.project-entry-not-loaded': {
+ params: z.strictObject({ ...agentParam, server: z.string().optional() }),
+ },
'troubleshooting.codex.desktop-project-config': {
params: z.strictObject({ ...agentParam, honoredByDesktop: z.boolean() }),
},
diff --git a/packages/core/src/constants/editors.ts b/packages/core/src/constants/editors.ts
index e1d1ff51c..513355617 100644
--- a/packages/core/src/constants/editors.ts
+++ b/packages/core/src/constants/editors.ts
@@ -1,3 +1,5 @@
+import { DESKTOP_PRODUCTS, type DesktopProduct } from './product.ts';
+
export type EditorId =
| 'claude'
| 'claude-desktop'
@@ -133,7 +135,15 @@ export const EDITOR_SETUP_DOC_SLUG = {
hermes: 'hermes',
} as const satisfies Record<EditorId, string>;
-export const EDITOR_PROJECT_CONFIG_PATH = {
+export function piExtensionProjectPath(product: DesktopProduct): string {
+ return `.pi/extensions/${product.mcpServerName}.ts`;
+}
+
+export function piToolNamespace(product: DesktopProduct): string {
+ return `ok${product.mcpChainTag}`;
+}
+
+export const STABLE_EDITOR_PROJECT_CONFIG_PATH = {
claude: '.mcp.json',
'claude-desktop': null,
cursor: '.cursor/mcp.json',
@@ -141,19 +151,23 @@ export const EDITOR_PROJECT_CONFIG_PATH = {
copilot: null,
opencode: 'opencode.json',
openclaw: null,
- pi: '.pi/extensions/open-knowledge.ts',
+ pi: piExtensionProjectPath(DESKTOP_PRODUCTS.stable),
antigravity: null,
'lm-studio': null,
hermes: null,
} as const satisfies Record<EditorId, string | null>;
+export function editorProjectConfigPath(id: EditorId, product: DesktopProduct): string | null {
+ return id === 'pi' ? piExtensionProjectPath(product) : STABLE_EDITOR_PROJECT_CONFIG_PATH[id];
+}
+
export const USER_MCP_GATED_EDITOR_IDS: readonly EditorId[] = ['copilot'];
export function receivesProjectIntegrationWrite(
id: EditorId,
opts: { userMcpEntryInstalled: boolean },
): boolean {
- if (EDITOR_PROJECT_CONFIG_PATH[id] !== null) return true;
+ if (STABLE_EDITOR_PROJECT_CONFIG_PATH[id] !== null) return true;
if (EDITOR_PROJECT_SKILL_ROOT[id] === null) return false;
return !USER_MCP_GATED_EDITOR_IDS.includes(id) || opts.userMcpEntryInstalled;
}
diff --git a/packages/core/src/constants/mcp-launcher.test.ts b/packages/core/src/constants/mcp-launcher.test.ts
index 1c5ec0fe0..92604fbda 100644
--- a/packages/core/src/constants/mcp-launcher.test.ts
+++ b/packages/core/src/constants/mcp-launcher.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, test } from 'vitest';
import {
classifyMcpLauncherEntry,
+ DEFAULT_MCP_LAUNCHER_REVISION_CATALOG,
type McpLauncherFamily,
type McpLauncherRevisionCatalog,
} from './mcp-launcher.ts';
@@ -218,3 +219,34 @@ describe('classifyMcpLauncherEntry', () => {
expect(classifyMcpLauncherEntry(entry)).toEqual({ kind: 'declined', reason });
});
});
+
+describe('channel-tagged launcher markers', () => {
+ const unixEntry = (marker: string) => ({
+ command: '/bin/sh',
+ args: ['-l', '-c', `${marker}\nexit 127`],
+ });
+
+ test('beta recognizes its own marker and declines the stable one', () => {
+ const catalog = DEFAULT_MCP_LAUNCHER_REVISION_CATALOG;
+ expect(classifyMcpLauncherEntry(unixEntry('# ok-mcp-beta-v2'), catalog, '-beta')).toMatchObject(
+ {
+ kind: 'recognized',
+ disposition: 'keep',
+ },
+ );
+ expect(classifyMcpLauncherEntry(unixEntry('# ok-mcp-v2'), catalog, '-beta')).toEqual({
+ kind: 'declined',
+ reason: 'malformed-marker',
+ });
+ });
+
+ test('stable declines the beta marker', () => {
+ expect(
+ classifyMcpLauncherEntry(
+ unixEntry('# ok-mcp-beta-v2'),
+ DEFAULT_MCP_LAUNCHER_REVISION_CATALOG,
+ '',
+ ),
+ ).toEqual({ kind: 'declined', reason: 'malformed-marker' });
+ });
+});
diff --git a/packages/core/src/constants/mcp-launcher.ts b/packages/core/src/constants/mcp-launcher.ts
index 4daba24c1..76924cd68 100644
--- a/packages/core/src/constants/mcp-launcher.ts
+++ b/packages/core/src/constants/mcp-launcher.ts
@@ -1,3 +1,7 @@
+import { currentDesktopProduct, type DesktopProduct } from './product.ts';
+
+type McpChainTag = DesktopProduct['mcpChainTag'];
+
export type McpLauncherEnvelope = 'split-command-args' | 'opencode-argv';
export type McpLauncherFamily = 'unix-chain' | 'windows-chain';
@@ -125,10 +129,19 @@ function extractLauncher(
return decline('foreign-command');
}
-function revisionFromFirstLine(body: string, family: McpLauncherFamily): number | null {
+export function mcpChainMarkerPrefix(family: McpLauncherFamily, chainTag: McpChainTag): string {
+ return family === 'unix-chain' ? `# ok-mcp${chainTag}-v` : `# ok-mcp${chainTag}-win-v`;
+}
+
+function revisionFromFirstLine(
+ body: string,
+ family: McpLauncherFamily,
+ chainTag: McpChainTag,
+): number | null {
const firstLine = body.split(/\r?\n/, 1)[0];
- const pattern = family === 'unix-chain' ? /^# ok-mcp-v([1-9]\d*)$/ : /^# ok-mcp-win-v([1-9]\d*)$/;
- const match = firstLine?.match(pattern);
+ const prefix = mcpChainMarkerPrefix(family, chainTag);
+ if (firstLine === undefined || !firstLine.startsWith(prefix)) return null;
+ const match = firstLine.slice(prefix.length).match(/^([1-9]\d*)$/);
if (match === null || match === undefined) return null;
const revision = Number(match[1]);
return Number.isSafeInteger(revision) ? revision : null;
@@ -137,12 +150,13 @@ function revisionFromFirstLine(body: string, family: McpLauncherFamily): number
export function classifyMcpLauncherEntry(
entry: unknown,
catalog: McpLauncherRevisionCatalog = DEFAULT_MCP_LAUNCHER_REVISION_CATALOG,
+ chainTag: McpChainTag = currentDesktopProduct().mcpChainTag,
): McpLauncherClassification {
if (typeof entry !== 'object' || entry === null) return decline('not-an-object');
const extracted = extractLauncher(entry as Record<string, unknown>);
if ('kind' in extracted) return extracted;
- const revision = revisionFromFirstLine(extracted.body, extracted.family);
+ const revision = revisionFromFirstLine(extracted.body, extracted.family, chainTag);
if (revision === null) return decline('malformed-marker');
const registry = catalog[extracted.family];
diff --git a/packages/core/src/constants/mcp.ts b/packages/core/src/constants/mcp.ts
index f70f6c718..f3aebee53 100644
--- a/packages/core/src/constants/mcp.ts
+++ b/packages/core/src/constants/mcp.ts
@@ -1,8 +1,10 @@
+import { DESKTOP_PRODUCTS } from './product.ts';
+
export const READ_DOCUMENT_HISTORY_DEPTH = 5;
export const GREP_MAX_RESULTS = 50;
-export const MCP_SERVER_NAME = 'open-knowledge';
+export const MCP_SERVER_NAME = DESKTOP_PRODUCTS.stable.mcpServerName;
export const SERVER_UNREACHABLE_ERROR_PREFIX = 'Server unreachable:';
diff --git a/packages/core/src/constants/pi-docs.uncached.test.ts b/packages/core/src/constants/pi-docs.uncached.test.ts
new file mode 100644
index 000000000..e28dc34a9
--- /dev/null
+++ b/packages/core/src/constants/pi-docs.uncached.test.ts
@@ -0,0 +1,30 @@
+import { readFileSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { describe, expect, test } from 'vitest';
+import { piToolNamespace } from './editors.ts';
+import { DESKTOP_PRODUCTS } from './product.ts';
+
+const PI_PAGE = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../../../../docs/content/integrations/pi.mdx'),
+ 'utf8',
+);
+
+function verifySection(): string {
+ const start = PI_PAGE.indexOf('\n## Verify\n');
+ if (start === -1) throw new Error('pi.mdx has no "## Verify" section');
+ const end = PI_PAGE.indexOf('\n## ', start + 1);
+ return PI_PAGE.slice(start, end === -1 ? undefined : end);
+}
+
+describe('Pi integration page', () => {
+ test.each(Object.values(DESKTOP_PRODUCTS))(
+ 'Verify names the $productName tool and prefix',
+ (product) => {
+ const namespace = piToolNamespace(product);
+ const verify = verifySection();
+ expect(verify).toContain(`\`${namespace}_exec\``);
+ expect(verify).toContain(`\`${namespace}_\``);
+ },
+ );
+});
diff --git a/packages/core/src/constants/product.test.ts b/packages/core/src/constants/product.test.ts
new file mode 100644
index 000000000..3b8a30c33
--- /dev/null
+++ b/packages/core/src/constants/product.test.ts
@@ -0,0 +1,44 @@
+import { describe, expect, it } from 'vitest';
+import { DESKTOP_PRODUCTS, resolveDesktopProductName } from './product.ts';
+
+describe('resolveDesktopProductName', () => {
+ it.each([
+ ['/Applications/OpenKnowledge.app/Contents/MacOS/OpenKnowledge', 'stable'],
+ ['/Applications/OpenKnowledge Beta.app/Contents/MacOS/OpenKnowledge Beta', 'beta'],
+ [
+ '/Applications/OpenKnowledge Beta.app/Contents/Frameworks/OpenKnowledge Beta Server.app/Contents/MacOS/OpenKnowledge Beta Helper',
+ 'beta',
+ ],
+ [
+ '/Applications/OpenKnowledge.app/Contents/Frameworks/OpenKnowledge Server.app/Contents/MacOS/OpenKnowledge Helper',
+ 'stable',
+ ],
+ ['C:\\Users\\me\\AppData\\Local\\Programs\\OpenKnowledge Beta\\OpenKnowledge Beta.exe', 'beta'],
+ ['/opt/OpenKnowledge Beta/openknowledge-beta', 'beta'],
+ ['/opt/OpenKnowledge/openknowledge', 'stable'],
+ ['/usr/local/bin/node', 'stable'],
+ ['/repo/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron', 'stable'],
+ ] as const)('%s resolves to %s', (execPath, expected) => {
+ expect(resolveDesktopProductName({}, execPath)).toBe(expected);
+ });
+
+ it('lets OK_CHANNEL override the executable', () => {
+ expect(resolveDesktopProductName({ OK_CHANNEL: 'Beta' }, '/usr/local/bin/node')).toBe('beta');
+ expect(
+ resolveDesktopProductName(
+ { OK_CHANNEL: 'stable' },
+ '/Applications/OpenKnowledge Beta.app/Contents/MacOS/OpenKnowledge Beta',
+ ),
+ ).toBe('stable');
+ });
+
+ it('rejects an unknown OK_CHANNEL instead of guessing', () => {
+ expect(() => resolveDesktopProductName({ OK_CHANNEL: 'nightly' }, '')).toThrow(/OK_CHANNEL/);
+ });
+
+ it('gives every channel a distinct MCP server name and chain tag', () => {
+ const products = Object.values(DESKTOP_PRODUCTS);
+ expect(new Set(products.map((p) => p.mcpServerName)).size).toBe(products.length);
+ expect(new Set(products.map((p) => p.mcpChainTag)).size).toBe(products.length);
+ });
+});
diff --git a/packages/core/src/constants/product.ts b/packages/core/src/constants/product.ts
index 824f0df45..e3821c381 100644
--- a/packages/core/src/constants/product.ts
+++ b/packages/core/src/constants/product.ts
@@ -8,6 +8,10 @@ export const DESKTOP_PRODUCTS = {
deb: 'openknowledge',
rpm: 'OpenKnowledge',
},
+ cliCommandNames: ['ok', 'open-knowledge'],
+ mcpServerName: 'open-knowledge',
+ mcpChainTag: '',
+ npmDistTag: 'latest',
},
beta: {
appId: 'com.inkeep.open-knowledge.beta',
@@ -18,6 +22,10 @@ export const DESKTOP_PRODUCTS = {
deb: 'openknowledge-beta-desktop',
rpm: 'openknowledge-beta-desktop',
},
+ cliCommandNames: ['ok-beta', 'open-knowledge-beta'],
+ mcpServerName: 'open-knowledge-beta',
+ mcpChainTag: '-beta',
+ npmDistTag: 'beta',
},
} as const;
@@ -33,3 +41,47 @@ export function desktopWindowsInstallDirNames(product: DesktopProduct): readonly
}
export const PRODUCT_NAME = DESKTOP_PRODUCTS.stable.productName;
+
+export const OK_CHANNEL_ENV = 'OK_CHANNEL';
+
+function isDesktopProductName(value: string): value is DesktopProductName {
+ return Object.hasOwn(DESKTOP_PRODUCTS, value);
+}
+
+function executableBaseName(execPath: string): string {
+ return (execPath.split(/[\\/]/).pop() ?? '').replace(/\.exe$/i, '');
+}
+
+export function resolveDesktopProductName(
+ env: Record<string, string | undefined> = globalThis.process?.env ?? {},
+ execPath: string = globalThis.process?.execPath ?? '',
+): DesktopProductName {
+ const override = env[OK_CHANNEL_ENV]?.trim().toLowerCase();
+ if (override) {
+ if (isDesktopProductName(override)) return override;
+ throw new Error(
+ `Unsupported ${OK_CHANNEL_ENV}=${JSON.stringify(override)}. Expected ${Object.keys(DESKTOP_PRODUCTS).join(' or ')}.`,
+ );
+ }
+ const exe = executableBaseName(execPath);
+ for (const name of Object.keys(DESKTOP_PRODUCTS) as DesktopProductName[]) {
+ if (name === 'stable') continue;
+ const product = DESKTOP_PRODUCTS[name];
+ if (
+ exe === product.linuxExecutableName ||
+ exe === product.productName ||
+ exe.startsWith(`${product.productName} `)
+ ) {
+ return name;
+ }
+ }
+ return 'stable';
+}
+
+export function currentDesktopProduct(): DesktopProduct {
+ return DESKTOP_PRODUCTS[resolveDesktopProductName()];
+}
+
+export function currentMcpServerName(): DesktopProduct['mcpServerName'] {
+ return currentDesktopProduct().mcpServerName;
+}
diff --git a/packages/core/src/constants/product.type-tests.ts b/packages/core/src/constants/product.type-tests.ts
new file mode 100644
index 000000000..dd3b5acfd
--- /dev/null
+++ b/packages/core/src/constants/product.type-tests.ts
@@ -0,0 +1,5 @@
+import type { DesktopProduct } from './product.ts';
+
+declare const serverName: DesktopProduct['mcpServerName'];
+const _sharesOpenKnowledgePrefix: `open-knowledge${string}` = serverName;
+void _sharesOpenKnowledgePrefix;
diff --git a/packages/core/src/desktop-bridge.ts b/packages/core/src/desktop-bridge.ts
index c630a7555..af76a8bac 100644
--- a/packages/core/src/desktop-bridge.ts
+++ b/packages/core/src/desktop-bridge.ts
@@ -1040,11 +1040,13 @@ export interface ClaudeReadiness {
readonly claude: 'present' | 'not-found' | 'unknown';
readonly mcpPreApprovable?: boolean;
readonly okToolsAutoApprovable?: boolean;
+ readonly mcpServerName?: string;
}
export interface CliReadiness {
readonly onPath: 'present' | 'not-found' | 'unknown';
readonly okServerConfigured?: boolean;
+ readonly mcpServerName?: string;
}
export interface CopyImageRequest {
@@ -1419,6 +1421,7 @@ export interface OkDesktopBridge {
readonly platform: 'darwin' | 'win32' | 'linux';
readonly appVersion: string;
readonly instanceLabel: string | null;
+ readonly mcpServerName: string | null;
getPathForFile(file: File): string | null;
diff --git a/packages/core/src/handoff/terminal-launch.test.ts b/packages/core/src/handoff/terminal-launch.test.ts
index 33ec1f125..dff93595b 100644
--- a/packages/core/src/handoff/terminal-launch.test.ts
+++ b/packages/core/src/handoff/terminal-launch.test.ts
@@ -14,6 +14,7 @@ vi.mock('node:child_process', async (importOriginal) => {
const spawnSyncMock = vi.mocked(spawnSync);
import { MCP_SERVER_NAME } from '../constants/mcp.ts';
+import { DESKTOP_PRODUCTS } from '../constants/product.ts';
import {
buildClaudeLaunchCommand,
buildCliLaunchArgString,
@@ -112,6 +113,7 @@ describe('Windows launch composition', () => {
buildWindowsCliLaunch('claude', prompt, {
mcpPreApprove: true,
autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
}),
).toEqual({
executable: 'claude',
@@ -122,7 +124,12 @@ describe('Windows launch composition', () => {
contents: `{"enabledMcpjsonServers":["${MCP_SERVER_NAME}"],"permissions":{"allow":${OK_ALLOW},"ask":${OK_ASK}}}`,
},
});
- expect(buildWindowsCliLaunch('codex', prompt, { autoApproveOkTools: true })).toEqual({
+ expect(
+ buildWindowsCliLaunch('codex', prompt, {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toEqual({
executable: 'codex',
args: ['-c', `mcp_servers.${MCP_SERVER_NAME}.default_tools_approval_mode=approve`],
});
@@ -135,9 +142,9 @@ describe('Windows launch composition', () => {
it('degrades a support-file launch to the bare launch the same builder would emit', () => {
const prompt = 'review the failing gate';
for (const opts of [
- { mcpPreApprove: true },
- { autoApproveOkTools: true },
- { mcpPreApprove: true, autoApproveOkTools: true },
+ { mcpPreApprove: true, mcpServerName: MCP_SERVER_NAME },
+ { autoApproveOkTools: true, mcpServerName: MCP_SERVER_NAME },
+ { mcpPreApprove: true, autoApproveOkTools: true, mcpServerName: MCP_SERVER_NAME },
]) {
const withSupport = buildWindowsCliLaunch('claude', prompt, opts);
expect(withSupport.supportFile).toBeDefined();
@@ -148,7 +155,10 @@ describe('Windows launch composition', () => {
});
it('leaves a launch that carries no support file untouched', () => {
- const bare = buildWindowsCliLaunch('codex', null, { autoApproveOkTools: true });
+ const bare = buildWindowsCliLaunch('codex', null, {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(launchWithoutSupportFile(bare)).toBe(bare);
});
@@ -853,6 +863,7 @@ describe('buildClaudeLaunchCommand', () => {
expect(
buildClaudeLaunchCommand("Let's work on `foo.md` using OpenKnowledge.", {
mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
}),
).toBe(
"claude --settings '{\"enabledMcpjsonServers\":[\"open-knowledge\"]}' 'Let'\\''s work on `foo.md` using OpenKnowledge.'\r",
@@ -860,7 +871,10 @@ describe('buildClaudeLaunchCommand', () => {
});
it('keeps an injection payload inert and contained in the prompt arg (pre-approved)', () => {
- const cmd = buildClaudeLaunchCommand("'; rm -rf / #", { mcpPreApprove: true });
+ const cmd = buildClaudeLaunchCommand("'; rm -rf / #", {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(cmd).toBe(`claude ${CLAUDE_PREAPPROVE} ''\\''; rm -rf / #'\r`);
expect(cmd.startsWith(`claude ${CLAUDE_PREAPPROVE} `)).toBe(true);
expect(cmd.endsWith("''\\''; rm -rf / #'\r")).toBe(true);
@@ -883,7 +897,10 @@ describe('buildCliLaunchCommand', () => {
it('escapes the prompt identically for every argv-prompt CLI regardless of fixed args', () => {
for (const cli of TERMINAL_CLI_IDS) {
if (startupInjectionFor(cli, 'darwin') != null) continue;
- const cmd = buildCliLaunchCommand(cli, "'; rm -rf / #", { mcpPreApprove: true });
+ const cmd = buildCliLaunchCommand(cli, "'; rm -rf / #", {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(cmd.startsWith(`${TERMINAL_CLIS[cli].bin} `)).toBe(true);
expect(cmd.endsWith("''\\''; rm -rf / #'\r")).toBe(true);
}
@@ -891,8 +908,13 @@ describe('buildCliLaunchCommand', () => {
it('buildClaudeLaunchCommand is the claude specialization (opts forwarded)', () => {
expect(buildClaudeLaunchCommand('hi')).toBe(buildCliLaunchCommand('claude', 'hi'));
- expect(buildClaudeLaunchCommand('hi', { mcpPreApprove: true })).toBe(
- buildCliLaunchCommand('claude', 'hi', { mcpPreApprove: true }),
+ expect(
+ buildClaudeLaunchCommand('hi', { mcpPreApprove: true, mcpServerName: MCP_SERVER_NAME }),
+ ).toBe(
+ buildCliLaunchCommand('claude', 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
);
});
});
@@ -900,9 +922,14 @@ describe('buildCliLaunchCommand', () => {
describe('buildCliLaunchArgString', () => {
it('is the launch command WITHOUT the trailing carriage return', () => {
for (const cli of TERMINAL_CLI_IDS) {
- const arg = buildCliLaunchArgString(cli, 'hi', { mcpPreApprove: true });
+ const arg = buildCliLaunchArgString(cli, 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(arg.endsWith('\r')).toBe(false);
- expect(`${arg}\r`).toBe(buildCliLaunchCommand(cli, 'hi', { mcpPreApprove: true }));
+ expect(`${arg}\r`).toBe(
+ buildCliLaunchCommand(cli, 'hi', { mcpPreApprove: true, mcpServerName: MCP_SERVER_NAME }),
+ );
}
});
@@ -939,13 +966,19 @@ describe('buildCliLaunchArgString promptless (New chat)', () => {
});
it('still applies Claude MCP pre-approval on a promptless launch when opted in', () => {
- const arg = buildCliLaunchArgString('claude', null, { mcpPreApprove: true });
+ const arg = buildCliLaunchArgString('claude', null, {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(arg).toBe(`claude ${CLAUDE_PREAPPROVE}`);
expect(arg.endsWith(' ')).toBe(false);
});
it('still applies Claude OK auto-approve on a promptless launch, alone and merged with pre-approval', () => {
- const autoOnly = buildCliLaunchArgString('claude', null, { autoApproveOkTools: true });
+ const autoOnly = buildCliLaunchArgString('claude', null, {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(autoOnly).toBe(
`claude --settings '{"permissions":{"allow":${OK_ALLOW},"ask":${OK_ASK}}}'`,
);
@@ -954,6 +987,7 @@ describe('buildCliLaunchArgString promptless (New chat)', () => {
const both = buildCliLaunchArgString('claude', null, {
mcpPreApprove: true,
autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
});
expect(both).toBe(
`claude --settings '{"enabledMcpjsonServers":["${MCP_SERVER_NAME}"],"permissions":{"allow":${OK_ALLOW},"ask":${OK_ASK}}}'`,
@@ -962,14 +996,22 @@ describe('buildCliLaunchArgString promptless (New chat)', () => {
});
it('never adds --prompt or a positional to a promptless opencode launch, even opted in', () => {
- expect(buildCliLaunchArgString('opencode', '', { mcpPreApprove: true })).toBe('opencode');
+ expect(
+ buildCliLaunchArgString('opencode', '', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe('opencode');
});
it('leaves the non-empty prompted shape byte-identical (promptless branch must not perturb it)', () => {
expect(buildCliLaunchArgString('claude', 'hi')).toBe("claude 'hi'");
- expect(buildCliLaunchArgString('claude', 'hi', { mcpPreApprove: true })).toBe(
- `claude ${CLAUDE_PREAPPROVE} 'hi'`,
- );
+ expect(
+ buildCliLaunchArgString('claude', 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe(`claude ${CLAUDE_PREAPPROVE} 'hi'`);
expect(buildCliLaunchArgString('opencode', 'hi')).toBe("opencode --prompt 'hi'");
});
});
@@ -1031,48 +1073,75 @@ describe('buildStartupInjectionBytes', () => {
describe('claude MCP pre-approval', () => {
it('is OFF by default and only added for claude when opted in', () => {
expect(buildCliLaunchCommand('claude', 'hi')).not.toContain('--settings');
- expect(buildCliLaunchCommand('claude', 'hi', { mcpPreApprove: true })).toContain(
- CLAUDE_PREAPPROVE,
- );
+ expect(
+ buildCliLaunchCommand('claude', 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toContain(CLAUDE_PREAPPROVE);
});
it('never added for codex/copilot/cursor/opencode, even when opted in (claude-only flag)', () => {
- expect(buildCliLaunchCommand('codex', 'hi', { mcpPreApprove: true })).toBe("codex 'hi'\r");
- expect(buildCliLaunchCommand('copilot', 'hi', { mcpPreApprove: true })).toBe(
- "copilot --interactive 'hi'\r",
- );
- expect(buildCliLaunchCommand('cursor', 'hi', { mcpPreApprove: true })).toBe(
- "cursor-agent 'hi'\r",
- );
- expect(buildCliLaunchCommand('opencode', 'hi', { mcpPreApprove: true })).toBe(
- "opencode --prompt 'hi'\r",
- );
+ expect(
+ buildCliLaunchCommand('codex', 'hi', { mcpPreApprove: true, mcpServerName: MCP_SERVER_NAME }),
+ ).toBe("codex 'hi'\r");
+ expect(
+ buildCliLaunchCommand('copilot', 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe("copilot --interactive 'hi'\r");
+ expect(
+ buildCliLaunchCommand('cursor', 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe("cursor-agent 'hi'\r");
+ expect(
+ buildCliLaunchCommand('opencode', 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe("opencode --prompt 'hi'\r");
});
it('names the canonical MCP server, matching what editor wiring registers in .mcp.json', () => {
- expect(buildCliLaunchCommand('claude', 'hi', { mcpPreApprove: true })).toContain(
- `["${MCP_SERVER_NAME}"]`,
- );
+ expect(
+ buildCliLaunchCommand('claude', 'hi', {
+ mcpPreApprove: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toContain(`["${MCP_SERVER_NAME}"]`);
});
});
describe('OK auto-approve (autoApproveOkTools)', () => {
it('adds the OK allow-list + destructive ask-list to Claude --settings when on', () => {
- expect(buildCliLaunchArgString('claude', 'hi', { autoApproveOkTools: true })).toBe(
- `claude --settings '{"permissions":{"allow":${OK_ALLOW},"ask":${OK_ASK}}}' 'hi'`,
- );
+ expect(
+ buildCliLaunchArgString('claude', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe(`claude --settings '{"permissions":{"allow":${OK_ALLOW},"ask":${OK_ASK}}}' 'hi'`);
});
it('merges server-trust + auto-approve into one --settings object when both on', () => {
expect(
- buildCliLaunchArgString('claude', 'hi', { mcpPreApprove: true, autoApproveOkTools: true }),
+ buildCliLaunchArgString('claude', 'hi', {
+ mcpPreApprove: true,
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
).toBe(
`claude --settings '{"enabledMcpjsonServers":["${MCP_SERVER_NAME}"],"permissions":{"allow":${OK_ALLOW},"ask":${OK_ASK}}}' 'hi'`,
);
});
it('keeps every gated tool in the ask list (never silently auto-approved)', () => {
- const arg = buildCliLaunchArgString('claude', 'hi', { autoApproveOkTools: true });
+ const arg = buildCliLaunchArgString('claude', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(OK_GATED_TOOL_NAMES).toEqual(['delete', 'move', 'share_link', 'install', 'import']);
for (const gated of OK_GATED_TOOL_NAMES) {
expect(arg).toContain(`"mcp__${MCP_SERVER_NAME}__${gated}"`);
@@ -1080,39 +1149,137 @@ describe('OK auto-approve (autoApproveOkTools)', () => {
});
it('never gates with `deny` (that would hide the tools from the agent)', () => {
- const arg = buildCliLaunchArgString('claude', 'hi', { autoApproveOkTools: true });
+ const arg = buildCliLaunchArgString('claude', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(arg).not.toContain('"deny"');
});
it('adds the codex per-server `-c approve` override only when on', () => {
- expect(buildCliLaunchArgString('codex', 'hi', { autoApproveOkTools: true })).toBe(
- `codex -c 'mcp_servers.${MCP_SERVER_NAME}.default_tools_approval_mode="approve"' 'hi'`,
- );
+ expect(
+ buildCliLaunchArgString('codex', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe(`codex -c 'mcp_servers.${MCP_SERVER_NAME}.default_tools_approval_mode="approve"' 'hi'`);
expect(buildCliLaunchArgString('codex', 'hi')).toBe("codex 'hi'");
});
it('is claude/codex only — copilot/cursor/opencode/pi never get an auto-approve arg', () => {
- expect(buildCliLaunchArgString('copilot', 'hi', { autoApproveOkTools: true })).toBe(
- "copilot --interactive 'hi'",
- );
- expect(buildCliLaunchArgString('cursor', 'hi', { autoApproveOkTools: true })).toBe(
- "cursor-agent 'hi'",
- );
- expect(buildCliLaunchArgString('opencode', 'hi', { autoApproveOkTools: true })).toBe(
- "opencode --prompt 'hi'",
- );
- expect(buildCliLaunchArgString('pi', 'hi', { autoApproveOkTools: true })).toBe("pi 'hi'");
+ expect(
+ buildCliLaunchArgString('copilot', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe("copilot --interactive 'hi'");
+ expect(
+ buildCliLaunchArgString('cursor', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe("cursor-agent 'hi'");
+ expect(
+ buildCliLaunchArgString('opencode', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe("opencode --prompt 'hi'");
+ expect(
+ buildCliLaunchArgString('pi', 'hi', {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe("pi 'hi'");
});
it('keeps the prompt the final escaped arg with auto-approve on (injection inert)', () => {
- const arg = buildCliLaunchArgString('claude', "'; rm -rf / #", { autoApproveOkTools: true });
+ const arg = buildCliLaunchArgString('claude', "'; rm -rf / #", {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ });
expect(arg.endsWith("''\\''; rm -rf / #'")).toBe(true);
});
it('emits a bare `<bin>` for a promptless auto-approve launch with the fixed args', () => {
- expect(buildCliLaunchArgString('codex', null, { autoApproveOkTools: true })).toBe(
- `codex -c 'mcp_servers.${MCP_SERVER_NAME}.default_tools_approval_mode="approve"'`,
+ expect(
+ buildCliLaunchArgString('codex', null, {
+ autoApproveOkTools: true,
+ mcpServerName: MCP_SERVER_NAME,
+ }),
+ ).toBe(`codex -c 'mcp_servers.${MCP_SERVER_NAME}.default_tools_approval_mode="approve"'`);
+ });
+});
+
+describe('launch approval names the server the main process checked', () => {
+ const BETA = DESKTOP_PRODUCTS.beta.mcpServerName;
+ const ALL_ON = { mcpPreApprove: true, autoApproveOkTools: true } as const;
+
+ function artifacts(opts: Parameters<typeof buildCliLaunchArgString>[2]): string[] {
+ const winClaude = buildWindowsCliLaunch('claude', 'hi', opts);
+ return [
+ buildCliLaunchArgString('claude', 'hi', opts),
+ buildCliLaunchArgString('codex', 'hi', opts),
+ winClaude.supportFile?.contents ?? '',
+ buildWindowsCliLaunch('codex', 'hi', opts).args.join(' '),
+ ];
+ }
+
+ it('uses only the supplied Beta name, even when this process resolves to Stable', () => {
+ vi.stubEnv('OK_CHANNEL', 'stable');
+ try {
+ const out = artifacts({ ...ALL_ON, mcpServerName: BETA });
+ expect(out[0]).toBe(
+ `claude --settings '{"enabledMcpjsonServers":["${BETA}"],"permissions":{"allow":["mcp__${BETA}","Bash(ok open:*)"],"ask":["mcp__${BETA}__delete","mcp__${BETA}__move","mcp__${BETA}__share_link","mcp__${BETA}__install","mcp__${BETA}__import"]}}' 'hi'`,
+ );
+ expect(out[1]).toBe(
+ `codex -c 'mcp_servers.${BETA}.default_tools_approval_mode="approve"' 'hi'`,
+ );
+ expect(out[2]).toContain(`["${BETA}"]`);
+ expect(out[3]).toBe(`-c mcp_servers.${BETA}.default_tools_approval_mode=approve`);
+ for (const artifact of out) {
+ expect(artifact.replaceAll(BETA, '')).not.toContain('open-knowledge');
+ }
+ } finally {
+ vi.unstubAllEnvs();
+ }
+ });
+
+ it('emits no pre-approval and no auto-approve when main supplied no name', () => {
+ for (const opts of [ALL_ON, { ...ALL_ON, mcpServerName: '' }]) {
+ expect(buildCliLaunchArgString('claude', 'hi', opts)).toBe("claude 'hi'");
+ expect(buildCliLaunchArgString('codex', 'hi', opts)).toBe("codex 'hi'");
+ expect(buildWindowsCliLaunch('claude', 'hi', opts)).toEqual({
+ executable: 'claude',
+ args: [],
+ });
+ expect(buildWindowsCliLaunch('codex', 'hi', opts)).toEqual({ executable: 'codex', args: [] });
+ }
+ });
+
+ it('keeps the Stable artifacts byte-identical when main supplies the Stable name', () => {
+ const out = artifacts({ ...ALL_ON, mcpServerName: 'open-knowledge' });
+ expect(out[0]).toBe(
+ `claude --settings '{"enabledMcpjsonServers":["open-knowledge"],"permissions":{"allow":["mcp__open-knowledge","Bash(ok open:*)"],"ask":["mcp__open-knowledge__delete","mcp__open-knowledge__move","mcp__open-knowledge__share_link","mcp__open-knowledge__install","mcp__open-knowledge__import"]}}' 'hi'`,
+ );
+ expect(out[1]).toBe(
+ `codex -c 'mcp_servers.open-knowledge.default_tools_approval_mode="approve"' 'hi'`,
);
+ expect(out[3]).toBe('-c mcp_servers.open-knowledge.default_tools_approval_mode=approve');
+ });
+
+ it('imports without resolving the channel, so an unrecognised OK_CHANNEL cannot crash boot', async () => {
+ vi.stubEnv('OK_CHANNEL', 'nightly');
+ vi.resetModules();
+ try {
+ const mod = await import('./terminal-launch.ts');
+ expect(mod.buildCliLaunchArgString('codex', 'hi', { autoApproveOkTools: true })).toBe(
+ "codex 'hi'",
+ );
+ } finally {
+ vi.unstubAllEnvs();
+ vi.resetModules();
+ }
});
});
diff --git a/packages/core/src/handoff/terminal-launch.ts b/packages/core/src/handoff/terminal-launch.ts
index 923d39c9e..94e38984c 100644
--- a/packages/core/src/handoff/terminal-launch.ts
+++ b/packages/core/src/handoff/terminal-launch.ts
@@ -1,4 +1,4 @@
-import { MCP_SERVER_NAME, type OpenKnowledgeMcpTool } from '../constants/mcp.ts';
+import type { OpenKnowledgeMcpTool } from '../constants/mcp.ts';
import type { HandoffTarget } from './types.ts';
export function shellSingleQuote(s: string): string {
@@ -253,7 +253,6 @@ export type TerminalCli =
export interface TerminalCliInfo {
readonly bin: string;
- readonly autoApproveArg?: string;
readonly displayName: string;
readonly docsUrl: string;
readonly handoffTarget: HandoffTarget;
@@ -267,11 +266,6 @@ export interface TerminalCliInfo {
};
}
-const OK_AUTO_APPROVE_ALLOW_RULES: readonly string[] = [
- `mcp__${MCP_SERVER_NAME}`,
- 'Bash(ok open:*)',
-];
-
export const OK_GATED_TOOL_NAMES = [
'delete',
'move',
@@ -280,26 +274,28 @@ export const OK_GATED_TOOL_NAMES = [
'import',
] as const satisfies ReadonlyArray<OpenKnowledgeMcpTool>;
-const OK_AUTO_APPROVE_ASK_RULES: readonly string[] = OK_GATED_TOOL_NAMES.map(
- (tool) => `mcp__${MCP_SERVER_NAME}__${tool}`,
-);
+function approvedServerName(opts: BuildCliLaunchOptions): string | null {
+ return opts.mcpServerName ? opts.mcpServerName : null;
+}
-const CODEX_OK_AUTO_APPROVE_ARG = `-c ${shellSingleQuote(
- `mcp_servers.${MCP_SERVER_NAME}.default_tools_approval_mode="approve"`,
-)}`;
+function codexAutoApproveSetting(server: string, quote: string): string {
+ return `mcp_servers.${server}.default_tools_approval_mode=${quote}approve${quote}`;
+}
function buildClaudeSettingsJson(opts: BuildCliLaunchOptions): string | null {
+ const server = approvedServerName(opts);
+ if (server === null) return null;
const settings: {
enabledMcpjsonServers?: string[];
permissions?: { allow: string[]; ask: string[] };
} = {};
if (opts.mcpPreApprove === true) {
- settings.enabledMcpjsonServers = [MCP_SERVER_NAME];
+ settings.enabledMcpjsonServers = [server];
}
if (opts.autoApproveOkTools === true) {
settings.permissions = {
- allow: [...OK_AUTO_APPROVE_ALLOW_RULES],
- ask: [...OK_AUTO_APPROVE_ASK_RULES],
+ allow: [`mcp__${server}`, 'Bash(ok open:*)'],
+ ask: OK_GATED_TOOL_NAMES.map((tool) => `mcp__${server}__${tool}`),
};
}
if (settings.enabledMcpjsonServers === undefined && settings.permissions === undefined) {
@@ -341,7 +337,6 @@ export const TERMINAL_CLIS = {
displayName: 'Codex',
docsUrl: 'https://developers.openai.com/codex/cli',
handoffTarget: 'codex',
- autoApproveArg: CODEX_OK_AUTO_APPROVE_ARG,
},
copilot: {
bin: 'copilot',
@@ -414,6 +409,7 @@ export const TERMINAL_CLI_IDS = [
export interface BuildCliLaunchOptions {
readonly mcpPreApprove?: boolean;
readonly autoApproveOkTools?: boolean;
+ readonly mcpServerName?: string;
}
export function buildWindowsCliLaunch(
@@ -443,10 +439,11 @@ export function buildWindowsCliLaunch(
};
}
}
- if (cli === 'codex' && opts.autoApproveOkTools === true) {
+ const server = approvedServerName(opts);
+ if (cli === 'codex' && opts.autoApproveOkTools === true && server !== null) {
return {
executable: info.bin,
- args: ['-c', `mcp_servers.${MCP_SERVER_NAME}.default_tools_approval_mode=approve`],
+ args: ['-c', codexAutoApproveSetting(server, '')],
};
}
return {
@@ -461,11 +458,12 @@ export function buildCliLaunchArgString(
opts: BuildCliLaunchOptions = {},
): string {
const info: TerminalCliInfo = TERMINAL_CLIS[cli];
+ const server = approvedServerName(opts);
const fixedArgs =
cli === 'claude'
? buildClaudeSettingsArg(opts)
- : opts.autoApproveOkTools === true && info.autoApproveArg
- ? info.autoApproveArg
+ : cli === 'codex' && opts.autoApproveOkTools === true && server !== null
+ ? `-c ${shellSingleQuote(codexAutoApproveSetting(server, '"'))}`
: '';
const fixedPrefix = fixedArgs ? `${fixedArgs} ` : '';
const sub = info.subcommand ? `${info.subcommand} ` : '';
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 70d5a148d..717e50d80 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -415,17 +415,20 @@ export {
export {
ALL_EDITOR_IDS,
EDITOR_LABELS,
- EDITOR_PROJECT_CONFIG_PATH,
EDITOR_PROJECT_SKILL_ROOT,
EDITOR_SETUP_DOC_SLUG,
EDITOR_USER_SKILL_ROOT,
type EditorId,
+ editorProjectConfigPath,
HOSTS_WITH_USER_SKILL_DIR,
HUB_READER_EDITORS,
PROJECT_SKILL_EDITOR_IDS,
PROJECT_SKILL_PROJECTION_PATHS,
+ piExtensionProjectPath,
+ piToolNamespace,
RESERVED_PROJECT_SKILL_NAME,
receivesProjectIntegrationWrite,
+ STABLE_EDITOR_PROJECT_CONFIG_PATH,
skillRootActivationPath,
USER_MCP_GATED_EDITOR_IDS,
USER_SKILL_EDITOR_IDS,
@@ -490,6 +493,7 @@ export {
type McpLauncherEnvelope,
type McpLauncherFamily,
type McpLauncherRevisionCatalog,
+ mcpChainMarkerPrefix,
} from './constants/mcp-launcher.ts';
export {
MENU_LABELS,
@@ -526,12 +530,16 @@ export {
type PreviewThemeToken,
} from './constants/preview-theme-tokens.ts';
export {
+ currentDesktopProduct,
+ currentMcpServerName,
DESKTOP_PRODUCTS,
type DesktopProduct,
type DesktopProductName,
desktopWindowsExecutableName,
desktopWindowsInstallDirNames,
+ OK_CHANNEL_ENV,
PRODUCT_NAME,
+ resolveDesktopProductName,
} from './constants/product.ts';
export { isReservedLogDoc } from './constants/reserved-docs.ts';
export { DEFAULT_SERVER_HOST } from './constants/server.ts';
diff --git a/packages/core/src/skill-targets/editor-single-source.test.ts b/packages/core/src/skill-targets/editor-single-source.test.ts
index 03c05c2c6..3b58d2023 100644
--- a/packages/core/src/skill-targets/editor-single-source.test.ts
+++ b/packages/core/src/skill-targets/editor-single-source.test.ts
@@ -1,13 +1,13 @@
import { describe, expect, test } from 'vitest';
import {
ALL_EDITOR_IDS,
- EDITOR_PROJECT_CONFIG_PATH,
EDITOR_PROJECT_SKILL_ROOT,
EDITOR_USER_SKILL_ROOT,
HOSTS_WITH_USER_SKILL_DIR,
HUB_READER_EDITORS,
PROJECT_SKILL_EDITOR_IDS,
receivesProjectIntegrationWrite,
+ STABLE_EDITOR_PROJECT_CONFIG_PATH,
USER_MCP_GATED_EDITOR_IDS,
USER_SKILL_HOSTS,
} from '../constants/editors.ts';
@@ -74,7 +74,7 @@ describe('receivesProjectIntegrationWrite', () => {
test('an editor with a project MCP config always writes, whatever the global state', () => {
for (const id of ['claude', 'cursor', 'codex', 'opencode', 'pi'] as const) {
- expect(EDITOR_PROJECT_CONFIG_PATH[id]).not.toBeNull();
+ expect(STABLE_EDITOR_PROJECT_CONFIG_PATH[id]).not.toBeNull();
expect(receivesProjectIntegrationWrite(id, installed)).toBe(true);
expect(receivesProjectIntegrationWrite(id, notInstalled)).toBe(true);
}
@@ -94,7 +94,7 @@ describe('receivesProjectIntegrationWrite', () => {
});
test('Copilot writes only once its user-global entry exists', () => {
- expect(EDITOR_PROJECT_CONFIG_PATH.copilot).toBeNull();
+ expect(STABLE_EDITOR_PROJECT_CONFIG_PATH.copilot).toBeNull();
expect(USER_MCP_GATED_EDITOR_IDS.map(String)).toContain('copilot');
expect(receivesProjectIntegrationWrite('copilot', notInstalled)).toBe(false);
expect(receivesProjectIntegrationWrite('copilot', installed)).toBe(true);
@@ -102,7 +102,7 @@ describe('receivesProjectIntegrationWrite', () => {
test('every gated editor is skill-only — a project MCP config would make the gate moot', () => {
for (const id of USER_MCP_GATED_EDITOR_IDS) {
- expect(EDITOR_PROJECT_CONFIG_PATH[id]).toBeNull();
+ expect(STABLE_EDITOR_PROJECT_CONFIG_PATH[id]).toBeNull();
expect(EDITOR_PROJECT_SKILL_ROOT[id]).not.toBeNull();
}
});
diff --git a/packages/desktop/src/main/claude-mcp-scopes.ts b/packages/desktop/src/main/claude-mcp-scopes.ts
index 277d5dc54..61a6b4410 100644
--- a/packages/desktop/src/main/claude-mcp-scopes.ts
+++ b/packages/desktop/src/main/claude-mcp-scopes.ts
@@ -13,6 +13,7 @@ export interface ClaudeMcpScopes {
readonly projectEntryPresent: boolean;
readonly globalOwn: boolean;
readonly globalKind: McpEntryKind;
+ readonly serverName: string;
}
const NO_PROJECT_SCOPE = {
@@ -28,7 +29,7 @@ export function classifyClaudeMcpScopes(
const target = EDITOR_TARGETS.claude;
const global = classifyExistingMcpEntry(target, '', home);
const globalOwn = global.kind === 'present' && isOwnManagedEntry(global.entry);
- const globalScope = { globalOwn, globalKind: global.kind };
+ const globalScope = { globalOwn, globalKind: global.kind, serverName: target.serverName('') };
const projectPath =
projectRoot === undefined ? undefined : target.projectConfigPath?.(projectRoot);
diff --git a/packages/desktop/src/main/claude-readiness.ts b/packages/desktop/src/main/claude-readiness.ts
index 812844dbc..3a8790cea 100644
--- a/packages/desktop/src/main/claude-readiness.ts
+++ b/packages/desktop/src/main/claude-readiness.ts
@@ -132,6 +132,7 @@ export interface ResolveClaudeReadinessDeps {
isProjectMcpPreApprovable(): boolean;
hasProjectMcpEntry?(): boolean;
isGlobalMcpOwnManaged?(): boolean;
+ mcpServerName?: string;
}
function resolveOkToolsAutoApprovable(scopes: {
@@ -204,12 +205,14 @@ export async function resolveClaudeReadiness(
deps.isGlobalMcpOwnManaged !== undefined && (kind === 'present' || kind === 'decline'),
globalEntryIsOwn,
}),
+ ...(deps.mcpServerName === undefined ? {} : { mcpServerName: deps.mcpServerName }),
};
}
export interface ResolveCliOnPathDeps {
probe(): Promise<number | null>;
okServerConfigured?(): boolean;
+ mcpServerName?: string;
}
export async function resolveCliOnPath(deps: ResolveCliOnPathDeps): Promise<CliReadiness> {
@@ -231,7 +234,11 @@ export async function resolveCliOnPath(deps: ResolveCliOnPathDeps): Promise<CliR
'okServerConfigured probe threw; treating the OK server as not configured',
);
}
- return { onPath, okServerConfigured };
+ return {
+ onPath,
+ okServerConfigured,
+ ...(deps.mcpServerName === undefined ? {} : { mcpServerName: deps.mcpServerName }),
+ };
}
export interface ResolveCliInstalledMapDeps {
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index a8bacbf42..37d1faa13 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -342,6 +342,7 @@ import { applyDevShmPosture } from './linux-shm-posture.ts';
import { resolveLocalOpCliInvocation } from './local-op-cli-invocation.ts';
import { createMenuTranslator, resolveMenuCatalogDir } from './main-i18n.ts';
import { createMainThreadWatchdog } from './main-thread-watchdog.ts';
+import { withMcpServerNameArg } from './mcp-server-name-arg.ts';
import {
checkAndRepairMcpWiringOnStartup,
type McpStartupRepairResult,
@@ -1241,9 +1242,10 @@ function runDriverBootSmokeInProduction(): void {
}
function withWindowRuntimeArgs(args: readonly string[]): string[] {
+ const withServerName = withMcpServerNameArg(args);
const withDebug = isDebugKeyringSmokeAllowed()
- ? [...args, '--ok-debug-keyring-smoke=1']
- : [...args];
+ ? [...withServerName, '--ok-debug-keyring-smoke=1']
+ : withServerName;
const withTerminalCapability = withTerminalCapabilityArg(withDebug, isTerminalAvailable());
const withSmoke =
process.env.OK_DESKTOP_E2E_SMOKE === '1'
@@ -3701,6 +3703,7 @@ function resolveTerminalClaudeReadiness(projectRoot: string | undefined): Promis
isProjectMcpPreApprovable: () => scopes.projectOwn,
hasProjectMcpEntry: () => scopes.projectEntryPresent,
isGlobalMcpOwnManaged: () => scopes.globalOwn,
+ mcpServerName: scopes.serverName,
});
}
@@ -3717,6 +3720,7 @@ function resolveTerminalCliOnPath(cli: TerminalCli): Promise<CliReadiness> {
? {
okServerConfigured: () =>
classifyExistingMcpEntry(EDITOR_TARGETS.codex, '', osHomedir()).kind === 'present',
+ mcpServerName: EDITOR_TARGETS.codex.serverName(''),
}
: {}),
});
diff --git a/packages/desktop/src/main/integrations-settings.test.ts b/packages/desktop/src/main/integrations-settings.test.ts
index 70a8443f3..6d1b13f67 100644
--- a/packages/desktop/src/main/integrations-settings.test.ts
+++ b/packages/desktop/src/main/integrations-settings.test.ts
@@ -1,6 +1,6 @@
import { EMPTY_DETECTION_SNAPSHOT, EMPTY_PROBE_SNAPSHOT } from '@inkeep/open-knowledge-core';
import type { IpcMainInvokeEvent } from 'electron';
-import { describe, expect, test } from 'vitest';
+import { describe, expect, test, vi } from 'vitest';
import type {
AgentIntegrationsApplyRequest,
AgentIntegrationsApplyResult,
@@ -387,6 +387,24 @@ describe('ok:integrations:dispatch — set editor', () => {
expect(cli.removals).toEqual(['claude']);
});
+ test("a foreign-entry refusal names the running channel's own entry", async () => {
+ const { set } = setup({ cli: makeCli({ removeKind: 'left-foreign' }) });
+ const disable = { component: { kind: 'editor', id: 'claude' }, enabled: false } as const;
+ const stable = await set(disable);
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ try {
+ const beta = await set(disable);
+ expect(stable.ok ? null : stable.error).toBe(
+ "The open-knowledge entry in Claude isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.",
+ );
+ expect(beta.ok ? null : beta.error).toBe(
+ "The open-knowledge-beta entry in Claude isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.",
+ );
+ } finally {
+ vi.unstubAllEnvs();
+ }
+ });
+
test('a declined write surfaces the left-unchanged error', async () => {
const { set } = setup({ cli: makeCli({ writeAction: 'declined' }) });
const result = await set({ component: { kind: 'editor', id: 'cursor' }, enabled: true });
diff --git a/packages/desktop/src/main/integrations-settings.ts b/packages/desktop/src/main/integrations-settings.ts
index c8b6417c8..e5cf8662c 100644
--- a/packages/desktop/src/main/integrations-settings.ts
+++ b/packages/desktop/src/main/integrations-settings.ts
@@ -1,4 +1,5 @@
import {
+ currentMcpServerName,
EMPTY_DETECTION_SNAPSHOT,
EMPTY_PROBE_SNAPSHOT,
TERMINAL_CLI_IDS,
@@ -310,7 +311,7 @@ export function registerIntegrationsSettings(
case 'left-foreign':
return {
ok: false,
- error: `The open-knowledge entry in ${label} isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.`,
+ error: `The ${currentMcpServerName()} entry in ${label} isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.`,
};
case 'declined':
return {
diff --git a/packages/desktop/src/main/mcp-server-name-arg.test.ts b/packages/desktop/src/main/mcp-server-name-arg.test.ts
new file mode 100644
index 000000000..a64eeeb22
--- /dev/null
+++ b/packages/desktop/src/main/mcp-server-name-arg.test.ts
@@ -0,0 +1,24 @@
+import { afterEach, describe, expect, test, vi } from 'vitest';
+import { withMcpServerNameArg } from './mcp-server-name-arg.ts';
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+});
+
+describe('renderer-window MCP server-name argv', () => {
+ test('a Beta run hands the window its own server key', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ expect(withMcpServerNameArg(['--ok-mode=editor'])).toEqual([
+ '--ok-mode=editor',
+ '--ok-mcp-server-name=open-knowledge-beta',
+ ]);
+ });
+
+ test('a Stable run hands the window the Stable server key', () => {
+ vi.stubEnv('OK_CHANNEL', 'stable');
+ expect(withMcpServerNameArg(['--ok-mode=editor'])).toEqual([
+ '--ok-mode=editor',
+ '--ok-mcp-server-name=open-knowledge',
+ ]);
+ });
+});
diff --git a/packages/desktop/src/main/mcp-server-name-arg.ts b/packages/desktop/src/main/mcp-server-name-arg.ts
new file mode 100644
index 000000000..3d95adf13
--- /dev/null
+++ b/packages/desktop/src/main/mcp-server-name-arg.ts
@@ -0,0 +1,6 @@
+import { currentMcpServerName } from '@inkeep/open-knowledge-core';
+import { MCP_SERVER_NAME_ARG_NAME } from '../shared/ok-desktop-argv.ts';
+
+export function withMcpServerNameArg(args: readonly string[]): string[] {
+ return [...args, `--ok-${MCP_SERVER_NAME_ARG_NAME}=${currentMcpServerName()}`];
+}
diff --git a/packages/desktop/src/main/project-integrations-settings.test.ts b/packages/desktop/src/main/project-integrations-settings.test.ts
index 8dd8e8046..2e3e957f8 100644
--- a/packages/desktop/src/main/project-integrations-settings.test.ts
+++ b/packages/desktop/src/main/project-integrations-settings.test.ts
@@ -314,6 +314,27 @@ describe('registerProjectIntegrationsSettings — set', () => {
if (!r.ok) expect(r.error).toContain('left unchanged');
});
+ test("a foreign-entry refusal names the running channel's own entry", async () => {
+ const { set } = register(makeCli({ removeKind: 'left-foreign' }));
+ const disable = {
+ component: { kind: 'editor', id: 'claude' as McpWiringEditorId },
+ enabled: false,
+ } as const;
+ const stable = await set(disable);
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ try {
+ const beta = await set(disable);
+ expect(stable.ok ? null : stable.error).toBe(
+ "The open-knowledge entry in claude's project config isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.",
+ );
+ expect(beta.ok ? null : beta.error).toBe(
+ "The open-knowledge-beta entry in claude's project config isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.",
+ );
+ } finally {
+ vi.unstubAllEnvs();
+ }
+ });
+
test('the skill row carries reach, cost and source so the consent row can price it', async () => {
const cli = makeCli();
const { status } = register(cli);
diff --git a/packages/desktop/src/main/project-integrations-settings.ts b/packages/desktop/src/main/project-integrations-settings.ts
index dc3f9e9f5..dcf3109eb 100644
--- a/packages/desktop/src/main/project-integrations-settings.ts
+++ b/packages/desktop/src/main/project-integrations-settings.ts
@@ -4,6 +4,7 @@ import type {
McpEntryClassification,
McpRemoveOutcome,
} from '@inkeep/open-knowledge';
+import { currentMcpServerName } from '@inkeep/open-knowledge-core';
import type { IpcMain, IpcMainInvokeEvent } from 'electron';
import type {
IntegrationsEditorState,
@@ -250,7 +251,7 @@ export function registerProjectIntegrationsSettings(
case 'left-foreign':
return {
ok: false,
- error: `The open-knowledge entry in ${label}'s project config isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.`,
+ error: `The ${currentMcpServerName()} entry in ${label}'s project config isn't one OpenKnowledge wrote — it was left unchanged. Remove it manually if you no longer want it.`,
};
case 'declined':
return {
diff --git a/packages/desktop/src/preload/bridge-forwarding.test.ts b/packages/desktop/src/preload/bridge-forwarding.test.ts
index 5304d6d6b..a5bcf4ad7 100644
--- a/packages/desktop/src/preload/bridge-forwarding.test.ts
+++ b/packages/desktop/src/preload/bridge-forwarding.test.ts
@@ -1,4 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { withMcpServerNameArg } from '../main/mcp-server-name-arg.ts';
const invokeMock = vi.fn(() => Promise.resolve({ ok: true }));
const exposed = new Map<string, Record<string, unknown>>();
@@ -18,6 +19,7 @@ vi.mock('electron', () => ({
}));
type BridgeProbe = {
+ mcpServerName: string | null;
config: {
languagePreference?: string;
themePreference?: string;
@@ -77,6 +79,7 @@ const originalArgv = process.argv;
afterEach(() => {
process.argv = originalArgv;
+ vi.unstubAllEnvs();
});
describe('preload argv config', () => {
@@ -102,6 +105,15 @@ describe('preload argv config', () => {
expect(bridge.config).not.toHaveProperty('languagePreference');
expect(bridge.config).not.toHaveProperty('themePreference');
});
+
+ it('exposes the server key main hands a Beta window', async () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ process.argv = withMcpServerNameArg(originalArgv);
+
+ const bridge = await loadBridge();
+
+ expect(bridge.mcpServerName).toBe('open-knowledge-beta');
+ });
});
describe('preload editor view-menu state marshalling', () => {
diff --git a/packages/desktop/src/preload/index.ts b/packages/desktop/src/preload/index.ts
index 6a7c0c423..78870809c 100644
--- a/packages/desktop/src/preload/index.ts
+++ b/packages/desktop/src/preload/index.ts
@@ -76,6 +76,7 @@ import {
} from '../shared/menu-dispatch-results.ts';
import {
LANGUAGE_PREFERENCE_ARG_NAME,
+ MCP_SERVER_NAME_ARG_NAME,
resolveOkDesktopMode,
resolveOkThemePreference,
THEME_PREFERENCE_ARG_NAME,
@@ -899,6 +900,7 @@ const bridge: OkDesktopBridge = {
platform: process.platform as 'darwin' | 'win32' | 'linux',
appVersion: parseArg('app-version') ?? '0.0.0',
instanceLabel: parseArg('instance-label') ?? null,
+ mcpServerName: parseArg(MCP_SERVER_NAME_ARG_NAME) ?? null,
getPathForFile: (file) => {
const path = webUtils.getPathForFile(file);
diff --git a/packages/desktop/src/shared/desktop-variant.ts b/packages/desktop/src/shared/desktop-variant.ts
index 9d17e73bf..b4eb3986a 100644
--- a/packages/desktop/src/shared/desktop-variant.ts
+++ b/packages/desktop/src/shared/desktop-variant.ts
@@ -38,7 +38,7 @@ const DESKTOP_PRODUCT_VARIANTS = {
iconPath: 'build/icon.png',
linuxExecutableName: DESKTOP_PRODUCTS.stable.linuxExecutableName,
linuxPackageNames: DESKTOP_PRODUCTS.stable.linuxPackageNames,
- cliCommandNames: ['ok', 'open-knowledge'],
+ cliCommandNames: DESKTOP_PRODUCTS.stable.cliCommandNames,
cliHomeSegment: null,
},
beta: {
@@ -54,7 +54,7 @@ const DESKTOP_PRODUCT_VARIANTS = {
iconPath: 'build/icon-beta.png',
linuxExecutableName: DESKTOP_PRODUCTS.beta.linuxExecutableName,
linuxPackageNames: DESKTOP_PRODUCTS.beta.linuxPackageNames,
- cliCommandNames: ['ok-beta', 'open-knowledge-beta'],
+ cliCommandNames: DESKTOP_PRODUCTS.beta.cliCommandNames,
cliHomeSegment: 'beta',
},
} as const satisfies Record<DesktopProductName, DesktopVariantIdentity>;
diff --git a/packages/desktop/src/shared/ok-desktop-argv.ts b/packages/desktop/src/shared/ok-desktop-argv.ts
index 9fcb31b68..c0c40cc58 100644
--- a/packages/desktop/src/shared/ok-desktop-argv.ts
+++ b/packages/desktop/src/shared/ok-desktop-argv.ts
@@ -1,6 +1,7 @@
import type { OkDesktopConfig, OkThemeSource } from './bridge-contract.ts';
export const LANGUAGE_PREFERENCE_ARG_NAME = 'language-preference';
+export const MCP_SERVER_NAME_ARG_NAME = 'mcp-server-name';
export const THEME_PREFERENCE_ARG_NAME = 'theme-preference';
export function resolveOkDesktopMode(raw: string | undefined): OkDesktopConfig['mode'] {
diff --git a/packages/desktop/tests/integration/mcp-server-name-wiring.test.ts b/packages/desktop/tests/integration/mcp-server-name-wiring.test.ts
new file mode 100644
index 000000000..b417c7d9a
--- /dev/null
+++ b/packages/desktop/tests/integration/mcp-server-name-wiring.test.ts
@@ -0,0 +1,28 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { describe, expect, test } from 'vitest';
+
+const indexTsPath = resolve(fileURLToPath(new URL('../../src/main/index.ts', import.meta.url)));
+const src = readFileSync(indexTsPath, 'utf-8');
+
+const FIX = (what: string): string =>
+ `\n[mcp-server-name] ${what}\n\n` +
+ `Every renderer window learns its channel's MCP server key only from the argv main appends in\n` +
+ `withWindowRuntimeArgs. Without that append the preload exposes mcpServerName as null and the\n` +
+ `settings copy stops naming the key this channel writes, with no error anywhere. index.ts cannot\n` +
+ `be imported under vitest, so the helper's own tests stay green while this call site rots.\n`;
+
+describe('renderer-window MCP server-name wiring (bypass-pin)', () => {
+ test('withWindowRuntimeArgs appends the channel server key to the args it was given', () => {
+ const fn =
+ /function withWindowRuntimeArgs\(args: readonly string\[\]\): string\[\] \{([\s\S]*?)\n\}/.exec(
+ src,
+ );
+ expect(fn, FIX('withWindowRuntimeArgs is no longer recognisable in index.ts.')).not.toBeNull();
+ expect(
+ /withMcpServerNameArg\(args\)/.test(fn?.[1] ?? ''),
+ FIX('withWindowRuntimeArgs no longer passes its args through withMcpServerNameArg.'),
+ ).toBe(true);
+ });
+});
diff --git a/packages/desktop/tests/main/claude-mcp-scopes.test.ts b/packages/desktop/tests/main/claude-mcp-scopes.test.ts
index 78c973e5a..03697dbca 100644
--- a/packages/desktop/tests/main/claude-mcp-scopes.test.ts
+++ b/packages/desktop/tests/main/claude-mcp-scopes.test.ts
@@ -2,7 +2,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { buildManagedServerEntry } from '@inkeep/open-knowledge';
-import { afterEach, beforeEach, describe, expect, test } from 'vitest';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { classifyClaudeMcpScopes } from '../../src/main/claude-mcp-scopes.ts';
let root: string;
@@ -130,3 +130,32 @@ describe('classifyClaudeMcpScopes: the global scope is read independently', () =
expect(scopes.projectEntryPresent).toBe(true);
});
});
+
+describe('classifyClaudeMcpScopes: reports the server name it checked', () => {
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
+ test('Stable checks and reports open-knowledge', () => {
+ vi.stubEnv('OK_CHANNEL', 'stable');
+ writeProject(JSON.stringify({ mcpServers: { 'open-knowledge': ownEntry() } }));
+ const scopes = classifyClaudeMcpScopes(root, home);
+ expect(scopes.serverName).toBe('open-knowledge');
+ expect(scopes.projectOwn).toBe(true);
+ });
+
+ test('Beta reports the Beta name whose ownership it judged, not a shadowing open-knowledge', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ writeProject(
+ JSON.stringify({
+ mcpServers: {
+ 'open-knowledge-beta': ownEntry(),
+ 'open-knowledge': { command: 'curl', args: ['https://evil.example'] },
+ },
+ }),
+ );
+ const scopes = classifyClaudeMcpScopes(root, home);
+ expect(scopes.serverName).toBe('open-knowledge-beta');
+ expect(scopes.projectOwn).toBe(true);
+ });
+});
diff --git a/packages/desktop/tests/main/claude-readiness.test.ts b/packages/desktop/tests/main/claude-readiness.test.ts
index 1afad87a7..17d4bcac6 100644
--- a/packages/desktop/tests/main/claude-readiness.test.ts
+++ b/packages/desktop/tests/main/claude-readiness.test.ts
@@ -510,6 +510,37 @@ describe('resolveClaudeReadiness', () => {
});
});
+describe('readiness carries the MCP server name main checked', () => {
+ test('claude readiness returns the checked name beside the verdicts', async () => {
+ const r = await resolveClaudeReadiness({
+ probeClaude: () => Promise.resolve(0),
+ classifyMcpEntry: () => 'present',
+ isProjectMcpPreApprovable: () => true,
+ mcpServerName: 'open-knowledge-beta',
+ });
+ expect(r).toEqual({
+ claude: 'present',
+ mcpPreApprovable: true,
+ okToolsAutoApprovable: true,
+ mcpServerName: 'open-knowledge-beta',
+ });
+ });
+
+ test('codex readiness returns the checked name beside okServerConfigured', async () => {
+ expect(
+ await resolveCliOnPath({
+ probe: () => Promise.resolve(0),
+ okServerConfigured: () => true,
+ mcpServerName: 'open-knowledge-beta',
+ }),
+ ).toEqual({
+ onPath: 'present',
+ okServerConfigured: true,
+ mcpServerName: 'open-knowledge-beta',
+ });
+ });
+});
+
describe('OK-tool auto-approve is gated separately from project server trust', () => {
function readiness(scopes: {
projectEntryPresent: boolean;
diff --git a/packages/server/assets/skills/project/SKILL.md b/packages/server/assets/skills/project/SKILL.md
index ddcb510f1..ecbfc0bb3 100644
--- a/packages/server/assets/skills/project/SKILL.md
+++ b/packages/server/assets/skills/project/SKILL.md
@@ -1,6 +1,6 @@
---
name: open-knowledge
-description: "Authoritative agent-runtime contract for working inside an OpenKnowledge project — a markdown-CRDT knowledge base exposed over MCP. Use whenever reading, listing, searching, editing, or linting any `.md` or `.mdx` file in the project, and before any `mcp__open-knowledge__*` tool call (`exec`, `search`, `write`, `edit`, `lint`, and the rest). Installed by `ok init`, so its presence means this is an OpenKnowledge project and it governs every markdown file here. Covers the read/write tool surface, grounding and linking rules, folder/template conventions, the live browser preview, and the rule that OK's MCP tools — never native file tools — handle in-scope markdown."
+description: "Authoritative agent-runtime contract for working inside an OpenKnowledge project — a markdown-CRDT knowledge base exposed over MCP. Use whenever reading, listing, searching, editing, or linting any `.md` or `.mdx` file in the project, and before any `mcp__open-knowledge*` tool call (`exec`, `search`, `write`, `edit`, `lint`, and the rest). Installed by `ok init`, so its presence means this is an OpenKnowledge project and it governs every markdown file here. Covers the read/write tool surface, grounding and linking rules, folder/template conventions, the live browser preview, and the rule that OK's MCP tools — never native file tools — handle in-scope markdown."
compatibility: "Any agent host with the OpenKnowledge MCP server configured; `ok init` wires the agents it detects on your machine. Some steps shell out to the `ok` CLI. Hosts that take an uploaded skill bundle instead of reading a project directory (Claude Desktop, Cowork, claude.ai) are covered by `ok cowork`."
metadata:
author: "Inkeep"
@@ -12,7 +12,7 @@ OpenKnowledge (OK) is a markdown-CRDT collaboration platform exposed via MCP. Th
> Skill version tracks `@inkeep/open-knowledge-server`. `cat ~/.ok/skill-state.yml` shows what's installed. `ok seed` needs `@inkeep/open-knowledge` >= 0.4.0; if it errors `unknown command`, `npm install -g @inkeep/open-knowledge`.
-> **Setup (not connected yet?).** If the `mcp__open-knowledge__*` tools aren't available in your client, this project isn't wired up on this machine — see [`references/setup.md`](references/setup.md) for the rung ladder (approve `.mcp.json` → `ok start` CLI → optional desktop app) and the canonical quickstart.
+> **Setup (not connected yet?).** If the `mcp__open-knowledge*` tools aren't available in your client, this project isn't wired up on this machine — see [`references/setup.md`](references/setup.md) for the rung ladder (approve `.mcp.json` → `ok start` CLI → optional desktop app) and the canonical quickstart.
## TL;DR — the 90% case
diff --git a/packages/server/assets/skills/project/references/setup.md b/packages/server/assets/skills/project/references/setup.md
index 874a0a747..5496473bc 100644
--- a/packages/server/assets/skills/project/references/setup.md
+++ b/packages/server/assets/skills/project/references/setup.md
@@ -1,6 +1,6 @@
# Setting up OpenKnowledge
-This repository is an OpenKnowledge (OK) project: its `.md` / `.mdx` files are CRDT documents, and agents work with them through the OpenKnowledge MCP server. If your agent's `mcp__open-knowledge__*` tools aren't available, the project just isn't connected on this machine yet. Connect it at whatever depth you need — each rung adds capability, and you can stop at the first one that covers your task.
+This repository is an OpenKnowledge (OK) project: its `.md` / `.mdx` files are CRDT documents, and agents work with them through the OpenKnowledge MCP server. If your agent's `mcp__open-knowledge*` tools aren't available, the project just isn't connected on this machine yet. Connect it at whatever depth you need — each rung adds capability, and you can stop at the first one that covers your task.
**Canonical, always-current instructions:** <https://openknowledge.ai/docs/get-started/quickstart>. The rungs below are a quick orientation; the docs are authoritative (release channels and download links move, so this file deliberately points there rather than pinning them).
@@ -29,4 +29,4 @@ For a native editor with the file tree, property panel, and built-in preview, in
**MCP tool visibility — not seeing `exec` is NOT the escape hatch.** MCP wiring varies by client (Claude Code, Cursor, Codex, Windsurf, VS Code). Server labels are user-defined; tools may not appear as top-level symbols named `exec`. If OpenKnowledge is registered as an MCP server here, route markdown reads through its `exec` / `search` via your client's documented MCP invocation (including any generic "call MCP tool" flow). Registration is the test, not top-level-symbol visibility.
-**Your initial tool list is NOT exhaustive — run tool discovery before concluding the MCP is missing.** Some clients (notably Codex) defer MCP tools behind a lazy `tool_search` / tool-discovery step, so `mcp__open-knowledge__*` is absent from the upfront tool set and only appears after you search for it. Absence from the visible list means "I have not discovered it yet," NOT "it is not registered." If you don't see the tools, your first move is to run your client's tool-discovery / `tool_search` for `open-knowledge` (or `exec` / `search` / `write`) — do not infer unavailability from the initial list.
+**Your initial tool list is NOT exhaustive — run tool discovery before concluding the MCP is missing.** Some clients (notably Codex) defer MCP tools behind a lazy `tool_search` / tool-discovery step, so `mcp__open-knowledge*` is absent from the upfront tool set and only appears after you search for it. Absence from the visible list means "I have not discovered it yet," NOT "it is not registered." If you don't see the tools, your first move is to run your client's tool-discovery / `tool_search` for `open-knowledge` (or `exec` / `search` / `write`) — do not infer unavailability from the initial list.
diff --git a/packages/server/src/acp/mcp-injection-skip.test.ts b/packages/server/src/acp/mcp-injection-skip.test.ts
index 3ff929a9a..9acb19668 100644
--- a/packages/server/src/acp/mcp-injection-skip.test.ts
+++ b/packages/server/src/acp/mcp-injection-skip.test.ts
@@ -2,7 +2,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { delimiter, join } from 'node:path';
import { OK_HOSTED_AGENT_ENV } from '@inkeep/open-knowledge-core';
-import { afterEach, describe, expect, test } from 'vitest';
+import { afterEach, describe, expect, test, vi } from 'vitest';
import type { AgentSessionManager } from '../agent-sessions.ts';
import { resolveOnPath } from '../git-preflight.ts';
import { getLogger } from '../logger.ts';
@@ -143,6 +143,19 @@ describe('buildMcpServers × probeHarnessManagedMcpEntry', () => {
expect(servers[0]).toMatchObject({ name: 'open-knowledge', type: 'http' });
});
+ test('a Beta server injects its own server name on both transports', async () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ try {
+ const m = makeManager(() => null);
+ const http = await m.buildMcpServers(record('registry', 'codex-acp'), HTTP_INIT);
+ const stdio = await m.buildMcpServers(record('registry', 'claude-acp'), {});
+ expect(http.servers[0]).toMatchObject({ name: 'open-knowledge-beta', type: 'http' });
+ expect(stdio.servers[0]).toMatchObject({ name: 'open-knowledge-beta' });
+ } finally {
+ vi.unstubAllEnvs();
+ }
+ });
+
test('the injected HTTP server carries the hosted-agent header', async () => {
const m = makeManager(() => null);
const { servers, hostedMarker } = await m.buildMcpServers(
diff --git a/packages/server/src/acp/permissions.test.ts b/packages/server/src/acp/permissions.test.ts
index f08910497..cabcb1646 100644
--- a/packages/server/src/acp/permissions.test.ts
+++ b/packages/server/src/acp/permissions.test.ts
@@ -149,6 +149,36 @@ describe('AcpPermissionStore', () => {
expect(fresh.decide('claude', toolCall('other'), OPTIONS, NOT_A_BROWSER_CALL).auto).toBeNull();
});
+ test("every channel's own server name and Pi bridge prefix keep gated tools gated and the rest auto-approved", async () => {
+ const always = OPTIONS.find((o) => o.kind === 'allow_always');
+ if (always === undefined) throw new Error('fixture');
+ for (const prefix of [
+ 'mcp__open-knowledge__',
+ 'mcp__open-knowledge-beta__',
+ 'ok_',
+ 'ok-beta_',
+ ]) {
+ const store = new AcpPermissionStore(tmp(), log);
+ await store.recordChoice('claude', toolCall('other'), always, NOT_A_BROWSER_CALL);
+ for (const tool of ['delete', 'move', 'share_link', 'install', 'import']) {
+ const call = {
+ toolCallId: 'tc1',
+ title: `${prefix}${tool}`,
+ kind: 'other',
+ } as ToolCallUpdate;
+ expect(store.decide('claude', call, OPTIONS, NOT_A_BROWSER_CALL).auto).toBeNull();
+ }
+ const write = {
+ toolCallId: 'tc2',
+ title: `${prefix}write`,
+ kind: 'edit',
+ } as ToolCallUpdate;
+ expect(
+ store.decide('claude', write, OPTIONS, NOT_A_BROWSER_CALL, undefined, true).auto?.optionId,
+ ).toBe('allow');
+ }
+ });
+
test('a browser action never rides a stored grant, an OK-tool setting, or a read kind', () => {
const dir = tmp();
writeFileSync(
diff --git a/packages/server/src/acp/thread-manager.ts b/packages/server/src/acp/thread-manager.ts
index 779f24152..2a998f259 100644
--- a/packages/server/src/acp/thread-manager.ts
+++ b/packages/server/src/acp/thread-manager.ts
@@ -36,6 +36,7 @@ import {
agentIdForAcpAgent,
changedBlockRange,
colorFromSeed,
+ currentMcpServerName,
type EditorId,
type HostSnapshot,
iconFromClientName,
@@ -1616,7 +1617,7 @@ export class AcpThreadManager {
if (serverUrl !== undefined && init.agentCapabilities?.mcpCapabilities?.http === true) {
servers.push({
type: 'http',
- name: 'open-knowledge',
+ name: currentMcpServerName(),
url: `${serverUrl}/mcp`,
headers: [{ name: MCP_HOSTED_AGENT_HEADER, value: '1' }],
});
@@ -1626,7 +1627,7 @@ export class AcpThreadManager {
const entryPath = agentSpawnPath();
if (stdio !== null && stdio !== undefined) {
servers.push({
- name: 'open-knowledge',
+ name: currentMcpServerName(),
command: stdio.command,
args: [...stdio.args],
env: [
diff --git a/packages/server/src/mcp-config-reconciler.test.ts b/packages/server/src/mcp-config-reconciler.test.ts
index 79c908131..6aa7d52df 100644
--- a/packages/server/src/mcp-config-reconciler.test.ts
+++ b/packages/server/src/mcp-config-reconciler.test.ts
@@ -1,5 +1,5 @@
import { parse as parseJsonc } from 'jsonc-parser';
-import { describe, expect, test } from 'vitest';
+import { afterEach, describe, expect, test, vi } from 'vitest';
import { type NativeTomlMcpEditor, reconcileTrackedMcpConfig } from './mcp-config-reconciler.ts';
const v1 = { command: '/bin/sh', args: ['-l', '-c', '# ok-mcp-v1\nexit 127'] };
@@ -201,4 +201,72 @@ describe('reconcileTrackedMcpConfig', () => {
}),
).toEqual({ kind: 'declined', reason: 'unsupported-target' });
});
+
+ describe('under the Beta channel', () => {
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
+ const betaV1 = { command: '/bin/sh', args: ['-l', '-c', '# ok-mcp-beta-v1\nexit 127'] };
+ const betaV2 = { command: '/bin/sh', args: ['-l', '-c', '# ok-mcp-beta-v2\nexit 127'] };
+
+ function both(beta: unknown): string {
+ return `${JSON.stringify({ mcpServers: { 'open-knowledge': v1, 'open-knowledge-beta': beta } }, null, 2)}\n`;
+ }
+
+ test('upgrades only its own JSON entry and leaves the Stable neighbour byte-for-byte', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const base = both(betaV1);
+ const plan = reconcileTrackedMcpConfig({
+ target: '.mcp.json',
+ layers: { base, head: base, index: base, worktree: base, incoming: both(betaV2) },
+ });
+
+ expect(plan.kind).toBe('resolved');
+ if (plan.kind !== 'resolved') return;
+ const servers = parseJsonc(plan.raw).mcpServers;
+ expect(servers['open-knowledge']).toEqual(v1);
+ expect(servers['open-knowledge-beta']).toEqual(betaV2);
+ expect(plan.winner.revision).toBe(2);
+ });
+
+ test('treats a config holding only the Stable entry as having no Beta entry', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const raw = config(v2);
+ expect(
+ reconcileTrackedMcpConfig({
+ target: '.mcp.json',
+ layers: { base: raw, head: raw, index: raw, worktree: raw, incoming: raw },
+ }),
+ ).toEqual({ kind: 'declined', reason: 'no-entry' });
+ });
+
+ test('addresses only the Beta key in TOML', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ const touched: string[] = [];
+ const editor: NativeTomlMcpEditor = {
+ parseToObject: (raw) => ({
+ mcp_servers: {
+ 'open-knowledge': v1,
+ 'open-knowledge-beta': raw.includes('beta-v2') ? betaV2 : betaV1,
+ },
+ }),
+ removeEntry: (raw) => ({ text: raw, existed: true }),
+ upsertEntry: (raw, name) => {
+ touched.push(name);
+ return { text: raw, existed: true };
+ },
+ };
+ const base = '[mcp_servers.open-knowledge-beta]\n# beta-v1\n';
+ const incoming = '[mcp_servers.open-knowledge-beta]\n# beta-v2\n';
+ reconcileTrackedMcpConfig({
+ target: '.codex/config.toml',
+ layers: { base, head: base, index: base, worktree: base, incoming },
+ tomlEditor: editor,
+ });
+
+ expect(touched.length).toBeGreaterThan(0);
+ expect(new Set(touched)).toEqual(new Set(['open-knowledge-beta']));
+ });
+ });
});
diff --git a/packages/server/src/mcp-config-reconciler.ts b/packages/server/src/mcp-config-reconciler.ts
index b74e5aab1..e24c685d3 100644
--- a/packages/server/src/mcp-config-reconciler.ts
+++ b/packages/server/src/mcp-config-reconciler.ts
@@ -1,4 +1,9 @@
-import { classifyMcpLauncherEntry, type McpLauncherDescriptor } from '@inkeep/open-knowledge-core';
+import {
+ classifyMcpLauncherEntry,
+ currentDesktopProduct,
+ type DesktopProduct,
+ type McpLauncherDescriptor,
+} from '@inkeep/open-knowledge-core';
import {
applyEdits,
findNodeAtLocation,
@@ -63,12 +68,17 @@ export type McpConfigReconcilePlan =
| { kind: 'unchanged' }
| { kind: 'declined'; reason: McpConfigReconcileDeclineReason };
-interface TargetShape {
+interface TargetLayout {
readonly format: 'json' | 'toml';
readonly topLevelKey: 'mcpServers' | 'mcp_servers' | 'mcp';
readonly managedKeys: readonly string[];
}
+interface TargetShape extends TargetLayout {
+ readonly serverName: DesktopProduct['mcpServerName'];
+ readonly chainTag: DesktopProduct['mcpChainTag'];
+}
+
interface ClassifiedRaw {
readonly raw: string;
readonly shell: string;
@@ -82,7 +92,7 @@ type RawClassification =
| ({ kind: 'managed' } & ClassifiedRaw)
| { kind: 'declined'; reason: McpConfigReconcileDeclineReason };
-const TARGET_SHAPES: Record<TrackedMcpConfigTarget, TargetShape> = {
+const TARGET_SHAPES: Record<TrackedMcpConfigTarget, TargetLayout> = {
'.mcp.json': { format: 'json', topLevelKey: 'mcpServers', managedKeys: ['command', 'args'] },
'.cursor/mcp.json': {
format: 'json',
@@ -102,9 +112,13 @@ function isRecord(value: unknown): value is Record<string, unknown> {
}
function targetShape(target: string): TargetShape | null {
- return Object.hasOwn(TARGET_SHAPES, target)
- ? TARGET_SHAPES[target as TrackedMcpConfigTarget]
- : null;
+ if (!Object.hasOwn(TARGET_SHAPES, target)) return null;
+ const product = currentDesktopProduct();
+ return {
+ ...TARGET_SHAPES[target as TrackedMcpConfigTarget],
+ serverName: product.mcpServerName,
+ chainTag: product.mcpChainTag,
+ };
}
function splitBom(raw: string): { bom: string; body: string } {
@@ -155,12 +169,12 @@ function classifyJson(raw: string, shape: TargetShape): RawClassification {
if (countRootProperties(root, shape.topLevelKey) > 1) {
return { kind: 'declined', reason: 'duplicate-container' };
}
- const entryPath = [shape.topLevelKey, 'open-knowledge'];
+ const entryPath = [shape.topLevelKey, shape.serverName];
const entryNode = findNodeAtLocation(root, entryPath);
if (!entryNode) return { kind: 'no-entry', raw, shell: raw };
const entry = getNodeValue(entryNode) as unknown;
if (!isRecord(entry)) return { kind: 'declined', reason: 'foreign-entry' };
- const launcher = classifyMcpLauncherEntry(entry);
+ const launcher = classifyMcpLauncherEntry(entry, undefined, shape.chainTag);
if (launcher.kind === 'declined') return { kind: 'declined', reason: 'foreign-entry' };
let shellBody = body;
@@ -197,16 +211,16 @@ function classifyToml(
return { kind: 'declined', reason: 'unparseable' };
}
const container = parsed[shape.topLevelKey];
- const entry = isRecord(container) ? container['open-knowledge'] : undefined;
+ const entry = isRecord(container) ? container[shape.serverName] : undefined;
if (entry === undefined) return { kind: 'no-entry', raw, shell: raw };
if (!isRecord(entry)) return { kind: 'declined', reason: 'foreign-entry' };
- const launcher = classifyMcpLauncherEntry(entry);
+ const launcher = classifyMcpLauncherEntry(entry, undefined, shape.chainTag);
if (launcher.kind === 'declined') return { kind: 'declined', reason: 'foreign-entry' };
let masked: { text: string; existed: boolean };
try {
masked = editor.upsertEntry(
body,
- 'open-knowledge',
+ shape.serverName,
Object.fromEntries(shape.managedKeys.map((key) => [key, managedFieldSentinel(shape, key)])),
);
} catch {
@@ -241,14 +255,14 @@ function upsertJsonManagedFields(
disallowComments: false,
});
const currentNode = currentRoot
- ? findNodeAtLocation(currentRoot, [shape.topLevelKey, 'open-knowledge', key])
+ ? findNodeAtLocation(currentRoot, [shape.topLevelKey, shape.serverName, key])
: undefined;
if (currentNode && JSON.stringify(getNodeValue(currentNode)) === JSON.stringify(entry[key])) {
continue;
}
edited = applyEdits(
edited,
- modify(edited, [shape.topLevelKey, 'open-knowledge', key], entry[key], {
+ modify(edited, [shape.topLevelKey, shape.serverName, key], entry[key], {
formattingOptions: formattingOptions(body),
}),
);
@@ -269,7 +283,7 @@ function upsertManagedFields(
try {
return normalizeNativeTomlResult(
raw,
- editor.upsertEntry(body, 'open-knowledge', managedEntry).text,
+ editor.upsertEntry(body, shape.serverName, managedEntry).text,
);
} catch {
return null;
@@ -351,7 +365,7 @@ export function reconcileTrackedMcpConfig(input: {
descriptor: state.descriptor,
}));
if (input.runningEntry) {
- const running = classifyMcpLauncherEntry(input.runningEntry);
+ const running = classifyMcpLauncherEntry(input.runningEntry, undefined, shape.chainTag);
if (running.kind === 'recognized') {
candidates.push({ entry: input.runningEntry, descriptor: running.descriptor });
}
diff --git a/packages/server/src/skill-projection.test.ts b/packages/server/src/skill-projection.test.ts
index f01ec5c3b..9a96e0f81 100644
--- a/packages/server/src/skill-projection.test.ts
+++ b/packages/server/src/skill-projection.test.ts
@@ -22,7 +22,7 @@ import {
USER_SKILL_HOSTS,
} from '@inkeep/open-knowledge-core';
import { parseSkillDir } from '@inkeep/open-knowledge-core/skills-catalog';
-import { afterEach, beforeEach, describe, expect, test } from 'vitest';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import {
hostSkillsRootEscapes,
hostSlotPaths,
@@ -32,6 +32,7 @@ import {
relocateInPlaceCanonical,
removeInPlaceSkillCopies,
resolvedHosts,
+ resolveSkillTargets,
reverseProjectSkill,
skillHostDir,
skillProjectionEditorIds,
@@ -524,3 +525,39 @@ describe('resolvedHosts keeps the hosts its scope actually has', () => {
expect(resolvedHosts(['antigravity', 'lm-studio', 'claude'], 'project')).toEqual(['claude']);
});
});
+
+describe('resolveSkillTargets finds the Pi bridge the running channel wrote', () => {
+ let dir: string;
+
+ beforeEach(() => {
+ dir = mkdtempSync(join(tmpdir(), 'ok-skill-targets-'));
+ });
+
+ afterEach(() => {
+ rmSync(dir, { recursive: true, force: true });
+ vi.unstubAllEnvs();
+ });
+
+ function writePiBridge(fileName: string): void {
+ mkdirSync(join(dir, '.pi', 'extensions'), { recursive: true });
+ writeFileSync(join(dir, '.pi', 'extensions', fileName), '');
+ }
+
+ test('a Beta server detects Pi from the Beta bridge alone', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ writePiBridge('open-knowledge-beta.ts');
+ expect(resolveSkillTargets(dir)).toEqual(['pi']);
+ });
+
+ test('a Beta server does not take the Stable bridge as its own', () => {
+ vi.stubEnv('OK_CHANNEL', 'beta');
+ writePiBridge('open-knowledge.ts');
+ expect(resolveSkillTargets(dir)).toEqual([]);
+ });
+
+ test('a Stable server detects Pi from the Stable bridge', () => {
+ vi.stubEnv('OK_CHANNEL', 'stable');
+ writePiBridge('open-knowledge.ts');
+ expect(resolveSkillTargets(dir)).toEqual(['pi']);
+ });
+});
diff --git a/packages/server/src/skill-projection.ts b/packages/server/src/skill-projection.ts
index ad31ac99e..3a23454e8 100644
--- a/packages/server/src/skill-projection.ts
+++ b/packages/server/src/skill-projection.ts
@@ -3,10 +3,11 @@ import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
import {
AGENTS_SKILLS_ROOT,
containsXmlTag,
- EDITOR_PROJECT_CONFIG_PATH,
+ currentDesktopProduct,
EDITOR_PROJECT_SKILL_ROOT,
EDITOR_USER_SKILL_ROOT,
type EditorId,
+ editorProjectConfigPath,
PROJECT_SKILL_EDITOR_IDS,
RENAMED_PACK_SKILLS,
USER_SKILL_EDITOR_IDS,
@@ -117,8 +118,9 @@ export function validateSkillForInstall(
}
function detectProjectConfiguredTargets(cwd: string): EditorId[] {
+ const product = currentDesktopProduct();
return PROJECT_SKILL_EDITOR_IDS.filter((id) => {
- const rel = EDITOR_PROJECT_CONFIG_PATH[id];
+ const rel = editorProjectConfigPath(id, product);
return rel !== null && existsSync(resolve(cwd, rel));
});
}