an MCP server for livecoding a remote Smalltalk
This project enables AI agents to interact with a live Smalltalk object memory, through the Model Context Protocol (MCP).
AI Agent (MCP client)
↓ MCP protocol (HTTP/SSE)
Deno Bridge Server (bridge.js)
↓ Tether protocol (binary)
SqueakJS Browser Instance (Caffeine object memory)
The bridge server is exposed via Tailscale funnel, making SqueakJS accessible to remote AI agents.
- Agent gets initial object - The AI agent uses the
peertool to get a reference to the first exposed Smalltalk object (a Tether instance) - Agent sends messages - The agent uses the
sendtool to send Smalltalk messages to objects in the live image, passing arguments as JSON - Bridge translation - The MCP server translates JSON arguments to Tether binary protocol for transmission to Smalltalk
- Live execution - The Smalltalk image executes the message and returns Tether-encoded results
- Response translation - The MCP server translates Tether results back to JSON with object references as integer tags
- Tool call caching - Every tool call and response is cached by the MCP server as a resource, accessible by timestamp
- Semantic accumulation - The agent builds understanding of the object memory through successive interactions
- Source code access - The agent can read method source code via MCP resources (format:
file:///source/<class>/<selector>) - Method compilation - The agent can compile and install new methods using the
compileMethodtool
Agents interact with Smalltalk objects using only their tags (32-bit unsigned integers defined by the Tether protocol). The agent accumulates semantic knowledge about these objects in its context window through exploration - sending messages, observing results, and building a mental model of the live system. The MCP server handles all Tether encoding/decoding, so agents work entirely with JSON.
bridge.js- Deno server that bridges MCP and Tether protocolstether.js- JavaScript implementation of the Tether protocoltether-encoding.md- Reference guide for encoding/decoding Tether messages
To evaluate 3 + 4:
send(
receiver: 1073741827, // SmallInteger 3 (tag: 3 + 1073741824)
selector: "+",
arguments: "[4]" // JSON array containing SmallInteger 4
)
// Returns: {"result": 1073741831} // SmallInteger 7 (tag for 7)The agent uses JSON for message arguments while remote object references are represented as 32-bit unsigned integers (tags) defined by the Tether protocol.
A user and agent work together through use cases of ever-increasing complexity, developing Markdown files explaining what the agent is learning about Smalltalk by interacting with it. This will provide context to future agents about how to use Smalltalk, and enable pair programming with users.