Supex uses newline-delimited JSON-RPC 2.0 over local sockets.
| Port | Transport | Channel | Purpose |
|---|---|---|---|
9876 |
TCP | Driver/CLI <-> SketchUp runtime | Bridge tools (tools/call) |
4433 |
TCP | REPL client <-> REPL server | Interactive Ruby eval |
9877 |
TCP | Driver <-> VCAD sidecar | VCAD evaluation/import tooling |
9878 |
WebSocket | Driver <-> VCAD viewer | Viewer relay/state/screenshot |
- JSON-RPC 2.0 envelope
- UTF-8 encoded JSON
- One message per line (
\n-delimited)
Clients identify first using hello.
{
"jsonrpc": "2.0",
"method": "hello",
"params": {
"name": "supex-driver",
"version": "X.Y.Z",
"agent": "mcp",
"pid": 12345,
"token": "optional",
"workspace": "/abs/workspace/path"
},
"id": "hello"
}Required params: name, version, agent, pid. version is the client's own version (the driver sends its package version); X.Y.Z above is a placeholder.
hellopingresources/listtools/call
Legacy command format (deprecated): the bridge still accepts requests carrying a top-level command and parameters instead of method: "tools/call". Such requests are rewritten into the equivalent tools/call request (command becomes name, parameters becomes arguments) and a deprecation warning is logged once per session. New clients must use tools/call.
tools/call payload:
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "eval_ruby",
"arguments": {"code": "Sketchup.version"}
},
"id": 2
}The driver exposes a logically persistent connection and auto-reconnects on failure/idle timeout. The runtime may close a socket after non-hello request handling, so reconnect behavior is expected.
Methods are intentionally minimal:
helloeval
REPL uses its own JSON-RPC loop and session snippet directory under .tmp/repl/.
Uses JSON-RPC with direct methods (hello, ping, resources/list) and tools/call for VCAD operations.
Handshake response includes negotiated protocol/capability metadata (for example: data imports, solid imports, fs watch, module tracking).
For schema contracts see:
docs/contracts/v1/handshake.schema.jsondocs/contracts/v1/tools-call.schema.jsondocs/contracts/v1/error-envelope.schema.json
Standard JSON-RPC errors apply (-32700, -32600, -32601, -32602, -32603).
Supex-specific conventions:
-32001for authentication failures- VCAD flows frequently return structured envelopes with
error_codestrings (for examplePATH_NOT_ALLOWED,PROTOCOL_MISMATCH,CAPABILITY_UNAVAILABLE)
Do not rely on a single numeric code for all path-policy failures across every flow.