Configuration Overview
Relevant source files
The following files were used as context for generating this wiki page:
The Container Use MCP extension for Zed enables the integration of the Model Context Protocol (MCP) server provided by Container Use. This system provides containerized environments for coding agents directly within the Zed editor, ensuring that agent actions are isolated and manageable.
The configuration of this extension involves defining the path to the cu binary, setting up project-specific agent rules, and managing the communication between Zed and the MCP server via standard input/output (stdio).
Sources: README.md:1-5, extension.toml:1-5
Binary Discovery and Path Resolution
The extension must locate the cu binary to start the MCP server. It follows a hierarchical resolution strategy: it first checks for a user-defined path in the Zed settings; if not found, it attempts to discover the binary in the system PATH.
The diagram above illustrates the logic used by the extension to resolve the executable path for the MCP server.
Sources: src/container_use_mcp.rs:21-50
Discovery Mechanisms
| Mechanism | Description | Implementation Detail |
|---|---|---|
| User Settings | Explicit path provided in settings.json. | ContainerUseMcpSettings.cu_path |
| System PATH | Automatic discovery using the which command. | zed::process::Command::new("which") |
| Caching | The resolved path is stored in memory to avoid repeated lookups. | cached_binary_path: Option<String> |
Sources: src/container_use_mcp.rs:10-13, src/container_use_mcp.rs:21-48, extension.toml:11-14
Extension Settings Structure
The extension utilizes Zed's settings API to allow project-specific or global configuration. The configuration is validated against a JSON schema generated from Rust data structures.
Data Model
The settings are defined using the ContainerUseMcpSettings struct, which is deserializable and supports JSON schema generation.
#[derive(Debug, Deserialize, JsonSchema)]
struct ContainerUseMcpSettings {
/// Path to the cu binary (optional - will download if not provided)
cu_path: Option<String>,
}
Sources: src/container_use_mcp.rs:10-14, Cargo.toml:16-18
Configuration Parameters
Users can configure the extension in settings.json under the context_servers key.
| Parameter | Type | Default | Description |
|---|---|---|---|
cu_path | String (Optional) | None | Absolute path to the cu binary. If omitted, the extension searches the system PATH. |
Sources: README.md:17-27, src/container_use_mcp.rs:13-14
Agent Rules and Environment Setup
To ensure coding agents correctly utilize the containerized environment, a specific .rules file must be present in the project root. This file contains the instructions for the agent to interface with the cu server.
Manual Setup
The environment requires an external rules file fetched from the Dagger repository.
curl -o .rules https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
Sources: README.md:29-34, configuration/installation_instructions.md:1-1
Server Initialization Sequence
When Zed activates the extension, it initializes the ContextServerCommand. This process involves reading current settings and constructing the command-line execution parameters.
The sequence diagram details the interaction between Zed and the extension to launch the MCP server process.
Sources: src/container_use_mcp.rs:55-80
Execution Details
- Command: The resolved path to the
cubinary. - Arguments: The extension passes
stdioas the primary argument, indicating the communication channel for the MCP protocol. - Environment: No specific environment variables are injected by default.
Sources: src/container_use_mcp.rs:77-81
Technical Metadata
The extension is identified by unique identifiers within the Zed ecosystem and uses the following metadata for registration.
| Attribute | Value | Source |
|---|---|---|
| Extension ID | mcp-server-container-use | extension.toml:1 |
| Context Server ID | container-use-mcp | extension.toml:16 |
| Crate Type | cdylib | Cargo.toml:10 |
| API Version | 0.5.0 | Cargo.toml:18 |
Summary
The Configuration Overview for the Container Use MCP extension highlights a streamlined setup process that prioritizes automatic discovery of the cu binary via the system PATH. For advanced environments, it provides a simple JSON-based configuration to override the binary location. The integration is completed by ensuring project-level agent rules are established, allowing Zed coding agents to operate within secure, containerized environments managed by the MCP server.