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.
Before you start
Section titled “Before you start”- An approved account and an API key from the API keys page.
- A VM. Make one with Files and programs over HTTP.
- An MCP client that reads
.mcp.jsonfrom the project directory, such as Claude Code.
1. Create a folder and a grant
Section titled “1. Create a folder and a grant”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.
export SI_API_KEY=si_...export VM=6f1c0f0e8acurl -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}'API reference: Control API operation
import os, requests
vm = os.environ["VM"]headers = {"Authorization": f"Bearer {os.environ['SI_API_KEY']}"}requests.post( f"https://{vm}.slashinfra.dev/usr/bin/env", params=[("arg", "mkdir"), ("arg", "-p"), ("arg", "/home/user/project")], headers=headers,).raise_for_status()res = requests.post( f"https://api.slashinfra.com/svms/{vm}/grants", headers=headers, json={"methods": ["GET", "PUT"], "paths": ["/home/user/project/**"], "ttl_s": 86400},)res.raise_for_status()print(res.json()["url"])const vm = process.env.VM!const headers = { Authorization: `Bearer ${process.env.SI_API_KEY!}` }const mkdirUrl = new URL(`https://${vm}.slashinfra.dev/usr/bin/env`)for (const arg of ['mkdir', '-p', '/home/user/project']) mkdirUrl.searchParams.append('arg', arg)const mkdir = await fetch(mkdirUrl, { method: 'POST', headers })if (!mkdir.ok) throw new Error(`mkdir failed: ${mkdir.status}`)const res = await fetch(`https://api.slashinfra.com/svms/${vm}/grants`, { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ methods: ['GET', 'PUT'], paths: ['/home/user/project/**'], ttl_s: 86400 }),})if (!res.ok) throw new Error(`grant failed: ${res.status}`)const grant = (await res.json()) as { url: string }console.log(grant.url){"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.
2. Add the server to your client
Section titled “2. Add the server to your client”Save this file as .mcp.json in the project directory. Replace <id> with your VM id and <grant> with the si_access value.
{ "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.
3. Call a tool
Section titled “3. Call a tool”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.
Check it works
Section titled “Check it works”You should see the text you wrote in the result of read.
If it doesn’t work
Section titled “If it doesn’t work”| 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.
Clean up
Section titled “Clean up”Rotating the grants ends every grant that the VM issued, so the client stops working. The folder stays until you delete the VM.
curl -sS -X POST "https://api.slashinfra.com/svms/$VM/grants/rotate" \ -H "Authorization: Bearer $SI_API_KEY"API reference: Control API operation
import os, requests
res = requests.post( f"https://api.slashinfra.com/svms/{os.environ['VM']}/grants/rotate", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(res.json()["generation"])const res = await fetch(`https://api.slashinfra.com/svms/${process.env.VM!}/grants/rotate`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(`rotate failed: ${res.status}`)const rotated = (await res.json()) as { generation: number }console.log(rotated.generation){"generation":1}- Files and programs over HTTP: the requests behind these five tools.
- Grants: mint a grant with other methods, paths or a shorter life.
- Security: what a full-control grant allows.