What happens when you add a new MCP server to your AI agent using npx or uvx?
In a conventional, unsandboxed environment, you're downloading third-party code and executing it with your own privileges.
Your SSH keys. Your cloud credentials. Your source code. Your network.
Does an MCP memory server really need access to all of that?
I've been building Cantainer, an open-source project written in Rust that explores a different approach to distributing and executing software.
Introducing MCP in a can
A can is a distributable OCI artifact containing:
- An executable and its runtime.
- Cryptographically pinned dependencies and system libraries.
- A Software Bill of Materials (SBOM).
- A machine-readable, kernel-enforced permission manifest.
Think of it as software packaged together with its security contract.
Cantainer uses Linux Landlock and seccomp to enforce permissions, with approximately a millisecond of additional startup overhead in initial benchmarks.
No Docker engine. No root privileges. No background daemon.
What does it look like?
Instead of launching an MCP memory server using:
npx -y @modelcontextprotocol/server-memory
The OCI registry workflow looks like this:
cant pull ghcr.io/cantainer/server-memory:2.2.1
cant inspect ghcr.io/cantainer/server-memory:2.2.1
cant run ghcr.io/cantainer/server-memory:2.2.1
And the corresponding Claude Code configuration:
{
"mcpServers": {
"memory": {
"command": "cant",
"args": [
"run",
"ghcr.io/cantainer/server-memory:2.2.1"
]
}
}
}
Same MCP server. Same protocol. A fundamentally different security model.
The server can access its dedicated data directory, but its policy denies access to unrelated personal files and the network.
These restrictions are enforced by the Linux kernel, rather than an AI prompt or the server's own implementation.
Building an MCP server from a Canfile
A Canfile is a declarative recipe that describes where the software comes from, how it is packaged and what it is allowed to do.
Here is the essential part of the memory server's recipe:
canfile_version = 0
name = "server-memory"
version = "2.2.1"
[build]
runtime = "node@24.22.3"
npm = "@modelcontextprotocol/server-memory@2.2.1"
run = "dist/index.js"
[capabilities]
network = false
fs.ensure_dirs = ["~/.local/share/mcp-memory"]
[env]
set = { MEMORY_FILE_PATH = "~/.local/share/mcp-memory/memory.jsonl" }
[test]
mcp = true
The generated lock section pins the runtime, dependencies, system libraries and build tools by cryptographic hash.
Unlike a traditional Dockerfile, there is no arbitrary sequence of build commands. Runtime-specific presets construct the artifact from pinned inputs.
The goal is reproducibility across Linux distributions. The same memory server recipe has already produced byte-identical files when built on Ubuntu and Fedora.
A growing ecosystem of MCP servers
The cantainer/cans repository already contains recipes for 16 MCP servers and integrations:
- Core tools: Memory, Filesystem, Sequential Thinking, Fetch and Time.
- Developer tools: GitHub and Context7.
- Infrastructure: Kubernetes, Terraform and Grafana.
- Data and productivity: Supabase and Notion.
- Search and web: Brave Search, Exa and Firecrawl.
- Remote integration: MCP Remote.
The catalog supports Node.js, Python and native binaries, with automated multi-architecture builds and MCP functional tests.
Each server declares its own permissions.
A sequential-thinking server doesn't need the network or access to user files. A filesystem server needs only the directories explicitly granted to it. A GitHub server needs network access and an API token, not access to your home directory.
The permission model should reflect those differences.
Try it yourself
Cantainer runs on Linux with kernel 6.2 or newer, including suitable WSL and Linux VM environments.
You can install it using Cargo:
cargo install cantainer
Check whether your kernel supports the required isolation features:
cant check
Then build an MCP memory server locally:
git clone https://github.com/cantainer/cans
cd cans
cant build recipes/server-memory/Canfile
cant inspect ./server-memory.can
Register it with Claude Code:
claude mcp add memory -- cant run "$PWD/server-memory.can"
The official OCI registry packages are currently private pending artifact signing and licensing compliance. Local builds from the published recipes are already supported.
What's still missing?
Cantainer is experimental and has not been independently security-audited.
Some particularly interesting engineering challenges remain:
- Sigstore-based artifact signing and verification.
- Automated permission approval and permission-aware updates.
- Granular network destination restrictions. Currently, network-enabled cans do not have host-level allowlist enforcement.
- Stronger content-addressed store integrity.
- Expanding the catalog of MCP servers.
- Independent security research and adversarial testing.
I want to explore whether AI agents could eventually discover, evaluate and install tools autonomously, provided their requested capabilities remain within an approved security policy.
Installing software should not automatically mean granting it authority.
Looking for collaborators
I'd love to collaborate with developers interested in MCP, Rust, Linux internals, security engineering and reproducible software distribution.
Contributing doesn't necessarily require Rust knowledge. Adding an MCP server can be as simple as creating a Canfile, generating its dependency lock and testing the resulting artifact.
Both repositories are open source under MIT or Apache 2.0.
Runtime and architecture:
https://github.com/cantainer/cantainer
MCP server recipes:
https://github.com/cantainer/cans
The broader architectural vision:
We Gave AI Agents a Shell. Now What?
Which MCP servers would you like to see packaged next? What security guarantees would you need before trusting an ecosystem like this?
Feedback, architectural discussions and pull requests are welcome.
By default, you can't.
Update — December 3, 2026: Network isolation is here
One of the most important limitations discussed in this article was the lack of granular network destination restrictions.
Cantainer v0.0.20 now supports host-level network allowlists, using isolated Linux network namespaces and a lightweight, ephemeral CONNECT proxy.
For example, an executable’s network permissions can now be declared as:
[capabilities]
network = { allow = ["api.github.com"] }
Network destinations can also be granted explicitly by the user, derived from URL arguments or obtained from designated environment variables.
This introduces a new dimension to Cantainer’s capability model: restricting not only which files a program can access, but also which network destinations it can connect to.
No permanent daemon or Docker engine is required.
Host-level enforcement requires support for user and network namespaces. Where unavailable, Cantainer falls back to port-level restrictions with an explicit warning. Network policies do not restrict API operations inside encrypted connections.
The project remains experimental, but the security model is evolving rapidly.

Top comments (6)
The sandbox helps most on servers that were never the risk. Sequential Thinking and Time need nothing, while GitHub, Kubernetes, Terraform and Supabase get a token plus open network, so without a host allowlist a compromised one can still send that token anywhere or use it as it likes within its scope. And the kernel never sees what reaches the model: tool descriptions and results go to the agent unchanged, so a server whose description says read while its handler writes works just as well inside a can.
Good points. I see these as different layers of security: process isolation, network isolation, API authorization and MCP protocol security.
Even with unrestricted network access, preventing a compromised server from reading unrelated credentials and personal files reduces its blast radius. But you're right that it doesn't protect the token explicitly granted to that server.
Similarly, Cantainer currently makes no claims about the integrity of MCP tool descriptions or responses. That's a different trust boundary that would require protocol-aware enforcement.
I think combining these layers could be quite interesting. Would love to explore this further with people interested in contributing to the project.
One concrete way to combine them is to scan each server's source when the can is built. mcp-scanner (github.com/devlab-group/mcp-scanner) checks whether a handler does what its description says and outputs SARIF, so it could gate the can recipes in CI before packaging, with the sandbox then limiting whatever the scan misses
Adding the general idea to backlog. I like the direction
Some comments may only be visible to logged-in visitors. Sign in to view all comments.