Skip to main content

Overview

Container Use works with any coding agent that supports the Model Context Protocol (MCP). This page provides comprehensive setup guides for all supported agents.
All agents use the same MCP server command: cu stdio

Claude Code

Install Claude Code

npm install -g @anthropic-ai/claude-code

Add MCP Configuration

cd /path/to/repository
claude mcp add container-use -- <full path to cu command> stdio

Add Agent Rules (Optional)

Save the CLAUDE.md file at the root of your repository:
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> CLAUDE.md

Trust Only Container Use Tools (Optional)

For maximum security, restrict Claude Code to only use Container Use tools:
claude --allowedTools mcp__container-use__environment_checkpoint,mcp__container-use__environment_create,mcp__container-use__environment_add_service,mcp__container-use__environment_file_delete,mcp__container-use__environment_file_list,mcp__container-use__environment_file_read,mcp__container-use__environment_file_write,mcp__container-use__environment_open,mcp__container-use__environment_run_cmd,mcp__container-use__environment_update

Amazon Q Developer

Add MCP Configuration

Add this configuration to ~/.aws/amazonq/mcp.json:
{
  "mcpServers": {
    "container-use": {
      "command": "cu",
      "args": ["stdio"],
      "env": {},
      "timeout": 60000
    }
  }
}

Add Agent Rules

Save agent instructions to your project root:
mkdir -p ./.amazonq/rules && curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md > .amazonq/rules/container-use.md

Trust Only Container Use Tools (Optional)

q chat --trust-tools=container_use___environment_checkpoint,container_use___environment_file_delete,container_use___environment_file_list,container_use___environment_file_read,container_use___environment_file_write,container_use___environment_open,container_use___environment_run_cmd,container_use___environment_update

Video Tutorial

Watch the Amazon Q Developer setup walkthrough

Cursor

Install MCP Server

Use the one-click deeplink to install (requires Cursor and Container Use already installed): Install MCP Server

Add Agent Rules

Add the rules file to your project or home directory:
curl --create-dirs -o .cursor/rules/container-use.mdc https://raw.githubusercontent.com/dagger/container-use/main/rules/cursor.mdc

Windsurf

Install MCP Server

In ~/.codeium/windsurf/mcp_config.json, add the following configuration:
{
  "mcpServers": {
    "container-use": {
      "command": "cu",
      "args": ["stdio"],
      "env": {}
    }
  }
}

Add Agent Rules

Add the rules file to your project or home directory:
curl --create-dirs -o .windsurf/rules/container-use.mdc https://raw.githubusercontent.com/dagger/container-use/main/rules/windsurf.mdc

VSCode / GitHub Copilot

Configure MCP Server

Update your VSCode settings with:
"mcp": {
  "servers": {
    "container-use": {
      "type": "stdio",
      "command": "cu",
      "args": ["stdio"]
    }
  }
}

Add Copilot Instructions (Optional)

curl --create-dirs -o .github/copilot-instructions.md https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md

Video Tutorial

Watch the VSCode setup walkthrough

Zed

First add the agent rules file, either as .rules in the root of your project or as one of the other acceptable files/locations.
curl -o .rules https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
Then configure the Container Use MCP server in the Zed settings.json. Provide the absolute path to the cu executable:
"context_servers": {
  "container-use": {
    "source": "custom",
    "command": {
      "path": "/opt/homebrew/bin/cu",
      "args": ["stdio"],
      "env": {}
    }
  }
}

Add Container Use Agent Profile (Optional)

To lock the Zed agent out of your host system, you can create a dedicated agent profile that only enables Container Use tools. Add this to your settings.json under the agent section:
"agent": {
  "profiles": {
    "container-use": {
      "name": "Container Use",
      "tools": {
        "fetch": true,
        "thinking": true,
        "copy_path": false,
        "find_path": false,
        "delete_path": false,
        "create_directory": false,
        "list_directory": false,
        "diagnostics": false,
        "read_file": false,
        "open": false,
        "move_path": false,
        "grep": false,
        "edit_file": false,
        "terminal": false
      },
      "enable_all_context_servers": false,
      "context_servers": {
        "container-use": {
          "tools": {
            "environment_create": true,
            "environment_add_service": true,
            "environment_update": true,
            "environment_run_cmd": true,
            "environment_open": true,
            "environment_file_write": true,
            "environment_file_read": true,
            "environment_file_list": true,
            "environment_file_delete": true,
            "environment_checkpoint": true
          }
        }
      }
    }
  }
}
This profile ensures your agent can only use Container Use tools, preventing it from modifying your local files directly. Next open the Zed Agent Panel ✨ in the lower right, select the “Container Use” profile from the dropdown to the left of the model dropdown, and prompt away!

