Skip to content

Model Context Protocol

nova-ve exposes a Streamable HTTP MCP endpoint at /mcp. A client can inspect labs, validate a new lab design, create the reviewed design, and operate authorized nodes without a browser session. The optional canvas assistant uses a separately configured model.

Enable access

In System → Settings, turn on Enable remote MCP access, save, and restart the backend. Installations can also set MCP_ENABLED=true in the backend environment. The feature is disabled by default. A reverse proxy must route the exact /mcp path to the backend. The nova-ve Caddy configuration includes that route.

CLI clients generally send no Origin header. For a browser-based client, set MCP_ALLOWED_ORIGINS to a JSON array of exact origins, for example ["https://client.example.test"]. Requests from other browser origins get 403. Set MCP_ALLOWED_ROLES to restrict access to a JSON array of account roles. Use HTTPS for access across a network.

Administrators can check the effective roles, token policy, active MCP requests, active subscriptions and failed requests in System → Settings. The counters are local to the backend process and reset on restart. The feature switches take effect after a backend restart.

Create a personal access token

Open Account → Profile. Under Personal access tokens, choose a name, expiry and scopes. To limit the token to a folder or lab, supply a path such as /training or /training/routing.json. The account's current folder and role permissions still apply. Builds and edits made with personal tokens use catalog-supplied launch settings. Launcher overrides and host placement require a signed-in session. Copy the token when it is created. Later the profile shows its public prefix, expiry and last use.

Scope MCP capabilities
labs:read Identity, accessible labs, topology, observed node state, interfaces, catalog and lab event cursors.
labs:write Read access plus validated full-lab creation and individual name or layout changes.
nodes:run Read access plus start, stop and bounded state waits.
console:config Read access plus authorized console-related REST routes.
admin Controller capacity for an administrator. Lab capabilities require an explicit lab scope.

Token expiry is between one and 365 days. A personal token cannot manage other tokens. For scripted bootstrap, a signed-in session or the short-lived login bearer can call POST /api/account/api-tokens with name, scopes, expires_in_days and optional lab_prefix. Read the one-time secret from data.token. In Profile, Test connection checks a newly issued or pasted token's identity and grants through GET /api/account/api-tokens/connection. Initialize the client's Streamable HTTP connection to check the complete proxy and protocol path.

Revoke a retired or exposed token in Profile. Its next HTTP call is rejected. Its WebSocket event stream closes when the next event checks the grant or at the periodic recheck.

Repeated invalid credentials from the same client address share a throttle across MCP, REST and WebSockets. Clients should honor Retry-After on HTTP responses.

Connect a client

Configure your client for Streamable HTTP. Use https://your-nova-ve.example/mcp as the URL and the header Authorization: Bearer <token>. Keep the token in the client's secret store.

The server authenticates each request independently. Calls return JSON, and modern resource subscriptions use a response stream. Closing the connection cancels pending request work. An operation already committing may finish, so use an idempotent retry or read back state after a disconnect. It supports the 2026-07-28 discovery protocol and the 2025-11-25, 2025-06-18 and 2025-03-26 initialization protocols. Iterate nextCursor on discovery responses until the field is absent.

For example, initialize and list tools using the 2025-11-25 protocol. Set NOVA_URL to the nova-ve base URL and NOVA_TOKEN to the token.

curl --fail-with-body -sS "$NOVA_URL/mcp" \
  -H "Authorization: Bearer $NOVA_TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  --data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"nova-ve-example","version":"1"}}}'

curl --fail-with-body -sS "$NOVA_URL/mcp" \
  -H "Authorization: Bearer $NOVA_TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'MCP-Protocol-Version: 2025-11-25' \
  --data '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

For a first read, use tools/call with {"name":"whoami","arguments":{}}. The result contains effective scopes, identity and account quotas. Call list_labs for authorized paths and get_lab with an explicit lab path to read the topology. Use fields to choose among nodes, networks and links. Set detail to full for positions, image names and link settings. Retrieve adjacent pages using next_offset. A three-node summary fixture has a 1 KiB text limit in the tests.

