CrowNest
Integrations

MCP

Connect CrowNest Sandboxes to MCP hosts with the @crownest/mcp stdio server.

@crownest/mcp is a stdio MCP server for CrowNest. It lets MCP hosts create Sandboxes, run Commands, run Python Code, read and write Workspace files, create and download Artifacts, manage Previews, inspect Code Contexts, run Workspace Runs, and run API-key and Project operations.

The server is a host-process tool bridge. CROWNEST_API_KEY stays in the MCP host environment and is not passed into Sandbox runtime environment variables.

The server also sends MCP startup instructions that describe the lazy default Sandbox model, /workspace, Code Run output promotion, usage discovery, Sandbox TTL semantics, retry/idempotency routing, and best-effort session cleanup.

Install in Claude Code

Terminal
claude mcp add crownest -e CROWNEST_API_KEY=cn_live_... -- npx -y @crownest/mcp

Set CROWNEST_API_URL only when targeting a non-production CrowNest API.

Generic MCP configuration

mcp.json
{
  "mcpServers": {
    "crownest": {
      "command": "npx",
      "args": ["-y", "@crownest/mcp"],
      "env": {
        "CROWNEST_API_KEY": "cn_live_..."
      }
    }
  }
}

Tools

The server currently registers 62 MCP tools:

ToolDescription
run_codeRuns interpreter code in a Sandbox. Outputs can become Artifacts.
get_agent_contextReturns bounded, non-secret session guidance for MCP hosts that do not expose resources.
run_commandRuns a Command in a Sandbox. Waits for completion by default; background: true returns at once.
create_sandboxCreates an additional Sandbox with an optional create-time network_policy.
kill_sandboxKills the default, server-created, or explicitly supplied visible Sandbox.
write_fileWrites UTF-8 text to a Workspace path under /workspace.
write_file_bytesWrites base64 bytes to a Workspace path.
read_fileReads UTF-8 text from a Workspace path.
read_file_bytesReads Workspace file bytes as base64 with size bounds.
get_file_download_urlCreates or reuses a short-lived Workspace file download URL.
list_filesLists files in a Workspace path, defaulting to /workspace.
download_artifactDownloads an Artifact by id and returns base64 content plus content type.
get_artifact_download_urlCreates or reuses a short-lived Artifact download URL.
list_sandboxesLists live Sandboxes visible to the configured credential.
list_templatesLists curated, smoke-tested Templates and their capabilities.
get_templateGets one curated Template by user-facing slug.
get_usageReads compute usage, spend metadata, quota buckets, and MCP-session Sandbox state.
get_sandboxInspects a Sandbox by id or the current lazy default Sandbox.
set_sandbox_ttlResets a live Sandbox TTL countdown from now; expired Sandboxes cannot be revived.
get_commandInspects Command status, exit code, and timing by Command id.
cancel_commandCancels a Command by Command id with graceful or force mode.
stream_command_logsReads the currently available bounded Command log buffer.
delete_fileDeletes a file or empty directory from the Workspace.
move_fileMoves or renames a Workspace file.
make_directoryCreates a Workspace directory.
stat_fileInspects Workspace file metadata.
create_artifactCreates a durable Artifact from a Workspace file.
list_artifactsLists Artifacts for a Sandbox.
get_artifactInspects Artifact metadata by Artifact id.
delete_artifactDeletes an Artifact by Artifact id.
create_previewCreates a Preview for a Sandbox HTTP service. Token auth mode returns a one-time Preview token.
list_previewsLists Previews for a Sandbox.
get_previewInspects a Preview by Preview id.
revoke_previewRevokes a Preview by Preview id.
create_code_contextCreates a live Code Context for stateful Code Runs.
list_code_contextsLists live Code Contexts in a Sandbox.
get_code_contextInspects a live Code Context in a Sandbox.
delete_code_contextDeletes a live Code Context.
list_api_keysLists API Key metadata without returning secret key values.
get_api_keyReads API Key metadata by id without returning the secret key value.
revoke_api_keyRevokes an API Key by API Key id.
create_projectCreates a Project for isolating Sandboxes, usage, quotas, and API-key restrictions.
list_projectsLists visible Projects.
create_workspace_runCreates a durable Workspace Run record.
upload_workspace_run_archiveUploads a small gzipped tar archive through the CrowNest API.
create_workspace_run_archive_transferCreates a short-lived staged archive upload target and redacts header values in the tool result.
upload_workspace_run_archive_transferUploads bytes to the staged archive transfer target remembered by the MCP session.
finalize_workspace_run_archiveFinalizes a staged archive transfer for a Workspace Run.
start_workspace_runStarts archive extraction and Command execution.
get_workspace_runReads Workspace Run status and metadata.
list_workspace_runsLists visible Workspace Runs with optional filters.
replay_workspace_run_eventsReplays bounded Workspace Run events after an optional sequence number.
cancel_workspace_runCancels an active Workspace Run.
get_workspace_run_evidenceReads the terminal Evidence Bundle for a Workspace Run.
create_workspace_run_matrixCreates a first-class Workspace Run Matrix and its ordered cells.
upload_workspace_run_matrix_archiveUploads the one immutable archive shared by every Matrix cell.
start_workspace_run_matrixAtomically reserves capacity and starts bounded Matrix fan-out.
get_workspace_run_matrixReads Matrix parent, cell, and aggregate status.
list_workspace_run_matricesLists visible Workspace Run Matrices with cursor pagination.
replay_workspace_run_matrix_eventsReplays bounded Matrix lifecycle events after an optional sequence number.
cancel_workspace_run_matrixCancels active and scheduled Matrix cells.
get_workspace_run_matrix_evidenceReads aggregate Matrix evidence with links to child Evidence Bundles.