OpenCode

Configure the Container Use MCP server in a opencode.json file.
Note: Provide the absolute path to your systems cu executable:
{
  "$schema": "http://opencode.ai/config.json",
  "mcp": {
    "container-use": {
      "type": "local",
      "command": ["/path/to/cu", "stdio"],
      "enabled": true
    }
  }
}
Add the AGENTS.md file using this command (this is optional but usually provides the best results):
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> AGENTS.md
Run opencode and dispatch your agents to complete your tasks!

Goose

Method 1: Configuration File

Add to ~/.config/goose/config.yaml:
extensions:
  container-use:
    name: container-use
    type: stdio
    enabled: true
    cmd: cu
    args:
      - stdio
    envs: {}

Method 2: Interactive Setup

goose configure
Then add a command line extension with cu stdio as the command.

Method 3: Goose Desktop

Paste this URL into your browser:
goose://extension?cmd=cu&arg=stdio&id=container-use&name=container%20use&description=use%20containers%20with%20dagger%20and%20git%20for%20isolated%20environments

Cline

Add MCP Configuration

Add to your Cline MCP server configuration JSON:
{
  "mcpServers": {
    "container-use": {
      "disabled": false,
      "timeout": 60000,
      "type": "stdio",
      "command": "cu",
      "args": ["stdio"],
      "env": {},
      "autoApprove": []
    }
  }
}

Add Agent Rules

curl --create-dirs -o .clinerules/container-use.md https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md

Qodo Gen

Setup Steps

  1. Open Qodo Gen chat panel in VSCode or IntelliJ
  2. Click “Connect more tools”
  3. Click ”+ Add new MCP”
  4. Add this configuration:
{
  "mcpServers": {
    "container-use": {
      "command": "cu",
      "args": ["stdio"]
    }
  }
}

Kilo Code

Add MCP Configuration

Add at global or project level:
{
  "mcpServers": {
    "container-use": {
      "command": "replace with pathname of cu",
      "args": ["stdio"],
      "env": {},
      "alwaysAllow": [],
      "disabled": false
    }
  }
}
Kilo Code allows setting MCP servers at the global or project level. Learn more: Kilo Code MCP Documentation

OpenAI Codex

Add MCP Configuration

Add to ~/.codex/config.toml:
[mcp_servers.container-use]
command = "cu"
args = ["stdio"]
env = {}

Warp

Add MCP Configuration

In the Warp sidebar, under Personal → MCP Servers → New:
{
  "container-use": {
    "command": "cu",
    "args": ["stdio"],
    "env": {},
    "working_directory": null,
    "start_on_launch": true
  }
}
Warp 2.0 introduces coding agents with MCP support.

Gemini CLI

Add MCP Configuration

Add to ~/.gemini/settings.json or .gemini/settings.json:
{
  "coreTools": [],
  "mcpServers": {
    "container-use": {
      "command": "cu",
      "args": ["stdio"],
      "timeout": 60000,
      "trust": true
    }
  }
}

Verification

After setting up your agent, verify Container Use is working:
  1. Check MCP Connection: Your agent should recognize Container Use tools
  2. Test Environment Creation: Ask your agent to create a new environment
  3. Verify Isolation: Multiple environments should work independently

Troubleshooting

  • Verify the cu command is in your PATH: which cu
  • Check MCP configuration syntax
  • Restart your agent after configuration changes
  • Ensure Docker is running and accessible - Check file permissions for configuration files - Verify cu stdio command works: echo '{}' | cu stdio
  • Some agents require explicit tool trust/approval
  • Check your agent’s MCP server logs
  • Verify Container Use tools are enabled in agent settings

Next Steps

I