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_list list every session and its state
  • pty_new start a new session
  • pty_send type into a session
  • pty_screen read the current screen
  • pty_logs read raw output
  • pty_wait block until a pattern appears
  • pty_history read typed commands and events
  • pty_restart restart a session
  • pty_kill stop 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.

EndpointWhat it does
GET /healthLiveness check. No token required.
POST /rpcThe same JSON RPC the unix socket and CLI use.
GET /wsWebSocket attach: binary frames are terminal bytes, text frames are JSON control messages such as resize.
POST /mcpMCP streamable HTTP, when dpty mcp --http is running.
GET /sse + POST /messagesLegacy 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.