Zudoku
Concepts

MCP server

InterfacesAPICLISDKs

The MCP server gives an AI assistant typed tools for Unikraft Cloud. An assistant such as Claude Code, Claude Desktop, or Cursor then manages instances, volumes, services, and sandboxes without running CLI commands and parsing their output. The server speaks the Model Context Protocol (MCP).

You can use the server in two ways:

  • The hosted server at https://mcp.unikraft.com/mcp. You sign in through the console and install nothing.
  • The local server, unikraft mcp. It runs on your machine and uses your CLI profile.

Both serve the same tools, with the differences listed below.

Use the hosted server

Add the server to your assistant by its address, https://mcp.unikraft.com/mcp. The page at mcp.unikraft.com has the same steps, with buttons that add the server to Cursor and VS Code.

Claude

This works on claude.ai, and in the Claude desktop and mobile apps:

  • Open Settings, then Connectors, and select Add custom connector.
  • Name it Unikraft Cloud, and enter the address https://mcp.unikraft.com/mcp.
  • Select Add, then Connect, and sign in to Unikraft Cloud.

On a Team or Enterprise plan, an owner first adds the connector under Organization settings, then Connectors.

Claude Code

TerminalCode
claude mcp add --transport http --scope user unikraft-cloud https://mcp.unikraft.com/mcp

Then, in Claude Code, run /mcp, choose unikraft-cloud, and choose Authenticate to sign in. Without --scope user, only the current project gets the server.

Cursor

Add the server under mcpServers in ~/.cursor/mcp.json:

JSONCode
"unikraft-cloud": { "url": "https://mcp.unikraft.com/mcp" }

Then sign in from Customize in the sidebar, or run agent mcp login unikraft-cloud.

VS Code

The tools work in the agent mode of GitHub Copilot Chat.

TerminalCode
code --add-mcp '{"name":"unikraft-cloud","type":"http","url":"https://mcp.unikraft.com/mcp"}'

VS Code asks you to sign in when it starts the server.

Codex

TerminalCode
codex mcp add unikraft-cloud --url https://mcp.unikraft.com/mcp codex mcp login unikraft-cloud

Gemini CLI

TerminalCode
gemini mcp add --transport http --scope user unikraft-cloud https://mcp.unikraft.com/mcp

Then, in Gemini CLI, run /mcp auth unikraft-cloud to sign in.

Other clients

Any MCP client with the Streamable HTTP transport and OAuth can connect. Give it the address https://mcp.unikraft.com/mcp. The client registers itself with the server.

Sign in

The first time the assistant connects, it opens your browser:

  • You sign in to the console and pick an organization.
  • A page asks if the assistant may manage the resources of that organization. Select Allow.
  • The browser returns to the assistant, which can now call the tools.

The first connection can take up to 20 seconds, while the metros learn the new sign-in.

Each sign-in acts on one organization, across its metros. To work on another organization, sign in again and pick it. The server accepts only its own sign-in, so an API token from the console doesn't work as a credential.

The sign-in lasts 30 days, and the assistant renews its access by itself during that time. It ends earlier when you sign out of the console or leave the organization. The assistant then asks you to sign in again.

Check that it works

Ask your assistant:

Code
List the Unikraft Cloud metros I can deploy to, and the instances in my organization. Only read: don't create, change or delete anything.

The assistant only lists them, so nothing in your organization changes.

Use the local server

unikraft mcp serves the protocol over standard input and output. Register it with your assistant as a command. In Claude Code:

TerminalCode
claude mcp add unikraft -- unikraft mcp

In a client that takes a JSON configuration:

JSONCode
{"mcpServers": {"unikraft": {"command": "unikraft", "args": ["mcp"]}}}

The tools use the current profile and query every metro of it, like the matching CLI commands. The server reads the configuration file again on every tool call. unikraft login and unikraft profile use take effect without a restart. To keep the server on one profile, start it with --profile <name>.

Limit the tools

Two flags reduce what the assistant can do:

FlagEffect
--read-onlyServe only the tools that can't change anything: the list tools, image_get, instance_logs, and sandbox_read.
--resourcesServe only the tools of the resource types that you list, for example --resources instance,volume,metro.

