Skip to content

fix(mcp): Keep tools inside the partition - #584

Open
dragosgheorghioiu wants to merge 2 commits into
dragosg/feat/mcp-serverfrom
dragosg/feat/mcp-partition
Open

dragosgheorghioiu wants to merge 2 commits into
dragosg/feat/mcp-serverfrom
dragosg/feat/mcp-partition

Conversation

@dragosgheorghioiu

Copy link
Copy Markdown
Contributor

Integration tests and the MCP evals run the CLI with UNIKRAFT_X_PARTITION, which records every resource a test creates so teardown can delete it. The MCP server mostly ignored it: it wrote the partition only on exit, so a long-lived unikraft mcp hid what it created from the CLI commands a test runs beside it, and instance_control, instance_logs, deletes and references could reach resources outside the partition.

The server now reloads the partition before every tool call and saves it after, one call at a time. Every key and reference is resolved inside the partition and the rest is rejected, image_get skips it like the CLI does, and a hidden --no-partition opts out. The partition stays an env-only, undocumented test feature, and nothing changes when the variable is unset.

Stacked on #554; the evals in #555 rely on it.

The CLI writes the test partition only when it exits, so the long
lived MCP server hid what it created from the CLI commands a test
runs beside it, and concurrent calls raced on the partition file.

Reload the partition before each tool call and save it after, one
call at a time, so the server and the CLI see each other's work.

Signed-off-by: Dragos Gheorghioiu <dragosg@unikraft.com>
instance_control and instance_logs ignored the test partition,
deletes ran on every key given, and creates or edits could point at
resources outside it, which the partition then adopted for teardown.

Resolve every key and reference inside the partition and reject the
rest, let image_get skip the partition like the CLI, and add a
hidden --no-partition flag to opt out.

Signed-off-by: Dragos Gheorghioiu <dragosg@unikraft.com>
@dragosgheorghioiu
dragosgheorghioiu force-pushed the dragosg/feat/mcp-partition branch from 10f13b1 to 0fc669f Compare November 2, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant