Skip to main content

Agent Plugin Setup

mcp-exec ships plugin manifests for every supported AI agent. Each manifest registers the MCP server, wires skills, and sets the correct MCP_EXEC_RUNTIME env var so the server selects the right sandbox path at startup.

How Detection Works​

mcp-exec reads the MCP_EXEC_RUNTIME environment variable at startup to select a sandbox strategy:

ValueSandboxConfig source
(absent)SRT (@anthropic-ai/sandbox-runtime)~/.claude/settings.json + .claude/settings.json
opencodeSRT~/.srt-settings.json + .srt-settings.json
codexCodex native (Seatbelt / bwrap)~/.codex/config.toml (diagnostics only)

Each plugin manifest sets this env var automatically. You do not need to set it manually.


Claude Code​

Plugin manifest: .claude-plugin/plugin.json

Install​

claude plugin install joeblackwaslike/mcp-exec

Or manually add to your Claude Code MCP config:

.claude/mcp.json
{
"mcpServers": {
"mcp-exec": {
"command": "npx",
"args": ["@joeblackwaslike2/mcp-exec"]
}
}
}

Skills​

Claude Code discovers skills from the plugin's skills/ directory automatically. To also prime the activation rule into your CLAUDE.md (recommended — increases skill trigger reliability from ~60% to ~95%):

mcp-exec-prime-skill

This appends a one-time activation rule to your project's CLAUDE.md. Run it once per project.

Sandbox configuration​

MCP_EXEC_RUNTIME is not set — mcp-exec uses SRT and reads from ~/.claude/settings.json.

Add a sandbox block to configure network and filesystem access:

~/.claude/settings.json
{
"sandbox": {
"network": {
"allowedDomains": ["api.github.com", "*.googleapis.com"]
},
"filesystem": {
"allowWrite": ["~/.mcp-exec/sessions", "/tmp", "./output"],
"denyRead": ["~/.ssh", "~/.aws"]
},
"env": {
"allow": ["PATH", "HOME", "TMPDIR", "USER", "GITHUB_TOKEN"]
}
}
}

Project-scope overrides go in .claude/settings.json at the project root. Array fields are merged (union + dedup) across user and project configs.


OpenCode​

Plugin file: .opencode/plugins/mcp-exec.js

Install​

Copy or symlink the plugin file into your OpenCode plugins directory:

cp .opencode/plugins/mcp-exec.js ~/.opencode/plugins/mcp-exec.js

Or reference the project-local plugin in your OpenCode config.

What the plugin does​

The plugin hooks three things:

  1. Skills — pushes the skills/ directory to config.skills.paths so OpenCode auto-discovers using-mcp-exec and mcp-exec-dev-workflow
  2. MCP server — registers mcp-exec in config.mcp.servers with MCP_EXEC_RUNTIME=opencode
  3. Bootstrap injection — prepends the using-mcp-exec skill content to the first user message of each conversation so the model knows the tools are available without waiting for a skill trigger

Sandbox configuration​

OpenCode does not provide a native OS sandbox. mcp-exec uses SRT and reads from ~/.srt-settings.json.

Create this file with your sandbox policy:

~/.srt-settings.json
{
"network": {
"allowedDomains": ["api.github.com", "*.googleapis.com"]
},
"filesystem": {
"allowWrite": ["~/.mcp-exec/sessions", "/tmp"],
"denyRead": ["~/.ssh", "~/.aws"]
},
"env": {
"allow": ["PATH", "HOME", "TMPDIR", "USER", "GITHUB_TOKEN"]
}
}

For project-specific overrides, create .srt-settings.json in the project root. The format is identical — arrays are merged across user and project files.

The ~/.mcp-exec/sessions path is always added to allowWrite even if absent from your config.


Codex CLI​

Plugin manifest: .codex-plugin/plugin.json

Install​

Add mcp-exec to your Codex config:

~/.codex/config.toml
[mcp_servers.mcp-exec]
command = "npx"
args = ["@joeblackwaslike2/mcp-exec"]

[mcp_servers.mcp-exec.env]
MCP_EXEC_RUNTIME = "codex"

Skills​

The plugin manifest declares "skills": "./skills/". Codex auto-discovers skills from this path when the plugin is installed. No manual step required.

Sandbox​

Codex provides platform-native sandboxing. mcp-exec does not initialize SRT when MCP_EXEC_RUNTIME=codex is set. Codex's OS-level sandbox handles all enforcement.

PlatformMechanismPrerequisites
macOSSeatbelt (sandbox-exec)None — built into macOS
Linuxbubblewrap (bwrap)sudo apt install bubblewrap (Ubuntu)
WSL2bubblewrap in WSL2Same as Linux
WindowsWindows SandboxManaged by Codex

Configure the sandbox in your Codex config:

