Reference
MCP & API
Three surfaces, one shared RPC underneath: the unix socket, HTTP/WebSocket, and MCP.
In this guide
Guide
On this page
MCP tools
Served over stdio by default, or over streamable HTTP and legacy SSE with dpty mcp --http ADDR.
pty_listlist every session and its statepty_newstart a new sessionpty_sendtype into a sessionpty_screenread the current screenpty_logsread raw outputpty_waitblock until a pattern appearspty_historyread typed commands and eventspty_restartrestart a sessionpty_killstop a session
MCP config
Point an MCP client at the stdio server with:
"mcpServers": {
"dpty": {
"command": "dpty",
"args": ["mcp"]
}
}
}
For streamable HTTP or SSE instead, run dpty mcp --http 127.0.0.1:7979 and point the client at POST /mcp or GET /sse + POST /messages with the bearer token from dpty token (or start it with --no-auth to skip the token).
HTTP endpoints
Default listen address 127.0.0.1:7878, disabled with --no-http on serve or install. Every endpoint except /health needs the bearer token printed by dpty token.
| Endpoint | What it does |
|---|---|
GET /health | Liveness check. No token required. |
POST /rpc | The same JSON RPC the unix socket and CLI use. |
GET /ws | WebSocket attach: binary frames are terminal bytes, text frames are JSON control messages such as resize. |
POST /mcp | MCP streamable HTTP, when dpty mcp --http is running. |
GET /sse + POST /messages | Legacy MCP transport, same --http listener. |
Unix socket
~/.durable-pty/dpty.sock (mode 0600, local to the machine). JSON lines in and out; an attach call upgrades the connection to binary frames for live terminal I/O. The CLI and the MCP stdio server both use this socket — it is the one RPC surface everything else sits on top of.