コーディングエージェントがDockerに求めること
実際のプロジェクトで作業するエージェントは、同じような質問を繰り返します。何が動いているか、ポート3000のアプリは何か、なぜこのコンテナが終了したか、ログには何があるか、使い捨て環境でテストできるか。シェルだけなら、docker ps、docker inspect、docker logsを実行し、返る行をすべて読んで答えます。機能はしますが、毎ターン生のJSONや何百行ものログをモデルのコンテキストに入れるため、遅く、費用もかかります。
MCPサーバーは、それらの質問を答えそのものを返すツールに変えます。OxcartのツールはDocker APIのエンドポイントではなく質問に合わせて設計されているため、1回の呼び出しで一連のコマンドを置き換えます。
13のツール
| 目的 | ツール | Level needed |
|---|---|---|
| 確認 | status, projects, ports, images, logs | Read only(読み取り専用) |
| 説明 | diagnose:終了コード、OOMによる強制終了、ヘルスチェックの失敗、ポートの問題、重要なログ行 | Read only(読み取り専用) |
| 操作 | container(起動・停止・再起動)、exec、compose(up・down)、ネットワークなしのsandbox | Manage(管理) |
| 変更と整理 | build、remove、cleanup(先にプレビュー)、ネットワーク付きのsandbox | Full(すべての操作) |
statusは各Composeプロジェクトのフォルダー、gitブランチ、localhost URLを表示するので、「ポート3000のアプリ」をユーザーとエージェントが同じものとして把握できます。リソースを購読するクライアントは、クラッシュ、OOMによる強制終了、正常性の変化を、ポーリングせず発生時に知ることができます。
回答を小さく、セッションを安く
各質問に答えるためエージェントがOxcart経由で読む内容と、代わりに読むことになるdocker CLI出力を比較しました。同じコンテナを同時点で測定しています。
| 質問 | Oxcart MCP | 相当するdocker CLIコマンド | docker CLI | 削減倍率 |
|---|---|---|---|---|
| このコンテナはなぜ停止した? | 159 | inspect + logs --tail 300 | 2,014 | 13× |
| 直近500行のログにエラーはある? | 39 | logs --tail 500 | 703 | 18× |
| 何が動いている? | 106 | ps -a + stats --no-stream + compose ls -a | 332 | 3.1× |
5つのテストコンテナを使用しました(クラッシュ、異常状態、OOM終了、Composeプロジェクト、公開ポート)。ログが長くなってもdiagnoseとlogsのサイズは変わりません。ツール一覧自体のコストはセッションごとに1回で、読み取り専用レベル(6ツール)は510トークン、全13ツールでは1,463トークンです。
セッション全体でも同じ傾向でした。Claude Opus 5.5を使うClaude Codeに2つの日常的な質問をし、docker CLIのみの場合とOxcartのMCPサーバーを使う場合を比較しました。どちらも両方の質問に正しく答えました。
| タスク | 時間 | 費用 | トークン数 | ターン数 |
|---|---|---|---|---|
「workerでエラーが出ている?エラーを見せて。」 | 4.2 s 対 31.0 s | $0.022 対 $0.157 | 10,686 対 52,266 | 2 対 8 |
「apiコンテナが何度も落ちる。なぜ?」 | 8.5 s 対 14.9 s | $0.036 対 $0.070 | 11,283 対 19,510 | 2 対 4 |
Oxcartあり・なしで各タスクを1セッションずつ、人工的に用意したテストコンテナとOxcart 0.1.0で実行した参考値です。費用はプロンプトキャッシュに左右され、実行順序も交互にはしていません。
任意のコーディングエージェントにOxcartのMCPサーバーを設定する
- Oxcartをインストールします。 Oxcart(Appleシリコン、macOS 26以降)をダウンロードして開きます。セットアップはオフラインで数秒で完了します。
- Copy the setup sentence. Open MCP Integrations in Oxcart's sidebar and copy the sentence: “Set up Oxcart's MCP server for me: run
/Applications/Oxcart.app/Contents/Helpers/oxcart agent setupand follow its instructions. If you can't run commands, tell me to copy the entry under "Agent can't run commands?" in Oxcart › MCP Integrations.” - エージェントに貼り付けます。 Claude Code、Codex、Cursorなど、コマンドを実行できるエージェントに貼り付けます。エージェントがコマンドを実行し、自分用の手順を読んで、
oxcartというサーバーを登録します。 - Ask about your containers. Ask “what is running?” or “why did
apistop?”. The agent appears on the MCP Integrations page, at Manage, with every call in its activity log. - Change the level if you want. Lower the agent to Read only to let it look but change nothing, or raise it to Full to let it build, remove and clean up. Block refuses every call. Agents set up with an earlier version of Oxcart keep their level.
Claude Desktop can't run commands, so you add the entry yourself. In Claude, Settings › Developer › Edit Config opens ~/Library/Application Support/Claude/claude_desktop_config.json. Add oxcart under mcpServers, keeping any servers already there, then quit and reopen Claude:
{
"mcpServers": {
"oxcart": {
"command": "/Applications/Oxcart.app/Contents/Helpers/oxcart",
"args": ["mcp", "--client", "claude-desktop"]
}
}
} Apps opened from the Dock or Finder don't search your shell's PATH, so every entry names the full path to oxcart, even with Oxcart's command-line tools installed. Other apps that can't run commands, such as LM Studio, take the entry Oxcart shows under Agent can't run commands? on the MCP Integrations page.
For Claude Code, the direct command is:
claude mcp add -s user oxcart -- /Applications/Oxcart.app/Contents/Helpers/oxcart mcp --client claude-code Codexではcodex mcp add oxcart -- /Applications/Oxcart.app/Contents/Helpers/oxcart mcp --client codexで、Codex CLIとIDE拡張機能にサーバーを登録します。
エージェントごとに設定する権限レベル
| レベル | エージェントができること |
|---|---|
| Read only(読み取り専用) | コンテナ、ログ、ポート、プロジェクト、イメージの確認と障害の診断 |
| Manage (default) | Also start, stop and restart, run commands, Compose up and down, run sandboxes without network, with images already on your Mac |
| Full(すべての操作) | さらにビルド・削除・クリーンアップと、サンドボックスへのネットワークアクセス付与 |
| Block(ブロック) | 操作不可。ツールを表示せず、すべての呼び出しを拒否し、理由をエージェントに伝える |
Every call is logged on your Mac and shown on the MCP Integrations page; nothing leaves the Mac. The levels govern what Oxcart's tools do for an agent. They are not a sandbox: an agent that can run shell commands can still run docker itself, so pair them with your agent's own command permissions.
設定手順を用意しているエージェント
Claude Code, Claude Desktop, Codex, Cursor, VS Code with Copilot, Devin Desktop, Zed, Gemini CLI, GitHub Copilot CLI, OpenCode, Cline, Junie, JetBrains AI Assistant, Goose, Kiro, Amp, Warp and LM Studio, plus a step for any other MCP client. The steps come from your installed copy of Oxcart (/Applications/Oxcart.app/Contents/Helpers/oxcart agent setup), with your Mac's real paths, so they work offline and match your version.
MCP以外のエージェント用コンテナワークフロー
- Dev Containers:エージェントをDev Container内で動かし、シェル、ツール、ネットワークをプロジェクトのコンテナ内に保ちます。OxcartはDev Containers CLIを実行できます。MacでDev ContainersとTestcontainersを使うをご覧ください。
- 高速な反復:エージェントはコンテナの実行と破棄を繰り返します。Oxcartは
docker run --rmが42 ms、20コンテナの停止・削除が77 msで、テストした3つのランタイムの中で最速でした(比較)。 - Composeスタック:エージェントの
composeツールはManageレベルでプロジェクトをup・downできます。AppleシリコンでDocker Composeを使うをご覧ください。
よくある質問
MacのDockerコンテナ用MCPサーバーはありますか?
はい。Oxcart内蔵のoxcart mcpはローカルstdio MCPサーバーで、状態、診断、ログ、ポート、イメージ、exec、Compose、ビルド、サンドボックス、クリーンアップ用の13ツールを備えています。ネットワークポートで待ち受けず、トークンも不要です。
Claude CodeをDockerコンテナに接続するには?
Oxcartの設定用の文をClaude Codeに貼り付けるか、claude mcp add -s user oxcart -- /Applications/Oxcart.app/Contents/Helpers/oxcart mcp --client claude-codeを実行します。Claude Codeにoxcartサーバーが表示され、ツールを呼び出せるようになります。
Codex、Cursor、Copilotを使うVS Codeにも対応しますか?
Oxcartは、Codex、Cursor、Copilotを使うVS Code、Claude Desktop、Zed、Gemini CLI、GitHub Copilot CLI、Cline、Goose、Kiro、Amp、Warp、LM Studioを含む18のクライアント向け設定手順と、その他のMCPクライアント向け共通手順を用意しています。最初から最後まで実行確認したクライアントはClaude Codeです。
エージェントはコンテナやボリュームを削除できますか?
Not by default. New agents start at Manage: they can start, stop and restart containers, run commands in them and bring Compose projects up and down with images already on your Mac, but not pull, build or delete. Removing containers, images and volumes and cleaning up need Full. Agents set up with an earlier version of Oxcart keep their level, and you can lower an agent to Read only, raise it to Full, or Block it. At Full, cleanup first returns a preview and a token, and deletes only what that preview listed. The levels govern Oxcart's tools; they are not a sandbox, so an agent with shell access can still run the docker CLI directly.
エージェントにdockerコマンドを直接実行させるだけではだめですか?
できますが、大量の生の出力を読み込むことになります。「このコンテナはなぜ停止した?」への回答に、Oxcartのdiagnoseは159トークン、docker inspectとdocker logs --tail 300は2,014トークンを要し、削減倍率は13×でした。各タスク1回のClaude Codeセッションによる参考値では、ログ内のエラー発見が31.0 sから4.2 sになりました。
MCPサーバーはデータを外部に送信しますか?
いいえ。ローカルエンジンのソケットとのみ通信し、自身でネットワーク接続を行いません。すべての呼び出しをMacのアクティビティログに記録します。ただし、ツールが起動やビルドにイメージを必要とする場合は、docker runと同じようにレジストリからpullします。
使い捨てコンテナでエージェントにコードを実行させられますか?
はい。sandboxツールは、メモリ2 GiB、プロセス数1,024に制限した使い捨てコンテナを作ります。エージェントがFullレベルでネットワークを要求した場合を除き、ネットワークはありません。
出典と測定方法
- 回答サイズ:2026-10-10に5つのテストコンテナで測定。トークン数は文字数 ÷ 4で推定。
- セッション:Claude Code 2.1.296、
claude-opus-5-5、Oxcart 0.1.0。各タスク・各条件で1回実行。 - 速度の数値:Oxcart 0.1.2、2026-10-10、Apple M5 Max、8 CPU・12 GiB。比較対象のランタイムは同日のそれ以前に、同じMacと測定ハーネスでdocker 29.4クライアントを使って測定しました。