Validate and build a lab

  1. Call list_templates for the available template and image combinations. Select installed images for your design.
  2. Follow the full-lab API reference for the design body. Call validate_lab_build with {"design": <design>}. Read the estimated CPU and RAM, resolved references, and any field errors.
  3. Review the design, then call build_lab with the same design, the returned plan_id, and a fresh idempotency_key. The plan is bound to the token and exact submitted design for 30 minutes.
  4. Open the returned path. The result includes the lab ID, revision and node, network and link reference maps. A direct node-to-node connection returns two persisted link IDs. Nodes remain stopped. Provisioning is deferred.

A retry with identical arguments and the original key returns the same lab ID and marks the result replayed. For a targeted change, set_lab_layout, add_node, rename_node and rename_network take the expected lab ID, revision and idempotency key. Read the lab again before retrying a changed design.

Use clone_lab to copy an existing design to a new destination. Provide the source and destination paths and an idempotency key. A clone gets a new identity with the original topology and canvas layout, a fresh revision and stopped nodes. The result identifies stripped fields. Both paths must be covered by the token grant. Review copied configuration and configsets before sharing the clone, since these may contain secrets.

To delete an entire lab, call request_lab_deletion with its path, then review the named lab, revision, nodes and effects in Account → Profile → Lab deletion approvals. Call get_lab_deletion_approval to check the decision. Apply an approved request once using delete_lab and its approval ID. The backend rechecks lab identity and effects before removal and reports an incomplete cleanup if one occurs.

Tool Use
whoami, host_capacity See authorization and quotas, or administrator-only controller capacity.
list_labs, get_lab Discover visible lab paths and read their topology.
list_templates, list_network_types, get_node_interfaces Discover usable appliances and network types and inspect specific interface indexes.
get_lab_events Read bounded event cursors. On an event gap, retrieve a fresh snapshot.
validate_lab_build, build_lab Validate and create a complete lab through the same operation as POST /api/labs/build.
set_lab_layout, rename_node, add_node, connect, disconnect Edit positions, rename a node, place a template node or change wiring.
move_lab, clone_lab, set_lab_instructions Move or copy an authorized lab or update exercise instructions.
request_lab_deletion, get_lab_deletion_approval, delete_lab Request, check and apply a human-approved lab deletion.
start_nodes, stop_nodes, wait_for_node Operate and observe the selected lab.
request_node_wipe, get_wipe_approval, wipe_nodes Request, check and apply a human-approved wipe.
get_node_logs, read_console_capture Read bounded logs or an existing console snippet capture.
get_headless_console, export_running_config, run_readonly_snippet Check console support, export running config or run an allowed read-only snippet.
request_console_config, get_console_approval, apply_console_config Review and apply a versioned template configuration snippet.
capture_interface Collect a bounded PCAP on a supported running interface.

Review edits to an existing lab

Call get_lab for the current lab_id and revision. Use validate_lab_edit with the lab path and a batch containing expected_lab_id, expected_revision and up to 200 authored edits. A batch can rename nodes or networks, move them, change layout defaults, add template nodes and isolated networks, and add or remove links on eligible stopped endpoints. New objects use batch-local aliases. A removal includes the saved ID and the current endpoint identities. The signed-in canvas assistant can also propose removing eligible stopped nodes and isolated networks before they acquire runtime files or host resources.

Review the returned diff, then send the original batch and plan_id to apply_lab_edit with an idempotency key. The backend rechecks the identity and revision and commits the batch as one revision. After a conflict, read the lab again and revalidate. Structural edits on running endpoints can be refused before a save.

The REST equivalent is POST /api/labs/{lab}/edits?mode=validate|apply with an optional Idempotency-Key header on apply.

