You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
claude: Add MCP accses to sandbox environment (#13149)
Viral was complaining that Claude was inefficient at doing Yggdrasil
work, to which I said "Skill issue". In particular, Claude does not have
the capability to interactively inspect the sandbox in order to diagnose
failures - it must modify the script and re-run it. This takes forever.
This PR attempts to fix that by providing a (vibe-coded) repo-specific
MCP server that simply launches a the provided script with `--debug`
and proxies inputs and outputs to claude in the MCP format that it
understands. The tool structure deliberately mirrors the ordinary
claude bash/edit tools, to make sure that claude's tuning applies.
The implementaiton is extremely jank, but does seem to basically work.
I may do some more work to clean it up, but I also expect that Claude
will gain the ability to natively interact with stdin at some point
at which point it could just call `--debug` itself, so if that happens
first we can delete this again.
instructions="BinaryBuilder sandbox manager for Yggdrasil. "*
80
+
"Use sandbox_start to launch an interactive cross-compilation environment, "*
81
+
"sandbox_exec to run commands inside it, and sandbox_stop when done.")
82
+
83
+
# Register sessioned bash tools for sandbox management
84
+
register_sessioned_bash!(server, manager;
85
+
prefix="sandbox",
86
+
start_description="""Launch a new BinaryBuilder sandbox session for interactive cross-compilation debugging.
87
+
88
+
Returns a session_id to use with sandbox_exec. The sandbox provides a full BinaryBuilder environment with cross-compilation toolchains, compilers (CC, CXX, FC), and standard environment variables (prefix, WORKSPACE, target, libdir, bindir, etc.).
89
+
90
+
The session is persistent: working directory changes, environment variable modifications, and other shell state carry over between sandbox_exec calls.
91
+
92
+
Starting a session may take 1-3 minutes on first run as compiler shards are downloaded and mounted.""",
93
+
exec_description="""Execute a bash command inside a running BinaryBuilder sandbox session.
94
+
95
+
The session is persistent - working directory and environment changes carry over between commands. Both stdout and stderr are captured and returned interleaved.
96
+
97
+
Inside the sandbox you have access to cross-compilers (\$CC, \$CXX, \$FC), the target platform triplet (\$target), install prefix (\$prefix), and all standard BinaryBuilder environment variables.""",
98
+
stop_description="Stop a running BinaryBuilder sandbox session and clean up resources.",
99
+
list_description="List all active BinaryBuilder sandbox sessions with their IDs, platforms, and uptime.",
"description"=>"Optional absolute or relative path to a build_tarballs.jl file. When specified, the build script runs with the selected debug_mode and then drops into an interactive shell. Sources are downloaded and extracted into the workspace.",
108
+
),
109
+
"debug_mode"=>Dict{String,Any}(
110
+
"type"=>"string",
111
+
"description"=>"Debug mode when build_tarballs_path is set. 'end' (default): run the full build script, then drop into a shell to inspect results. 'begin': drop into a shell before the build script runs, so you can execute build steps manually.",
112
+
"enum"=> Any["begin", "end"],
113
+
),
114
+
))
115
+
116
+
# Register sessioned str_replace_editor for editing files inside the sandbox
"""View, create, and edit files inside a running BinaryBuilder sandbox session.
120
+
121
+
Uses the same command interface as str_replace_editor (view/str_replace/create) but operates on files inside the sandbox filesystem rather than the host. Requires a session_id from sandbox_start.
122
+
123
+
Paths should be absolute paths inside the sandbox (e.g. /workspace/srcdir/..., \$prefix/lib/...)."""))
0 commit comments