Transport & Framing
Transport: stdio (standard input/output)Framing: NDJSON (newline-delimited JSON)
Protocol: JSON-RPC 2.0
Batching: Not supported in v1 Each message is a single JSON object terminated by a newline character (
\n). The server reads from stdin and writes to stdout.
Starting the Server
Message Format
Request
Clients send JSON-RPC 2.0 requests:jsonrpc: Always"2.0"id: String, number, or null (required for requests)method: Method name (e.g.,"rpc.handshake","session.send")params: Optional parameters (object or array)
Response
Server returns results or errors: Success:Notifications
Server emits events as JSON-RPC notifications (noid field):
Error Codes
Standard JSON-RPC 2.0 error codes:| Code | Name | Description |
|---|---|---|
-32700 | Parse Error | Invalid JSON received |
-32600 | Invalid Request | Request structure invalid |
-32601 | Method Not Found | Method does not exist |
-32602 | Invalid Params | Invalid method parameters |
-32603 | Internal Error | Server-side error |
-32000 | Server Error | Generic server error |
Event Types
The server emits these event notifications:session.status- Session state updatessession.message.appended- New messages addedsession.stream.chunk- Streaming response chunkssession.tool.call.started- Tool execution startedsession.tool.call.completed- Tool execution finishedsession.tool.results- Tool results availablesession.completed- Session task completedsession.interrupted- Session interrupted by usersession.error- Session error occurredauth.flow.started- OAuth flow initiatedauth.flow.url- Browser URL for OAuthauth.flow.device_code- Device code for OAuthauth.flow.completed- OAuth successfulauth.flow.failed- OAuth failedstate.changed- Runtime state changed
Shutdown
The server shuts down gracefully when:- Client calls
system.shutdown - Stdin is closed
- Process receives SIGINT/SIGTERM
Protocol Version
Current version:1.0.0
The protocol follows additive-first versioning: new methods and event types may be added without breaking existing clients. Method names and semantics remain stable within major version 1.