🧢

Container UseをClaude CodeのMCPサーバとして試してみた

に公開

概要

Container Useがどういったものかを触ってみたくて、Claude CodeのMCPサーバとして試しときのメモ書きです。

Container Use

https://github.com/dagger/container-use

cuコマンドのインストール

curlを使用してcuコマンドをインストール。

curl -fsSL https://raw.githubusercontent.com/dagger/container-use/main/install.sh | bash

cuコマンドが使えることを確認。

$ cu --help                                                                                                                                               
MCP server to add container superpowers to your AI agent.

Usage:
  cu [command]

(略)

Claude Codeとの連携設定

Claude Codeでcontainer-useをMCPサーバとして使用するには、cuコマンドのパスが必要となる。

npx @anthropic-ai/claude-code mcp add container-use -- <full path to cu command> stdio

cuコマンドのパスを確認する。

$ which cu
/home/vscode/.local/bin/cu

ひとまずスコープをprojectにして、mcp addを実行。

npx @anthropic-ai/claude-code mcp add container-use -s project -- /home/vscode/.local/bin/cu stdio

https://docs.anthropic.com/en/docs/claude-code/mcp#understanding-mcp-server-scopes

プロジェクト配下の.mcp.jsonに、container-useが追加された。

{
  "mcpServers": {
    "container-use": {
      "type": "stdio",
      "command": "/home/vscode/.local/bin/cu",
      "args": [
        "stdio"
      ],
      "env": {}
    }
  }
}

CLAUDE.md にagent.mdの内容を追加。

curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> CLAUDE.md

Claude Codeを起動して指示を出すと、container-use を使用するかどうかの確認が表示されたので、適宜承認して作業を進めてもらいました。

● container-use:environment_open (MCP)(source: "/XXX", name: "XXX", explanation: "Opening environment to XXX")

...

(略)

同時に cu watchを使用して、エージェントの動きを観察していると、Claude Codeで実施された内容が、作業ブランチのコミットログとして表示された。

今回は1つの作業だけを試してみたけれど、今度は複数の作業を、それぞれの環境でブランチを作って実施してくれるのかを試してみたい。

Discussion