~/.codex/config.toml
sandbox_mode = "workspace-write"
approval_policy = "on-request"

See the Codex Sandboxing reference for full details.


Gemini CLI​

Extension manifest: .gemini-plugin/gemini-extension.json

Install​

Copy the extension to your Gemini extensions directory:

cp -r .gemini-plugin/ ~/.gemini/extensions/mcp-exec/

Gemini auto-discovers extensions in ~/.gemini/extensions/. The extension registers the MCP server and loads skills automatically — no further configuration needed.

Manual registration (without the extension):

~/.gemini/settings.json
{
"mcpServers": {
"mcp-exec": {
"command": "npx",
"args": ["@joeblackwaslike2/mcp-exec"],
"env": { "MCP_EXEC_RUNTIME": "gemini" }
}
}
}

Skills​

The extension includes a GEMINI.md context file that references both skills via @ includes. Gemini loads this as always-on context at session start. The skills/ subdirectory is also auto-discovered for on-demand skill activation.

Sandbox​

Gemini provides opt-in native OS sandboxing. mcp-exec does not initialize SRT when MCP_EXEC_RUNTIME=gemini is set — Gemini's sandbox handles OS-level enforcement when enabled.

Enable the sandbox:

export GEMINI_SANDBOX=true # auto-select mechanism
# or in ~/.gemini/settings.json: "tools": { "sandbox": true }

Sandbox mechanisms by platform:

PlatformMechanismNotes
macOSSeatbelt (sandbox-exec)GEMINI_SANDBOX=sandbox-exec
Linuxbubblewrap (bwrap)GEMINI_SANDBOX=bwrap — requires apt install bubblewrap
Linux (high isolation)gVisor (runsc)GEMINI_SANDBOX=runsc — strongest isolation
AllDocker / PodmanGEMINI_SANDBOX=docker or podman
caution

Gemini's sandbox is opt-in. Without it, no OS-level isolation is active when running under Gemini. mcp-exec logs a warning at startup if it detects no sandbox.

See the Gemini Sandboxing reference for full details.


Cursor​

Plugin manifest: .cursor-plugin/plugin.json

Install​

Copy the plugin to your Cursor plugins directory:

cp -r .cursor-plugin/ ~/.cursor/plugins/mcp-exec/

Or add the MCP server manually to ~/.cursor/mcp.json:

~/.cursor/mcp.json
{
"mcpServers": {
"mcp-exec": {
"command": "npx",
"args": ["@joeblackwaslike2/mcp-exec"],
"env": { "MCP_EXEC_RUNTIME": "cursor" }
}
}
}

A project-level .cursor/mcp.json takes precedence over the global config.

Skills​

The plugin manifest declares "skills": "./skills/" for on-demand skill discovery. An always-on rule at .cursor/rules/mcp-exec.mdc (registered via "rules": ".cursor/rules/") loads activation context into every session with alwaysApply: true. Install it manually for project-scoped activation:

cp .cursor/rules/mcp-exec.mdc .cursor/rules/

Sandbox​

Cursor provides no native MCP sandbox — MCP servers run with full Cursor process permissions. mcp-exec uses SRT and reads from ~/.cursor/srt-settings.json:

~/.cursor/srt-settings.json
{
"network": { "allowedDomains": ["api.github.com"] },
"filesystem": { "allowWrite": ["/tmp"], "denyRead": ["~/.ssh"] },
"env": { "allow": ["PATH", "HOME", "TMPDIR", "USER"] }
}

Project overrides go in .cursor/srt-settings.json at the project root. See the Cursor Sandboxing reference for full details.


Summary: Skills Wiring Per Agent​

AgentSkills mechanismAuto or manual
Claude Codeskills/ dir in plugin manifest + mcp-exec-prime-skill primes CLAUDE.mdAuto-discover; prime command recommended
OpenCodeconfig.skills.paths in plugin hook + bootstrap injection in every conversationFully automatic
Codex CLIskills/ field in plugin manifestFully automatic
Gemini CLIcontextFileName: GEMINI.md + skills/ in extensionFully automatic
Cursorskills/ in plugin manifest + alwaysApply rule in .cursor/rules/Fully automatic via plugin

Adding a New Agent​

To wire mcp-exec into a new agent:

  1. Register the MCP server with MCP_EXEC_RUNTIME=<agent-name> as an env var

  2. Add a detection function in src/sandbox/config.ts:

    export function isMyAgentRuntime(): boolean {
    return process.env.MCP_EXEC_RUNTIME === 'my-agent';
    }
  3. Add a branch in initializeSandbox() in src/server.ts — either skip SRT (if the agent provides native sandboxing) or call SRT with an appropriate config resolver

  4. Point the agent at the skills/ directory so it discovers using-mcp-exec and mcp-exec-dev-workflow