ns-hpc
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ns-hpcCreate a new sandbox workspace for testing."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ns-hpc MCP Server
HPC sandboxing via bubblewrap — an MCP server that manages sandbox instances and executes commands inside isolated bwrap containers.
pip install git+https://github.com/li-yq/namespaced-hpc-mcp.gitQuick Start
# Run diagnostics
ns-hpc doctor
# Create an instance and run a command
ns-hpc instance create my-inst
ns-hpc bwrap my-inst -- ls -la
# Interactive shell
ns-hpc instance enter my-inst
# Start the MCP server
ns-hpc run # stdio (default)
ns-hpc run --transport streamable-http # HTTP on :8000/mcp
ns-hpc run -t streamable-http --uds /tmp/ns-hpc.sock # Unix socketRelated MCP server: MCP Files
Architecture
┌─────────────────────────────────────────────┐
│ MCP Client (LLM) │
└──────────────┬──────────────────────────────┘
│ stdio / streamable-http / SSE
┌──────────────▼──────────────────────────────┐
│ ns-hpc MCP Server │
│ │
│ ┌──────────────────────┐ ┌─────────────┐ │
│ │ submit_job / poll_job│ │ WebDAV /dav │ │
│ │ (bwrap exec) │ │ (GET/PUT) │ │
│ └──────────┬───────────┘ └──────┬──────┘ │
│ │ │ │
│ ┌──────────▼──────────────────────▼───────┐ │
│ │ bwrap sandbox │ │
│ │ ┌──────────────────────────────────┐ │ │
│ │ │ /workspace (rw, bind-mounted) │ │ │
│ │ │ /output (rw, bind-mounted) │ │ │
│ │ │ /usr /lib /bin /etc (ro) │ │ │
│ │ │ /proc /dev (virtual) │ │ │
│ │ │ /tmp (tmpfs) │ │ │
│ │ └──────────────────────────────────┘ │ │
│ └────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Instance: ~/.local/share/ns-hpc/ │ │
│ │ instances/{id}/ │ │
│ │ ├── workspace/ (rw host-side bind) │ │
│ │ ├── .ns_hpc_output/ (job outputs) │ │
│ │ ├── .ns_hpc_jobs/ (job state) │ │
│ │ ├── status/ (bwrap fd) │ │
│ │ ├── metadata.json │ │
│ │ └── audit.log (host-side only) │ │
│ └──────────────────────────────────────┘ │
└─────────────────────────────────────────────┘Key Design Decisions
Stateless bwrap: Every command creates a fresh sandbox. No persistent Linux namespaces. The kernel tears down the sandbox when the outer bwrap process exits.
Audit log on host: Written outside the sandbox — the sandbox cannot tamper with its own audit trail.
Shared network:
--share-netoverrides--unshare-all, so processes inside bwrap share the host network namespace. This enables WebDAV and proxied MCP servers to bind ports reachable from the host.
Configuration
Configuration merges three layers (highest priority last):
Built-in defaults
~/.config/ns-hpc/config.toml(XDG)NS_HPC_CONFIGenv var or--configCLI flag
See config/config.toml for the full reference.
# ~/.config/ns-hpc/config.toml
[namespace]
bwrap_command = [
"bwrap",
"--unshare-all", "--share-net",
"--proc", "/proc", "--dev", "/dev", "--tmpfs", "/tmp",
"--ro-bind", "/usr", "/usr",
"--ro-bind", "/lib", "/lib",
"--ro-bind", "/lib64", "/lib64",
"--ro-bind", "/bin", "/bin",
"--ro-bind", "/sbin", "/sbin",
"--ro-bind", "/etc", "/etc",
]
[jobs]
max_timeout = 3600
[jobs.local]
use_cgroups = true
cgroups_command = [
"systemd-run", "--user", "--scope",
"-p", "CPUQuota=400%",
"-p", "MemoryMax=8G",
"--",
]
[jobs.slurm]
sbatch_command = [
"sbatch",
"--partition", "cpu",
"--cpus-per-task={cpus}",
"--mem={memory}M",
]
[jobs.slurm.limit]
cpus = { default = 1, max = 8 }
memory = { default = 4096, max = 32768 }
# WebDAV file access (default: disabled)
[dav]
enabled = true
[dav.extras.external-data]
path = "/public5/home/t6s001890/data"
ro = true
[proxied_mcps.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/"]
# include = ["read_*", "list_*"]
# exclude = ["*_dangerous"]CLI Reference
Command | Description |
| Diagnose system prerequisites |
| Run command in raw bwrap sandbox |
| Start MCP server (stdio, streamable-http, sse, UDS) |
| Remove stale instances |
| Create a new sandbox instance |
| List all instances |
| List archived instances |
| Show instance metadata |
| Update description |
| Interactive bash in sandbox |
| Run command as an async job |
| Check job status |
| List tracked jobs |
| Cancel a running job |
| Archive instance (disables new jobs) |
MCP Tools
Instance Management
Tool | Description |
| Create a new sandbox instance |
| List all active instances |
| List all archived instances |
| Update instance metadata (description) |
| Archive an instance, disabling new jobs |
Job Execution
Tool | Description |
| Submit a command as an async job (local or Slurm) |
| Poll a running job, optionally wait for completion |
| List all tracked jobs for an instance |
| Cancel a running job and return final output |
File Access
Tool | Description |
| Read a file from the sandbox workspace |
| Write a file to the sandbox workspace |
| List directory contents |
| Additional proxied filesystem tools (search, move, etc.) |
The
filesystem__*tools are proxied from the@modelcontextprotocol/server-filesystemMCP server running inside bwrap. They can be filtered withinclude/excludepatterns in config.
WebDAV File Transfer
When [dav].enabled = true (and the server runs in HTTP mode), the WebDAV
endpoint at /dav/ provides direct file access from Finder, Windows
Explorer, rclone, or curl.
/dav/instances/{id}/workspace/... (read-write)
/dav/instances/{id}/output/... (read-write)
/dav/{extra_name}/... (config-controlled, defaults to ro)# Mount in Finder: ⌘K → http://127.0.0.1:8000/dav/
# Or with curl:
curl http://127.0.0.1:8000/dav/instances/my-inst/workspace/file.txt
curl -T data.csv http://127.0.0.1:8000/dav/instances/my-inst/workspace/data.csv
curl -X DELETE http://127.0.0.1:8000/dav/instances/my-inst/workspace/old.txtWrites (PUT, DELETE, MKCOL) are audited to the instance
audit.log.Archived instances return 404.
Path traversal (symlinks,
..) is blocked.Read-only extra mounts reject writes.
Remote HPC Setup
1. Install on the HPC node
pip install git+https://github.com/li-yq/namespaced-hpc-mcp.git
ns-hpc doctor2. Configure for your cluster
# ~/.config/ns-hpc/config.toml
[namespace]
bwrap_command = [
"bwrap",
"--unshare-all", "--share-net",
"--uid", "1000", "--gid", "1000",
"--ro-bind", "/home/user/.local/share/ns-hpc/rootfs", "/",
"--ro-bind", "/home/user/.local/share/ns-hpc/agent-tools", "/opt/agent-tools",
"--proc", "/proc", "--dev", "/dev",
"--tmpfs", "/run", "--tmpfs", "/tmp",
]
workspace_mount = "/home/agent"
output_mount = "/mnt/output"
shared_output_mount = "/mnt/shared-output"
[jobs.slurm]
sbatch_command = ["sbatch", "--partition", "compute", "--cpus-per-task={cpus}", "--mem={memory}M"]
[jobs.slurm.limit]
cpus = { default = 1, max = 32 }
memory = { default = 4096, max = 131072 }3. Start the server
# stdio (for SSH-based MCP clients)
ns-hpc run
# Streamable HTTP (recommended for direct HTTP)
ns-hpc run --transport streamable-http --port 8000
# With WebDAV
ns-hpc run --transport streamable-http --port 8000 # set [dav].enabled=true4. MCP client config
{
"mcpServers": {
"ns-hpc": {
"command": "ssh",
"args": ["user@hpc-login", "ns-hpc", "run"]
}
}
}Or for HTTP:
{
"mcpServers": {
"ns-hpc": {
"url": "http://hpc-login:8000/mcp"
}
}
}Development
uv sync
uv run pytest # Full test suite
uv run python -m ns_hpc doctor # Diagnostics
uv run python -m ns_hpc run # Start serverTests by tier:
Tier | Command |
Pure unit (no bwrap) |
|
Unit + bwrap |
|
Full Slurm integration |
|
Security
All commands run via
bwrap --unshare-all(user, PID, mount, IPC, UTS, CGROUP namespaces)System paths are read-only (
--ro-bind)/tmpis a fresh tmpfsWorkspace is the only writable bind mount
Audit log written host-side, never exposed to sandbox
Path traversal blocked in filesystem and WebDAV tools
ns-hpc doctorvalidates prerequisites
Requirements
Linux with user namespaces enabled
bwrap (bubblewrap) 0.11+
Python 3.12+
(Optional) Slurm: sbatch, squeue, sacct
(Optional for WebDAV) network access for Finder/rclone/curl clients
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/li-yq/namespaced-hpc-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server