Prompts and resources

MCP discovery advertises:

  • Resource crownest://agent/context for bounded non-secret context.
  • Prompt crownest_workspace_run for archive-based create/upload/start/replay/evidence flows.
  • Prompt crownest_sandbox_session for lower-level Sandbox, Command, Code Context, file, Artifact, and Preview work.

The public server card at https://crownest.dev/.well-known/mcp/server-card.json and public agent context at https://crownest.dev/.well-known/agent-context.md publish the same tools, prompts, and resource.

Python Code Runs

The MCP run_code tool uses sandbox.code.run with artifactPolicy: "promote", so image and other rich outputs can become CrowNest Artifacts for host rendering or later download.

Session Sandbox model

The server lazily creates one default Sandbox on the first stateful tool call. Tools that operate inside a Sandbox return sandbox_id; pass that id to keep using the same Workspace or Code Context state from later calls.

create_sandbox creates additional Sandboxes for the same server session without changing the lazy default Sandbox. Passing an explicit visible Sandbox id to a tool adopts that Sandbox for the session, but process-exit cleanup only kills Sandboxes the MCP server created. kill_sandbox can still kill an explicitly supplied visible Sandbox when the caller has permission.

Workspace Run flow

MCP exposes Workspace Runs as primitive lifecycle tools. Use the CLI workspace-runs run-archive command for a one-shot local convenience flow; use MCP when the model needs retryable steps.

create_workspace_run({ "template": "python-node", "command": "pnpm test" })
create_workspace_run_archive_transfer({ "workspace_run_id": "wsr_...", "sha256": "...", "size_bytes": 12345 })
upload_workspace_run_archive_transfer({ "workspace_run_id": "wsr_...", "upload_id": "upl_...", "content_base64": "..." })
finalize_workspace_run_archive({ "workspace_run_id": "wsr_...", "upload_id": "upl_...", "sha256": "...", "size_bytes": 12345 })
start_workspace_run({ "workspace_run_id": "wsr_..." })
replay_workspace_run_events({ "workspace_run_id": "wsr_...", "after_seq": 0, "limit": 100 })
get_workspace_run_evidence({ "workspace_run_id": "wsr_..." })

Workspace Run create, upload, transfer, finalize, and start tools accept idempotency_key. Event replay is bounded; call it again with the last seen sequence number to continue.

Local development

Use the source build when working from this repository or testing changes before a package release:

Terminal
pnpm --filter @crownest/mcp build
CROWNEST_API_KEY=cn_live_... node packages/mcp/dist/index.js

Focused package checks:

Terminal
pnpm --filter @crownest/mcp test
pnpm --filter @crownest/mcp typecheck

Next steps

On this page