CLI & API Reference

This section documents the mcp command-line interface, the REST API endpoints provided by ContextMesh services, and the WebSocket event specifications.

mcp CLI Commands

Use the mcp CLI to manage manifests, run simulations, deploy MCPs, and inspect status.

Common Commands

  • mcp login Authenticate via Phantom wallet. Opens browser, prompts wallet connection.

  • mcp run Validate manifest.json, start a local MCP server, watch for changes and hot-reload.

  • mcp deploy Package and publish your manifest to the hosted service.

    bashCopyEditmcp deploy --workspace MyWorkspace --manifest ./manifest.json
  • mcp logs Stream logs from your MCP server or simulation.

    bashCopyEditmcp logs --simulation simulation-id
  • mcp help Show usage details for any mcp command.

    bashCopyEditmcp help deploy

REST Endpoints

ContextMesh exposes two main HTTP services: the Manifest Service and the Simulation Orchestrator.

Manifest Service

Method
Path
Description

GET

/api/manifests

List all manifests in your workspace

POST

/api/manifests

Create or update a manifest

GET

/api/manifests/{id}

Fetch a single manifest by its ID

DELETE

/api/manifests/{id}

Remove a manifest

Simulation Orchestrator

Method
Path
Description

POST

/api/simulations

Start a new simulation from a manifest ID

GET

/api/simulations/{simId}

Get status and metadata for a simulation

GET

/api/simulations/{simId}/output

Stream simulation output logs

POST

/api/simulations/{simId}/cancel

Cancel a running simulation

WebSocket Event Specs

Connect via WebSocket to receive real-time updates. URL is provided in the simulation response.

Connection

  1. Client opens WS to wss://api.contextmesh.com/ws?simId={simId}

  2. Server sends "ready" event when the stream is live.

Events

  • manifest:updated Payload:

    jsonCopyEdit{
      "manifestId": "abc123",
      "timestamp": 1682700000000
    }
  • simulation:progress Payload:

    jsonCopyEdit{
      "simId": "sim123",
      "status": "running",
      "progress": 0.45
    }
  • simulation:completed Payload:

    jsonCopyEdit{
      "simId": "sim123",
      "status": "complete",
      "resultUrl": "https://..."
    }
  • simulation:error Payload:

    jsonCopyEdit{
      "simId": "sim123",
      "error": {
        "code": "TIMEOUT",
        "message": "Simulation timed out"
      }
    }

Last updated