The resource types are the prefixes of the tool names: certificate, image, instance, instance_checkpoint, instance_template, metro, profile, sandbox, service, volume, and volume_template. A type matches only its own tools, so instance doesn't include the instance_template or sandbox tools. You can combine both flags.

A shorter tool list costs the assistant less context on every turn.

Serve over HTTP

With --listen, the local server speaks HTTP at /mcp, with a liveness check at /healthz:

TerminalCode
unikraft mcp --listen 127.0.0.1:8080

Clients then register the server by its address:

JSONCode
{"mcpServers": {"unikraft": {"type": "http", "url": "http://127.0.0.1:8080/mcp"}}}

Add --tls-cert and --tls-key to serve HTTPS.

The local server doesn't authenticate its clients. Every client acts with the credentials of your profile. The server accepts only loopback addresses unless you pass --allow-remote. TLS encrypts the traffic but doesn't authenticate anyone, so use --allow-remote only behind a proxy that authenticates the clients, or on a private network.

Tools

Each resource type has the tools <type>_list, <type>_create, <type>_edit, and <type>_delete. The types are instances, instance templates, instance checkpoints, volumes, volume templates, services, and certificates. Metros have only metro_list.

ToolDescription
<type>_listList every resource of the type, or fetch specific ones with keys, and narrow the result with filter, sort, and fields.
<type>_createCreate a resource from the field values in set.
<type>_editChange a resource with set, add, and del.
<type>_deleteDelete resources by key, which is permanent.
instance_controlStart, stop, restart, or suspend instances.
instance_logsRead the last lines of the console output of an instance, 200 by default.
image_listList the images in your account.
image_getInspect any image reference, public ones included (local server only).
image_deleteDelete images (local server only).
sandbox_execRun a command in a sandbox, with a limit of 5 minutes by default that you can raise to 30 minutes.
sandbox_readRead a text file of at most 1 MiB from a sandbox.
sandbox_writeWrite or append to a text file in a sandbox.
profile_useList the profiles, or switch to another one (local server only).

A key is a name or a UUID. Prefix it with a metro, as in fra/my-app, to target one metro.

The set, add, and del parameters take field paths, like the --set, --add, and --del flags of the CLI. The create and edit tools take dry_run, which returns the resulting change without applying it.

A sandbox is an instance with the sandbox plugin loaded. The sandbox tools work on any running instance that has it.

profile_use changes the default profile in the configuration file, so it also applies to the CLI. The local server doesn't offer it when --profile or UNIKRAFT_PROFILE selects the profile.

The server returns at most 1 MiB of output for each tool call.

Documentation as resources

Both servers also serve this documentation as MCP resources. unikraft://docs is the table of contents, and unikraft://docs/<path> is a page, for example unikraft://docs/cli/fields. The server fetches a page only when the assistant reads it, so the documentation costs no context until then.

For the local server, the UNIKRAFT_DOCS_URL environment variable selects another documentation site. An empty value turns the resources off.

Differences between the two servers

Hosted serverLocal server
CredentialsConsole sign-in, one organization for each sign-inThe CLI profile
image_get, image_delete, profile_useNot availableAvailable
--read-only and --resourcesNot availableAvailable
Files on your machineNot available: images must be registry references, and a ROM must be an imageAvailable

Troubleshooting

MessageWhat to do
Your account has no organization.Create an organization in the console, then connect again from the assistant.
The sign-in expired.The sign-in page stays valid for 10 minutes, so connect again from the assistant.
the organization has all its access tokens: delete one at the console, then sign in againEach sign-in uses one access token of the organization, so delete an unused token in the console, then sign in again.
instance ... has plugin ... attached but not loaded yet; restart it with instance_controlA plugin loads at boot, so restart the instance.
--listen ... binds a non-loopback address and the server has no authenticationPass --allow-remote only if a proxy authenticates the clients, see serve over HTTP.
--resources: unknown resource types: ...Use the resource types from limit the tools.

For all flags, see the unikraft mcp reference.

Last modified on