Introduction to zed-container-use-mcp
Relevant source files
The following files were used as context for generating this wiki page:
The zed-container-use-mcp extension is a Rust-based integration for the Zed editor that facilitates the use of the Model Context Protocol (MCP) via the Container Use server. Its primary purpose is to provide coding agents within Zed with isolated, containerized environments for executing tasks, thereby enhancing security and environment reproducibility during AI-assisted development.
Sources: README.md:1-5, extension.toml:1-4
System Architecture
The extension acts as a bridge between the Zed editor's extension host and the cu (Container Use) binary. It implements the zed::Extension trait to manage the lifecycle and configuration of the MCP server.
Core Components
| Component | Description |
|---|---|
ContainerUseMcpExtension | The main state holder for the extension, managing cached binary paths. |
ContainerUseMcpSettings | Data structure for user-defined configuration, specifically the path to the cu binary. |
cu Binary | The external command-line tool that provides the actual containerized MCP server functionality. |
Sources: src/container_use_mcp.rs:11-19, extension.toml:13-16
Binary Discovery Logic
The extension employs a multi-step process to locate the cu binary required to start the context server. It first checks for user-defined settings, then falls back to the system's PATH.
The logic for locating the binary is implemented in the context_server_binary_path method, which utilizes system commands to resolve the executable location.
Sources: src/container_use_mcp.rs:24-52, extension.toml:10-14
Configuration and Integration
The extension integrates with Zed's settings system and requires specific project-level rules to guide AI agents into the containerized environment.
Settings Schema
The extension defines a JSON schema for its settings, allowing users to override the default behavior via Zed's settings.json.
| Field | Type | Description |
|---|---|---|
cu_path | Option<String> | Manual path to the cu executable. |
Sources: src/container_use_mcp.rs:11-15, README.md:19-29
Extension Capabilities
The extension explicitly declares its need to execute system processes to find the cu binary.
[[capabilities]]
kind = "process:exec"
command = "which"
args = ["cu"]
Sources: extension.toml:10-14
Initialization Flow
When Zed initializes the extension, it configures the command necessary to launch the MCP server using the Standard Input/Output (stdio) communication channel.
Setup Requirements
For the extension to function correctly, users must ensure the cu binary is installed and agents are instructed to use it.
- Binary Installation: The
cubinary must be built from source or installed in the system path. - Agent Rules: A
.rulesfile must be placed in the project root to ensure agents utilize the containerized environment. This file is typically fetched from the Daggercontainer-userepository.
Sources: README.md:7-17, configuration/installation_instructions.md:1-1
Summary
The zed-container-use-mcp extension provides a seamless integration between the Zed editor and containerized execution environments. By automating the discovery of the cu binary and providing a standardized MCP interface via stdio, it enables secure and isolated tool execution for AI agents directly within the developer's workflow.