A desktop coding agent with free access to frontier models.
TypeScript
docs: project config code and MCP runners
Samrat Talukdare93a60f7a907
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.tsindex 23ef8912..75f5ab32 100644--- a/apps/app/src/app/lib/omnirush-server.ts+++ b/apps/app/src/app/lib/omnirush-server.ts@@ -688,7 +688,7 @@ export type OmniRushMcpPolicyView = {decisions: OmniRushMcpDecision[];reportAt: number | null;/** What of the project's own config the engine left out (plugins, language server and formatter commands). */- ignored?: Array<{ kind: "plugin" | "lsp" | "formatter"; name: string; source: string | null }>;+ ignored?: Array<{ kind: "plugin" | "lsp" | "formatter" | "provider"; name: string; source: string | null }>;/** One line about it, or null. */ignoredNotice?: string | null;};diff --git a/apps/app/tests/mcp-supported-panel.test.tsx b/apps/app/tests/mcp-supported-panel.test.tsxindex 1ac64a77..4b3089ff 100644--- a/apps/app/tests/mcp-supported-panel.test.tsx+++ b/apps/app/tests/mcp-supported-panel.test.tsx@@ -121,6 +121,9 @@ describe("Settings > MCP: supported servers", () => {expect(projectCodeNotice("ws_1", line)).toBeNull();expect(projectCodeNotice("ws_2", line)).not.toBeNull();expect(projectCodeNotice("ws_3", null)).toBeNull();+ const providers = "Not loaded from this project's config: model provider settings. A project's own plugins, tools, commands and providers could run code just by opening it; the built-in language servers and formatters still work, and your own (user-level) settings apply as usual.";+ expect(render({ policy: policy({ ignored: [{ kind: "provider", name: "provider", source: "/repo/opencode.json" }], ignoredNotice: providers }) })).toContain("model provider settings");+ expect(projectCodeNotice("ws_4", providers)?.text).toBe(providers);});test("a missing runner says how to fix it", () => {diff --git a/apps/server/src/mcp-allow/state.test.ts b/apps/server/src/mcp-allow/state.test.tsindex f43ccc3a..724c7fd5 100644--- a/apps/server/src/mcp-allow/state.test.ts+++ b/apps/server/src/mcp-allow/state.test.ts@@ -160,11 +160,13 @@ describe("the engine plugin (omnirush-mcp-policy)", () => {test("the report lists what the engine left out of the project's config", async () => {const { state, root } = setup();const hooks = await omnirushMcpPolicy({ directory: root });- const ignored = [{ kind: "plugin", name: "file:///repo/.opencode/plugins/evil.ts", source: "/repo/.opencode/plugins" }, { kind: "lsp", name: "custom", source: "/repo/opencode.json" }];+ const ignored = [{ kind: "plugin", name: "file:///repo/.opencode/plugins/evil.ts", source: "/repo/.opencode/plugins" }, { kind: "lsp", name: "custom", source: "/repo/opencode.json" }, { kind: "provider", name: "provider", source: "/repo/opencode.json" }];await hooks.config({}, { mcp: {}, omnirush_ignored: ignored });const report = workspaceMcpReport(state, root);- expect(report?.ignored?.map((item) => item.kind)).toEqual(["plugin", "lsp"]);- expect(describeIgnored(report?.ignored)).toContain("Not loaded from this project's config: plugins evil.ts; language servers custom.");+ expect(report?.ignored?.map((item) => item.kind)).toEqual(["plugin", "lsp", "provider"]);+ expect(describeIgnored(report?.ignored)).toContain("Not loaded from this project's config: plugins evil.ts; language servers custom; model provider settings.");+ // The desktop shows this line as it is (GET /workspace/:id/mcp ignoredNotice): no path that only fits the CLI.+ expect(describeIgnored(report?.ignored)).toContain("your own (user-level) settings");});test("a project whose sandbox is on runs its servers through the box shell", async () => {diff --git a/docs/skills-and-mcp.md b/docs/skills-and-mcp.mdindex 9e1afc6b..feed494d 100644--- a/docs/skills-and-mcp.md+++ b/docs/skills-and-mcp.md@@ -105,12 +105,27 @@ To remove a server added in the app, choose Remove (`DELETE /workspace/:id/mcp/:- The server gives the engine `OMNIRUSH_MCP_POLICY_FILE`, `OMNIRUSH_MCP_REPORT_DIR` and `OMNIRUSH_MCP_WORKSPACE_DIR`. The engine plugin `omnirush-mcp-policy` (always loaded, last in the plugin list) adds the project's app-added servers to its config, then replaces `mcp` with the allowed servers only, keyed by id, pinned, paths checked, and run through the sandbox shell when the project's sandbox is on. It writes a report per project (`<server state>/mcp/reports/`) with one decision per entry; `GET /workspace/:id/mcp` returns it.- Nothing is pushed into a running engine: an added server starts when the project's engine instance reloads. The engine's own routes that would add a server at runtime or run its OAuth flow are refused; listing and connect/disconnect pass.- Playwright opens pages on this machine only (localhost); other pages are refused before the tool runs.-- `npx` and `uvx` are run from their full path on `PATH`, never from a folder inside the project; when neither is found outside the project the server is blocked (`runner_missing`).-- The engine runs with `OMNIRUSH_PROJECT_CODE=0`: a project's own config (its `opencode.json` and `.opencode` folders) brings no plugins and no language server or formatter commands, since those would run code just by opening the project. What was left out is in the report and shown once as a notice and in Settings > MCP. The app's own plugins and language servers come from its runtime config and still load; `OMNIRUSH_PROJECT_CODE=1` in the app's own environment turns this off.+- Allowed servers are always started by the app itself, from the package registry, with `npx` or `uvx` found by full path in the PATH folders (relative entries and folders inside the project are skipped; on Windows, npm's `node.exe` runs `npx-cli.js` directly instead of the `npx.cmd` batch file). The entry's own program path and runner flags are not used; npx runs with its own empty `--prefix` folder, so a project's `.npmrc` and `node_modules` copy are not read, and uvx runs with `--no-config`, so a project's `uv.toml` is not. If no `npx`/`uvx` is found, the server does not start (`runner_missing`).+- Only the server package is pinned: the packages it depends on are resolved by npm/uv when it starts, so they can differ over time. Environment variables in an entry are dropped, except the file settings a server needs (the memory server's file).- MCP tools reach the model as `<id>_<tool>` and are asked about like other tools (no allow rules are added for them).- The preview engine (v2) cannot apply the list: MCP stays off there (its servers are removed before each request, and a prompt in a project with MCP servers is refused with a message).- Uploads: a session in a project with at least one server on gets `environment.mcp_servers: [{id, package, version, runtime, sandbox}]`; other sessions upload exactly as before.+### A project's own plugins, tools and providers++A folder you open (a repository you cloned, say) should not run its own code just by being opened. So the app starts the engine with `OMNIRUSH_PROJECT_CODE=0`, and the engine does not load, from a project's own config (`opencode.json`/`.jsonc` in the folder or above it up to the repository root, `tui.json`, and the project's `.opencode/` folders):++- plugins (`plugin` entries, `.opencode/plugin(s)/*.js|ts` files, and plugins in a project `tui.json`); the project's `.opencode/` folders get no package install either;+- custom tools (`.opencode/tool(s)/*.js|ts`);+- `lsp` and `formatter` entries that name a command or set its environment (the engine's built-in language servers and formatters still run, and settings without a command, such as `disabled`, still apply);+- model provider settings (`provider`, `enabled_providers`, `disabled_providers`), which could name a package to install or send requests elsewhere.++The engine also looks up the programs it starts itself (language servers, formatters) only in absolute PATH folders outside the project, never in the project folder first.++What was left out is shown once as a notice when a chat in that project opens, and in Settings > MCP. Your own user-level config and the app's own plugins and language servers (its runtime config file) are not affected. To load a project's plugins and settings anyway, start the app with `OMNIRUSH_PROJECT_CODE=1` in its own environment (a project cannot set it).++What this does not cover: once the agent works in the project, it runs the project's own code by design, for example when it runs the tests or a build. The built-in TypeScript, ESLint and Biome servers and the Prettier formatter also use the project's own installed copy and config files when the agent edits a file of theirs. Agent and command files in `.opencode/` (Markdown prompts) and `instructions` still apply; they change what the agent is told, not what runs on their own. Turn on the project's Linux sandbox to keep that work off your machine.+### Coexistence with the omnirush.ai providerThe engine-visible config file is rendered from the engine-global runtime row plus static built-ins: