Skip to documentation

Guide · MCP and agents

Available

Give coding agents tools, context, and boundaries

MCP lets an agent inspect a DotMock workspace, propose changes to the shared draft, simulate them with the real runtime, and apply approved actions. The tool contract—not free-form chat text—is the source of truth.

In this guide

  • Connect with a team API key
  • Keep one agent thread scoped to the current API
  • Use draft-aware mutations and deterministic tests
  • Require approval for destructive operations

Prerequisites

  • An MCP client
  • A team-scoped DotMock management credential
  • The target workspace ID in $API_ID for API-scoped work
On this page

Connect the MCP server securely

Create a team API key with only the permissions the agent needs. Configure the remote MCP endpoint in your client and inject the key from a secure input or environment variable rather than committing it.

MCP client configuration
{
  "mcpServers": {
    "dotmock": {
      "type": "http",
      "url": "https://mcp.dotmock.com/mcp",
      "headers": {
        "x-api-key": "${input:dotmock-api-key}"
      }
    }
  }
}

Inspect before authoring

A useful agent first reads the workspace kind, current draft, operations or fixtures, reusable models, visible state resources, recent failures, and capability flags. API-scoped state remains private to that API; workspace-shared state is visible only inside the same team.

Mutate the shared draft with one valid payload

Definition update tools accept exactly one full definition or one patch. An agent should reuse existing models, return JSON for JSON APIs, add ordinary conditional responses for not-found behavior, and preserve unrelated draft changes.

Simulate before publication

Use a deterministic seed and protocol-specific request. Inspect the winning operation, separated response contract, diagnostics, and proposed state diff. Dry-run cannot persist state, deliver webhooks, proxy, or execute callouts.

Keep destructive actions approval-aware

Reading, validation, and safe simulation can proceed directly within scope. Publishing, rollback, resets, restores, deletion, and external effects require explicit approval. The built-in Dot pane follows the same boundary and keeps context when the workspace is resumed.

  • Read with api:read
  • Mutate drafts and live entries with api:update
  • Ask before publish, reset, restore, delete, or externally deliver
  • Report the applied revision and verification result after a successful mutation