Call plan_auto_layout for a preview arranged by connectivity, with optional direction and spacing. Use the returned batch to validate and apply the proposed positions. Use list_lab_annotations to read saved plain-text notes. An edit batch can add, move, update or remove a note through its annotations field.

Operate a lab

A token with nodes:run can call start_nodes or stop_nodes with the lab path, expected_lab_id from get_lab, and an explicit node_ids list. Omit the list to target every node. Read each result for failures and the observed state. Use wait_for_node with a deadline to wait for one node to reach running or stopped. Starts use the lab owner's normal quota and placement rules.

For work that should continue when the client disconnects, use submit_lifecycle_operation with the same selection, operation set to start or stop, and an idempotency key. Check get_lifecycle_operation for per-node results or use list_lifecycle_operations to find a previous run. cancel_lifecycle_operation skips pending targets and lets the in-flight target finish. Restarted controllers mark interrupted operations for inspection. A replay with the same key returns the retained operation record.

For a supported locally hosted QEMU link, call get_link_runtime to inspect support, saved settings and observed state. Use set_link_runtime with settings.mode=preflight, the interface and expected revision to check changes. Apply with settings.mode=apply to set carrier, delay, jitter, loss or bandwidth. A stopped node retains settings for its next start. An unsupported endpoint returns a reason before any settings are applied.

A wipe deletes the selected nodes' runtime disks. Request a wipe approval for the exact lab and node IDs, then review it in Account → Profile. Apply with the returned approval ID only after approval. A change to the lab or an expired or denied request requires a new approval.

For REST, the equivalent bulk endpoints are POST /api/labs/{lab}/nodes/start and POST /api/labs/{lab}/nodes/stop. The single-node POST endpoints append /{node_id}/start or /{node_id}/stop after /nodes. For synchronous lifecycle, move, instructions and wiring, send the expected identity as X-Nova-Lab-ID. Durable lifecycle requests carry expected_lab_id in the JSON body.

Capability Runtime eligibility
Start, stop and wait Supported node types use normal launcher, placement and quota checks.
Link carrier and impairment TAP-backed links with supported local QEMU endpoints. Preflight reports required capabilities and the read tool returns observed state.
Headless read or configuration Eligible template, running local Telnet node and enabled console snippets. Writes require signed-in approval.
Packet capture Running TAP-backed QEMU, IOL or Dynamips interface with capture enabled on its execution host. Returns bounded base64 PCAP, packet count and stop reason.

Headless console and configuration

Use a console:config token. On a locally hosted Telnet node with an eligible template and console snippets enabled, call get_headless_console to check support and see the allowed snippets. export_running_config uses the packaged running-config snippet when the template permits it. run_readonly_snippet takes an allowed snippet ID, its revision and validated variables. Use the run ID with get_console_run to check progress or cancel_console_run to stop a pending run. Use the run ID and capture name to read an output artifact when available.

A configuration change requires request_console_config, followed by signed-in approval in Account → Profile → Console configuration approvals. The reviewer sees the lab, node, exact snippet effects, and expiry. Use apply_console_config with the approval ID after the reviewer approves it. Changes to the lab, node, or snippet invalidate the approval. Operations send only allowed template snippets over a locally owned relay.

For startup configuration, call get_startup_config_capabilities before a read. Eligible CSR nodes support read_startup_config, with separate running and saved configuration digests and bounded text. An unfinished read returns a run ID for get_startup_config_read. Use request_startup_config_save with the completed read ID, then review the changes in Account → Profile → Startup configuration approvals. After get_startup_config_approval reports approval, call save_startup_config. The guest's running configuration is checked against the reviewed content before saving to startup configuration and read back afterward. A save needs a complete capture of both configurations. Use the interactive console to create the first startup configuration on a node that has none.

