---
title: "Sandbox MCP Servers | Cosmonic"
description: "Run MCP servers as sandboxed WebAssembly workloads on Cosmonic Desktop — deny-by-default egress, verified images, and secrets as references for the tools your agents call."
canonical: "https://cosmonic.com/docs/desktop/sandbox-mcp-servers/"
---

# Sandbox MCP Servers

The MCP servers your agents call are network services executing third-party code, wired directly into a model's tool-use loop—which makes them precisely the code that belongs in a sandbox. Cosmonic Desktop runs MCP servers as ordinary workloads, with the platform's security defaults doing the containment. (Desktop also works in the other direction—your coding agent driving Desktop itself—see [Connect Coding Agents](https://cosmonic.com/docs/desktop/coding-agents/).)

Diagram of the two MCP directions. A &quot;Coding agent&quot; box (Claude Code, Gemini CLI, any MCP client) sends arrow 1, labeled &quot;drives Desktop&quot;, to the cosmonicd MCP server inside a Cosmonic Desktop box — with cosmonic\_\* tools for inspect, deploy, logs, and status. Arrow 2, labeled &quot;calls sandboxed tools&quot;, goes to &quot;your MCP server&quot;, drawn with a dashed border as a Wasm workload that is sandboxed with egress denied by default. This page covers direction 2.

## Why sandbox a tool server?

A tool server sits at the most exposed point in an agentic system: it receives model-shaped input (including whatever a prompt injection persuaded the model to send), it often holds credentials, and it can usually reach the network. Conventional deployment gives it ambient authority—whatever the process can reach, a compromised or over-curious server can reach too. The [capability-bounds argument](https://cosmonic.com/docs/agent-sdk/capabilities/) applies in full: the structural defense is a boundary the model can't widen. [MCP security](https://cosmonic.com/mcp-security/) covers the threats in detail, from tool poisoning to prompt injection.

As a Desktop workload, an MCP server:

- starts with **no outbound network access**—every host it may call is allow-listed in its spec (`allowedHosts`), per workload, so exfiltration has nowhere to go;
- is **digest-pinned and signature-checked** on every start, so the tool you reviewed is the tool that runs;
- reads its secrets as **references** resolved by the host at start—plaintext never appears in its config, the YAML, or the UI.

## Run an MCP server

Any MCP server compiled as a Wasm component uses the standard flow: paste its OCI reference into **Start workload**, review the draft—the [review step](https://cosmonic.com/docs/desktop/quickstart/#3-review-and-apply) shows exactly the network reach and capabilities you're granting—and deploy. It appears in the [Workloads view](https://cosmonic.com/docs/desktop/app-views/#workloads) like anything else, with its logs in the [Logs view](https://cosmonic.com/docs/desktop/app-views/#logs).

Starting points:

- The [Petstore MCP Server template](https://cosmonic.com/docs/template-catalog/mcp-server-ts/) is a working TypeScript example.
- The [wasmCloud developer guide](https://wasmcloud.com/docs/wash/developer-guide/) covers building components from scratch.

## From one machine to the team

The same spec deploys to [Cosmonic Control](https://cosmonic.com/docs/securely-deploy-mcp-on-kubernetes/) when you want sandboxed MCP servers on Kubernetes for the whole team—same deny-by-default egress, same verification, now under your platform's governance. [From Laptop to Cluster](https://cosmonic.com/docs/desktop/laptop-to-cluster/) walks the mechanics.

## Next steps

- Connect the agents that will call these servers in [Connect Coding Agents](https://cosmonic.com/docs/desktop/coding-agents/).
- Understand the sandbox defaults in the [overview's security model](https://cosmonic.com/docs/desktop/#secure-by-default).
- Follow the five-minute tutorial: [How to sandbox an MCP server](https://cosmonic.com/mcp-security/sandbox-an-mcp-server/).

Last updated on **Nov 10, 2026** by **Liam Randall**
