Skip to content

Your VM has an MCP server. An MCP client can read files, write files and run commands in it, within the access a grant allows.

A grant names the HTTP methods and paths that a client may use. This grant allows reads and writes under one folder for one day. It does not allow commands, because running a command is a POST.

Terminal window
export SI_API_KEY=si_...
export VM=6f1c0f0e8a
curl -sS -X POST "https://$VM.slashinfra.dev/usr/bin/env?arg=mkdir&arg=-p&arg=/home/user/project" \
-H "Authorization: Bearer $SI_API_KEY"
curl -sS -X POST "https://api.slashinfra.com/svms/$VM/grants" \
-H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \
-d '{"methods":["GET","PUT"],"paths":["/home/user/project/**"],"ttl_s":86400}'
Output
{"url":"https://6f1c0f0e8a.slashinfra.dev/?si_access=eyJ...","expires_at":...,"generation":...}

The si_access value in url is the grant. Keep it private. It stops working when you rotate the grants of the VM.

Save this file as .mcp.json in the project directory. Replace <id> with your VM id and <grant> with the si_access value.

.mcp.json
{
"mcpServers": {
"vm": {
"type": "http",
"url": "https://<id>.slashinfra.dev/.well-known/si/mcp",
"headers": { "X-Si-Authorization": "Bearer <grant>" }
}
}
}

Start the client from that directory. It lists five tools from the server.

Tool Arguments What it does
exec path, args?, stdin?, cwd?, timeout_s? Runs the executable at path and returns its exit code, stdout and stderr. Use /bin/bash with ["-c", "…"] for a shell command.
read path Reads a file or lists a directory.
write path, content Replaces a file atomically.
job_start script, cwd? Starts a background job and returns its number.
job_wait number, timeout_s? Waits for a job and returns its log and exit code.

Scroll horizontally to see all columns.

Ask the client to write a file, then read it back. For example, ask it to write /home/user/project/notes.txt with write, then to read the same path with read.

The grant admits GET and PUT under /home/user/project, so read and write succeed. The grant refuses exec and job_start, because they send a POST. A refused call does not wake the VM.

The MCP server counts as VM API traffic. The transfer limits and the per-VM request limit apply, and a tool call keeps the VM awake. job_wait waits in steps of at most 25 seconds, so set timeout_s to cap the whole wait. A grant for the desktop (port 6080) or for /bin/bash gives full control of the VM. Read security before you grant either.

There is no MCP server for the control API, so a chat app cannot create or delete a VM through MCP. An agent with a shell uses the si CLI instead. Its skill file is at slashinfra.com/skills/si/SKILL.md.

You should see the text you wrote in the result of read.

Symptom Cause Fix
The client lists no tools The client did not start in the folder with .mcp.json. Start the client from that folder, then check the file’s url and header.
The call fails with an authorization error The grant is wrong, expired or was rotated. Create a new grant in step 1 and replace the header value.
A tool call is refused The method or the path is outside the grant. Create a grant that includes that method and path.

Scroll horizontally to see all columns.

Rotating the grants ends every grant that the VM issued, so the client stops working. The folder stays until you delete the VM.

Terminal window
curl -sS -X POST "https://api.slashinfra.com/svms/$VM/grants/rotate" \
-H "Authorization: Bearer $SI_API_KEY"
Output
{"generation":1}