Concepts

ClawQL connects agents to REST-shaped APIs through a thin MCP surface, without asking models to ingest full OpenAPI documents up front.

Architecture

Agent
  └─▶ MCP Server  (stdio, Streamable HTTP, or optional gRPC)
        ├─▶ search tool  ──▶ In-memory spec index
        └─▶ execute tool  ──▶ GraphQL client (single-spec)
                                    └─▶ GraphQL (in-process, single-spec)
                                          └─▶ Your REST API

Transports: stdio and Streamable HTTP are the usual paths; gRPC (protobuf model_context_protocol.Mcp) is optional and uses the same tool registration via mcp-grpc-transport—see Deployment.

In multi-spec mode, search uses one merged index while execute routes each operation to the correct spec (REST).

Design principles

  1. search first, execute second — discover operationId and parameters without loading the entire spec into context.
  2. GraphQL is internal — agents never write GraphQL; the server builds precise selections to keep tool outputs small.
  3. Single source of truth — the index and execution map derive from the same loaded OpenAPI/Discovery documents.

How the two phases save tokens

Phase 1 — planningPhase 2 — execution
Mechanismsearch + in-memory index instead of pasting full specsInternal GraphQL projection (when available) vs fat REST JSON
Typical winInput: huge spec text → short ranked hitsOutput: smaller structured payloads returned to the model
TradeoffSmall extra input for the internal query + variables

Benchmarks in the repo compare planning-context size (merged specs on disk vs workflow/search artifacts) to illustrate scale—not a literal per-call “API bill” from a model provider. See Benchmarks.

Ephemeral cache vs vault memory

The optional cache tool (CLAWQL_ENABLE_CACHE) holds short-lived key/value state in the MCP process (LRU, no disk). The optional audit tool (CLAWQL_ENABLE_AUDIT) holds short-lived structured events in-process (ring buffer, no disk) — not compliance-grade alone; see enterprise-mcp-tools.md. memory_ingest / memory_recall use your Obsidian vault (and optional memory.db) for durable notes and graph recall. Do not confuse them: use Session cache for scratch data; use the vault tools when the user expects persisted knowledge. See cache-tool.md.

Was this page helpful?