Shell
Calling it
This is your own data, so a call has to say who you are. Make a token at /token and send it as a header.
curl -H "Authorization: Bearer $MU_TOKEN" \ https://micro.mu/api/v1/shell/run
Methods
POST /api/v1/shell/runRun a shell command in your account's container sandbox and get back what it wrote. A real shell in a container: pipes, redirection and && all work, the working directory is /work and files there persist between calls. Use it to build, test, run scripts and move files about. A non-zero exit code comes back in the response rather than as an error, so read the output — a failing build is an answer
| Argument | Type | Description |
|---|---|---|
command * | string | A shell command to run, e.g. 'go test ./... 2>&1 | tail -40' |
dir | string | Directory to run it in, under /work. Defaults to /work |
timeout | number | Seconds to allow, up to the instance's maximum. Defaults to 120 |
curl -X POST \
-H "Authorization: Bearer $MU_TOKEN" \
-H "Content-Type: application/json" \
-d '{"command":"command"}' \
https://micro.mu/api/v1/shell/runPOST /api/v1/shell/writePut a file in your account's container sandbox, creating any missing directories. The only file operation that is not a shell command, because it is the one a shell is bad at: source is full of quotes and backticks and a heredoc will mangle it. The content arrives as a string and reaches the file without a shell seeing it. To read, list, search or change a file, use the shell — cat, ls, grep and sed are right there
| Argument | Type | Description |
|---|---|---|
path * | string | Where to put it, relative to /work — not to the directory your last command left you in. Missing directories are created |
content * | string | The whole file. This replaces what was there |
curl -X POST \
-H "Authorization: Bearer $MU_TOKEN" \
-H "Content-Type: application/json" \
-d '{"content":"content","path":"path"}' \
https://micro.mu/api/v1/shell/writeThe same methods are tools over MCP, and every service on this instance is in one reference.