Resources, prompts and events

  • nova-ve://catalog/templates provides a compact catalog.
  • nova-ve://labs/{path} reads the topology for an authorized lab.
  • nova-ve://host/capacity provides controller capacity for authorized administrators.
  • nova-ve://console/{lab}/{run_id}/{capture} reads an authorized console snippet capture. The capture tool returns its resource URI.
  • The reusable prompts are build_lab(goal), troubleshoot_lab(lab) and lab_walkthrough(lab).

With protocol 2026-07-28, a client can call subscriptions/listen with one or more authorized topology resource URIs in params.notifications.resourceSubscriptions. The response acknowledges the subscription and emits notifications/resources/updated when the lab changes. Read the resource again for its latest contents. The connection rechecks access and finishes after at most five minutes. Reopen the subscription to continue observing the lab.

A labs:read token can receive lab change cursors over /ws/labs/{lab_path}?last_seq=0. Send the token using an Authorization header from a non-browser client. The stream sends event types, sequence numbers and the committed revision when an event carries it. Fetch topology with get_lab after a snapshot_required notice.

Canvas assistant

The assistant is an independent opt-in in System → Settings. On the backend configure LAB_ASSISTANT_BASE_URL and LAB_ASSISTANT_MODEL for an OpenAI-compatible endpoint. Use LAB_ASSISTANT_API_KEY for provider credentials. The endpoint and model are shown before a turn is sent. LAB_ASSISTANT_DAILY_LIMIT is the local daily token budget per user, with a default of 100,000. Restart the backend after changing settings.

Open Assistant beside the canvas. A request can include your message, recent conversation context, installed template information and a bounded summary of the selected lab. Inspect a validated new-lab proposal or a position change for the current lab as text and on the canvas. Revise the proposal through the conversation, discard it, or apply it. Apply uses the stored plan without another model request.

Plans carry the existing lab's identity and revision. For structural proposals, the canvas overlay and text review show affected additions, removals and connections. If the lab changes during review, revise the proposal against the latest revision and inspect its diff before applying. The review reports when a running device or an existing host resource requires a separate step.

If a save ends without a response, confirm the same plan to recover its recorded result. If the assistant reports an unknown outcome, inspect the lab before preparing another plan.

A backend restart ends in-flight turns and clears the in-memory conversation, proposal and usage state. Configure a budget at the model provider for an independent persistent limit.

REST equivalents

Here {node} means /api/labs/{lab}/nodes/{node_id} and {lab} means the saved lab path when used in a route.

MCP workflow REST routes
Validate or build a full lab POST /api/labs/build?mode=validate\|apply
Batch edit, place a node, rename or move objects on the canvas POST /api/labs/{lab}/edits?mode=validate\|apply
Preview automatic layout and list notes GET /api/labs/{lab}/auto-layout, GET /api/labs/{lab}/annotations
Clone POST /api/labs/clone
Request, inspect and apply deletion POST /api/labs/{lab}/delete-approvals, GET /api/labs/{lab}/delete-approvals/{id}, POST /api/labs/{lab}/delete
Durable lifecycle execution and history POST or GET /api/labs/{lab}/operations, GET /api/labs/{lab}/operations/{id}, POST /api/labs/{lab}/operations/{id}/cancel
Link controls GET or POST /api/labs/{lab}/links/{link_id}/runtime
Headless console {node}/console/headless and its export, snippets and config routes
Startup configuration {node}/startup-config and its read, reads, approvals and apply routes
Interface capture POST {node}/interfaces/{interface_index}/capture

Troubleshooting

Symptom Check
404 on /mcp Enable MCP, restart the backend and verify the exact proxy route.
401 from the endpoint Use an unexpired, unrevoked personal access token.
A tool is missing or its call is denied Check the token's effective scopes and lab restriction.
403 when connecting in a browser Check the allowed origin.
429 from the endpoint Honor Retry-After. The server limits concurrent calls and repeated invalid credentials.
405 for GET /mcp Send protocol messages via POST. The lab WebSocket endpoint delivers change cursors.
Plan rejected at apply Revalidate the unchanged design and check that its destination path is still free.