Skip to content

Commit a5b455a

Browse files
authored
fix: idempotent container-use config claude (#293)
* fixes #249 - remove server config prior to adding it for idempotency Signed-off-by: Connor Braa <connor@dagger.io> * change format of AGENT.md to match cu config agent claude Signed-off-by: Connor Braa <connor@dagger.io> --------- Signed-off-by: Connor Braa <connor@dagger.io>
1 parent cf02018 commit a5b455a

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

AGENT.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ This is a development environment for container-use, a CLI tool that provides co
22

33
container-use is designed to work with MCP-compatible agents like Claude Code and Cursor.
44

5-
ENVIRONMENT:
6-
7-
- ALWAYS use ONLY Environments for ANY and ALL file, code, or shell operations—NO EXCEPTIONS—even for simple or generic requests.
8-
- DO NOT install or use the git cli with the environment_run_cmd tool. All environment tools will handle git operations for you. Changing ".git" yourself will compromise the integrity of your environment.
9-
- You MUST inform the user how to view your work using `container-use log <env_id>` AND `container-use checkout <env_id>`. Failure to do this will make your work inaccessible to others.
10-
115
DEVELOPMENT WORKFLOW:
126

137
- Build: Use 'go build -o container-use ./cmd/container-use' or 'dagger call build --platform=current export --path ./container-use'
@@ -47,4 +41,13 @@ DOCS:
4741

4842
- Documentation is in `./docs`, written using Mintlify
4943
- When making changes, make sure the files are properly formatted in mdx
50-
- To start a preview, run `mint dev` from the docs folder
44+
- To start a preview, run `mint dev` from the docs folder
45+
46+
<!-- container-use-rules -->
47+
ALWAYS use ONLY Environments for ANY and ALL file, code, or shell operations—NO EXCEPTIONS—even for simple or generic requests.
48+
49+
DO NOT install or use the git cli with the environment_run_cmd tool. All environment tools will handle git operations for you. Changing ".git" yourself will compromise the integrity of your environment.
50+
51+
You MUST inform the user how to view your work using `container-use log <env_id>` AND `container-use checkout <env_id>`. Failure to do this will make your work inaccessible to others.
52+
53+
<!-- container-use-rules -->

cmd/container-use/agent/configure_claude.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ func (c *ConfigureClaude) description() string {
4242
}
4343

4444
func (c *ConfigureClaude) editMcpConfig() error {
45+
// Remove existing MCP server (ignore errors if it doesn't exist)
46+
removeCmd := exec.Command("claude", "mcp", "remove", "container-use")
47+
_ = removeCmd.Run() // Ignore error - server might not exist
48+
4549
// Add MCP server
4650
cmd := exec.Command("claude", "mcp", "add", "container-use", "--", ContainerUseBinary, "stdio")
4751
err := cmd.Run()

0 commit comments

Comments
 (0)