Skip to main content

AI Agents (MCP)

SandboxMesh features first-class support for the Model Context Protocol (MCP), allowing your AI coding agents (like Cursor, Windsurf, or custom LLM workflows) to autonomously manage your preview environments.

By exposing cluster setup and sandbox creation tools directly to your agent, you enable a seamless "Agentic Developer Loop" where the AI can implement a feature, spin up a sandbox, and verify its own changes in a real staging environment before you even look at the PR.

What is the SandboxMesh MCP Server?

The SandboxMesh CLI includes a built-in MCP server that exposes your clusters and sandboxes as "Tools" to any MCP-compatible client. This gives your AI agent the ability to:

  • List and Register Clusters: Let the agent identify where to deploy.
  • Create and Delete Sandboxes: The agent can provision its own isolated environment.
  • Wait for Readiness: The agent can poll until the sandbox is fully materialized and routed.
  • Inspect Status: Get detailed feedback if a deployment fails.

Why use MCP with SandboxMesh?

  • Autonomous Verification: Your agent no longer just writes code; it verifies it. It can create a sandbox, run its changes, and only present you with the PR once it knows the code actually runs in your cluster.
  • Zero-Context Provisioning: You don't have to explain your Kubernetes setup to the LLM. The MCP tools provide a structured, safe interface for the agent to interact with your infrastructure.
  • Instant Staging for Agents: Give your AI the same "Zero-Friction Staging" experience that your human developers enjoy.

Quick Start: Enable MCP

1. Serve the MCP Server

You can start the MCP server using the sb CLI. It communicates over stdio, which is the standard for most AI coding tools.

bash
sb mcp serve

2. Connect to your Agent

Add the SandboxMesh MCP server to your favorite AI tool.

For Cursor or Windsurf:

Add a new MCP server in your settings with the following configuration:

  • Type: command
  • Command: sb mcp serve

How it looks in practice

Once connected, you can give your agent high-level instructions:

"Implement the new login button, create a sandbox in the 'dev-cluster' for it, and let me know the URL once it's ready to test."

The agent will then:

  1. Write the code.
  2. Call cluster_list to find the target cluster.
  3. Call sandbox_create with the new workload configuration.
  4. Call sandbox_wait until the environment is live.
  5. Provide you with the preview URL from the sandbox status.

Next Steps

  • Explore the Architecture to see how the agent interacts with the control plane.
  • Check the HTTP API for the underlying endpoints used by the MCP server.