Skip to main content
Glama
README.md
# AppleBridge

**Remote Apple Events for System 7 — control, monitor and build on a classic Mac from outside, with AI or without.**

AppleBridge puts a **classic Macintosh on the end of a socket** — an emulated one under
Basilisk II or SheepShaver, or a real 68k machine over a serial cable. At its core it gives
System 7 what Mac OS X later shipped as *remote Apple Events*: any program on the network can
send commands into the Mac — through MPW's ToolServer and the daemon's native verbs — and read
real output back, plus extras the original never had, like screenshots of the guest's own
screen for context.

That makes it two things at once:

- **A low-level remote-control plane for classic Mac OS.** No AI required: the bridge is a
  host server and a guest daemon speaking a plain TCP (or serial) protocol, and anything — a
  script, a CI job, `nc` on a command line — can control, monitor and manage System 7 with it.
- **A full AI development environment.** 38 MCP tools expose the whole surface to Claude Code
  out of the box, but you can throw whatever model you want at the problem — frontier models
  already know MPW, THINK C and Inside Macintosh — so software can be written, compiled,
  linked, run and debugged on the Mac in natural language.

![The AppleBridge Verbose console on System 7.6.1, classic: a strip with the activity LED, the current command and a half-moon button, a scroller on the left, a Files listing and a greeting in the log, and a NET OT / RX / TX / ERR / LAST footer](docs/images/daemon-verbose-0.8d52.png) ![The same console in night mode: light text on a dark well, the same strip and footer](docs/images/daemon-verbose-0.8d52-night.png)

*The guest's side of a session, in daemon 0.8d52's console: what arrives over the bridge —
`LISTDIR`, a ToolServer `Files` listing, `DISKINFO` — and the footer carrying the transport,
the RX/TX counters, the error count and the last round trip. The half moon at the top right
switches to night mode (right); the choice is kept in the prefs. The daemon itself is
**faceless**; this **Verbose** console is optional (`MONITOR:0`/`MONITOR:1`), and its first
line names the version that is actually running. Captured from the emulator's framebuffer,
so it is the guest's own screen, not a picture of a window on someone's Mac.*

## What You Can Do

```
You: "Create a counter app that counts from 0 to 20"
Claude: [Writes C code, compiles with SC, links, and runs on System 7.6.1]
Result: Classic Mac app running in authentic 1990s environment
```

**Examples:**
- **Build classic Mac apps** - Claude writes, compiles, and tests 68k code
- **Develop in assembly** - Create apps using MPW assembler with AI assistance
- **Automate MPW workflows** - Compile, link, and execute remotely
- **Debug with feedback** - Full command output capture via ToolServer
- **Learn retro programming** - AI tutor for 68k assembly and Toolbox APIs

On my bootstrap way developing AppleBridge, I had the desire to have something like 'IP-Runner' ($WINDOWS) for AppleTalk.\
And like in a ferry tail, I typed my wish and BANG! MacNetScan was born: https://macintoshgarden.org/apps/macnetscan

AppleBridge on a command prompt isn't really sexy with its STATUS and DISKLIST commands.\
But it was designed for Claude Code, talking to folks like ToolServer and - oh Boy - MPW!

In the Garden and the Repository, there are treasure chests of powerful Macintosh tools to simply plug-in and compile what you want in plain Assembler or C.\
These days in the 80/90-ties, someone able to program MPW was someone with Macintosh superpower. - I did work for the big players, even they could not afford MPW. - At least not for us marketing folks. 

I set the bar even higher and implemented mouse and system menu operations in MCP.\
That's because the last training I gave to Symantec in Amsterdam, got me my own THINK C compiler. And a short while back (~1993), I studied and swallowed Dave Mark's 'Macintosh C Programming' books, which I bought at Barnes&Nobles on a biz trip to the States.

That was really a hart nut for Claude Code, but after introducing how to screenshot, operating the mouse and making use of Macintosh Command Keys, Claude started to explore available libraries
and did his thing: 

<img width="512" height="352" alt="GraphicsDemo" src="https://github.com/user-attachments/assets/0865a4c8-78cc-493e-96db-6ccd1aa03276" />

You can read the full story here: [Building a THINK C++ Graphics Demo](https://td5.390er.de/applebridge/think-cpp-graphics-demo-walkthrough/)

And I was really impressed about what we could establish within three days. -\
Nope! Claude Code made it in about 3 minutes and the biggest challenge were time consuming screenshots.\
But that was the proof, with AppleBridge big things become possible.

But back to MPW. It's syntax is based on Unix like commands and here the three Studges: **Claude Code**, **ToolServer** and **MPW** come together for a perfect play.\
In total over 6 months of time I established AppleBridge in a bootstrap way. AppleBridge did some heritage from [ClaudeBridge](https://td5.390er.de/claudebridge/) .
You can already see the REZ part in it and here the programming did really start.

Step-by-step I established 38 MCP tools, that allow Claude Code to access the Macintosh System and almost all toggles of MPW, Think C or even Microsoft FoxPro and yes, you name it!\
You can become creative yourself and build your own Macintosh software dream. Boundless, if there wouldn't be system limits like memsize or CPU speed.

What doesn't work? - Initially I planned implementing a browser with TLS support, simply looking at modern https:// web pages.\
That is not possible or better feasible: Libraries (TLS) are missing and need to be written yourself, compute speed would let you wait almost endlessly.\
And here we simply hit the system limits, like in real life.  J



## Architecture

```mermaid
flowchart TB
    subgraph Host["Host (macOS)"]
        Claude["Claude Code\n(AI/LLM)"]
        MCPServer["mcp/server.py\n(MCP, stdio)"]
        HostSrv["host_server.py\n:9001 control, :9000 daemon"]
    end

    subgraph BAII["Emulator (Basilisk II / SheepShaver) — or real 68k hardware"]
        subgraph Mac["Classic Mac, 68020+ (System 7.0+ / Mac OS 9)"]
            AppleBridge["AppleBridge Daemon\n(C, 68k)"]
            OT["OpenTransport / MacTCP\n(or Serial)"]
            ToolServer["ToolServer\n'MPSX'"]
            MPWShell["MPW Shell\n'MPS '"]
        end
    end

    Claude -->|"MCP (stdio)\ntool calls"| MCPServer
    MCPServer -->|"localhost TCP :9001\nforward command"| HostSrv
    HostSrv <-->|"daemon socket :9000\n(Mac connects OUT)"| OT
    OT <-->|"Network layer"| AppleBridge
    AppleBridge -->|"Apple Events\n'misc'/'dosc'"| ToolServer
    AppleBridge -.->|"fallback"| MPWShell
    ToolServer -->|"✓ Returns output\nvia AE reply"| AppleBridge
    MPWShell -.->|"✗ Empty reply\noutput to worksheet"| AppleBridge

    style Claude fill:#e1f5ff
    style MCPServer fill:#fff4e1
    style OT fill:#e1ffe1
    style AppleBridge fill:#ffe1e1
```

### Communication Flow

```mermaid
sequenceDiagram
    participant CC as Claude Code
    participant MH as Host (mcp + host_server.py)
    participant OT as OpenTransport
    participant AB as AppleBridge Daemon
    participant TS as ToolServer

    Note over AB,MH: Initial connection
    AB->>OT: Initialize OpenTransport
    OT->>MH: TCP Connect to :9000
    MH-->>OT: Connection established
    OT-->>AB: Connected

    Note over CC,MH: MCP Layer
    CC->>MH: MCP tool call (port :9001)<br/>mpw_execute("Echo 'Hello'")

    Note over MH,AB: TCP/OpenTransport Bridge
    MH->>OT: Forward command via TCP
    OT->>AB: COMMAND:len\n<cmd>

    Note over AB,TS: Apple Events Layer
    AB->>TS: Apple Event 'misc'/'dosc'
    TS->>TS: Execute: Echo 'Hello'
    TS-->>AB: AE Reply (Items:3)<br/>STDOUT, STDERR, STATUS

    Note over AB,MH: Response path
    AB->>OT: STATUS:0\nSTDOUT:len\n<data>
    OT->>MH: TCP response
    MH-->>CC: MCP tool result<br/>{success: true, output: "Hello"}
```

### The four layers

1. **MCP** — Claude Code ↔ `mcp/server.py` over stdio. **Optional**: it adds the 38 tools
   and natural language, and nothing below it depends on it.
2. **Control** — `mcp/server.py` (or any socket client) ↔ `host_server.py` on `localhost:9001`.
3. **Bridge** — the guest daemon ↔ `host_server.py` on `:9000`. **The daemon dials OUT**, so
   a guest behind NAT needs no inbound route. Carried by Open Transport, MacTCP or a serial
   line, chosen with `NET=`.
4. **Apple Events** — the daemon ↔ ToolServer / MPW Shell. **Optional**: this is the command
   tier. ToolServer returns output; MPW Shell runs the command and replies empty.

Layers 1 and 4 are the ones you can leave out, and each is a *tier you do not have* rather
than a broken install. Why OT *and* MCP is not one layer twice:
[docs/ARCHITECTURE_LAYERS.md](docs/ARCHITECTURE_LAYERS.md).

## Quick Start

### Prerequisites

**Host (macOS):**
- **Basilisk II**, **SheepShaver** and even a genuine 68kMac(!) on System 7 with a guest that boots. Nothing else — the
  host side is Python stdlib, so the system `/usr/bin/python3` is enough and there
  is nothing to build.
- An MCP client (Claude Code or Codex), if you want the MCP tools. The bridge itself works without it.

**Guest (System 7):**
- **System 7.0 or later on a 68020 or later** — any Mac with Color QuickDraw in
  ROM. Verified on 7.0, 7.0.1, 7.5, 7.5.3, 7.6.1 and Mac OS 9; 68000 Macs (Plus,
  SE, Classic) are not supported ([D-029](DECISIONS.md)).
  Per release — what was measured, what Mac OS 8 is expected to need — in
  [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
- **Open Transport** (7.5.3 and later) or **MacTCP** (2.0.6 runs on 7.0) — or no
  network stack at all, over a **Serial** line.
- **RAM:** the installer sizes the daemon for the machine — 1,000 K on a Mac with
  up to 16 MB, 2,000 K up to 32 MB — so a 12 MB PowerBook runs it with room to
  spare; updates through `mac_update_daemon` keep that size.
- **A real Macintosh works too.** Validated on a 68030 **SE/30**, where the link
  runs over **RS-422 serial** rather than Ethernet — the transport is a seam, not
  an assumption (`NET=Serial`; see [docs/SERIAL_TRANSPORT.md](docs/SERIAL_TRANSPORT.md)).
  An emulator is the easy path, not the only one.
- **No compiler, and no MPW.** MPW + ToolServer are optional and add the
  *command tier* (`mpw_execute`, `mac_compile`, `mac_build`). Without them
  everything else still works: screenshots, fork-aware file transfer, input
  injection, directory listings, clipboard, launch and shutdown. An absent
  ToolServer is a tier you do not have, not a broken install.

**Three steps to a working bridge**, then one command to confirm it: **1–2** on the
host, **3** inside the emulator, **4** back on the host. The guest step cannot be
scripted, because System 7 offers no scripting surface for the TCP/IP control panel.

Claude Code is **not** part of that. The bridge is a host server and a guest daemon;
you drive it over the control port with anything that can open a socket. Step 5 wires
it to Claude Code for those who want the MCP tools, and it is the only optional step
here. Fully worked example with more screenshots: [docs/SETUP.md](docs/SETUP.md).

**note:** I simply gave Claude Code the URL of this GitHub and he did the complete install.\
But I don't know, if this applies to all of you, as my chap Claude was my co developer and might have READ.ME files, you are missing.\
Simply give it a try and tell us about your experience.

### Which network setup?

What decides it is not the tool that makes the network but **what the guest sees: only
TCP/IP, or real Ethernet**. Everything else follows from that, AppleTalk included.

| | **Emulator + slirp** (what ships) | **Emulator + Ethernet bridge** | **Real Apple hardware** |
|---|---|---|---|
| Examples | the default `install_bridge.py` sets up | `etherhelper` on a Mac host; a tap device on a Linux bridge | a PowerBook Duo on Ethernet; an SE/30 on Ethernet or a serial cable |
| What the guest sees | TCP/IP only — slirp is a router inside the emulator | real Ethernet on your LAN | real Ethernet, LocalTalk, or a serial line |
| AppleTalk, AppleShare (`NBPLOOK`, `AFPMOUNT`) | **no** | **yes** (EtherTalk) | **yes** over Ethernet/LocalTalk; not over serial |
| AppleTalk alert at every boot | **yes** while the Network control panel names an EtherTalk connection — click OK, it is harmless | no | no |
| Setting up | one DHCP choice, no password | Mac host: two password prompts per launch and a second network interface ([D-015](DECISIONS.md)); Linux: a tap device and a bridge, once | the card or the cable; IP by hand or DHCP |
| Guest reachable from the LAN | no (behind NAT) | yes, its own address | yes |

Start with slirp unless you need AppleShare: it is the branch this guide installs and the
one that starts unattended. A real Mac is described in [docs/SERIAL_TRANSPORT.md](docs/SERIAL_TRANSPORT.md)
(serial) and needs nothing special on Ethernet beyond the host address in AppleBridgeConfig.

### 1. Configure the host

```bash
git clone https://github.com/LoetLuemmel/AppleBridge.git
cd AppleBridge/host
./install_bridge.py --dry-run   # read the plan; it changes nothing
./install_bridge.py
```

The clone is the whole download: the host side is Python stdlib, so there is
nothing to build and no dependencies to fetch.

`install_bridge.py` then discovers your emulator, sets its Ethernet backend to `slirp`, writes
`host/local.env`, installs the launchd agent that keeps the host server running,
and prints the guest-side values you need in step 3 — labelled by *whose*
address each one is, which is the mistake this step exists to prevent. It asks
for nothing and needs no password.

**What that costs, stated rather than buried:** the `slirp` backend carries **no
AppleTalk**. The Chooser stays empty, and `mac_appletalk_browse`, `NBPLOOK` and
`AFPMOUNT` — all built and tested — cannot be exercised on the branch this
installs. TCP keeps working either way, which is exactly how that gap disguises
itself. AppleTalk lives on the hand-configured `etherhelper` branch, which needs
two interactive password prompts per launch and therefore cannot start
unattended; that trade is the reason `slirp` is what ships.

If it **refuses**, read what it says. It will not convert a host already configured
for the `etherhelper` backend, because that is somebody's working AppleTalk setup —
except on a machine with **one network interface**, where it says the opposite and
means it: a bridged backend cannot reach the machine it runs inside, so no amount of
hand-configuring that branch produces a bridge there. `--force-slirp` overrides either.

### 2. Get the guest kit

Download `AppleBridgeKit.dmg` from the [latest release](../../releases) — a 2 MB
disk image holding the four 68K applications, the journaling driver the daemon
opens by name, and a prefs file. Add it to the emulator as a second disk and
relaunch, because the disk list is read at launch only:

```
disk /path/to/AppleBridgeKit.dmg
```

![The mounted AppleBridge Kit volume in the guest: ABJournalDRVR, AppleBridge, AppleBridge CP, AppleBridge Prefs, AppleBridgeConfig, AppleBridgeInstaller and AppleBridgeWatchdog](docs/images/installer-guest-kit-window.png)

**There is nothing to stamp on it.** The prefs ship `IP=10.0.2.2` — not the
address of the machine that built the kit, which a public artifact must never
carry, but the slirp constant that means *whichever host runs the emulator*:
slirp forwards it to that host's loopback, and the server hears it there because
it binds every address. So the kit needs no seeding step and no address of
yours.

The exception is a bridge server running on a **different** machine than the
emulator. Then the loopback is the wrong host, and only that machine's own
address can say so — set it in AppleBridgeConfig on the guest afterwards, or
write it into the image before you mount it:

```bash
cd host && ./install_bridge.py --seed-guest-prefs ~/Downloads/AppleBridgeKit.dmg
```

That second route needs `hfsutils` (`brew install hfsutils`), which macOS does
not ship; the config panel on the guest needs nothing.

### 3. In the guest: network first, then the installer

![The whole installation on System 7.0 with MacTCP 2.0.6: the kit folder, the installer's preflight with every check OK, Install, Restart, the watchdog starting the daemon, "AppleBridge is installed and running", live bridge traffic in the console, and About This Macintosh](docs/images/s7-70-install.gif)

*The whole installation on **System 7.0**, the oldest System it supports — 33 seconds
of a real run on the **slirp** setup, recorded from the emulator's framebuffer. The alert
at the restart, that no driver for the selected AppleTalk connection was found, is that
setup speaking, not the installer: see* [Which network setup?](#which-network-setup)

The network setting depends on the System — these are the *guest's own* values:

**System 7.5.3 and later — Open Transport, the TCP/IP control panel.** slirp answers
DHCP itself:

```
Connect via   Ethernet
Configure     Using DHCP Server
```

**System 7.0 to 7.5.x — MacTCP, the MacTCP control panel** (MacTCP 2.0.6 runs on
7.0; System 7.0 and 7.1 do not include it). Select **Ethernet**, click **More…**,
choose **Obtain Address: Manually** and enter the gateway; then **OK** and the IP
address in the main panel:

```
Ethernet
More…  Obtain Address   Manually
       Gateway Address  10.0.2.2
IP Address              10.0.2.15
```

![MacTCP's More… dialog on System 7.0.1: Obtain Address Manually, gateway 10.0.2.2](docs/images/installer-guest-mactcp-more.png) ![The MacTCP panel: Ethernet selected, IP address 10.0.2.15, version 2.0.6](docs/images/installer-guest-mactcp-ip.png)

Measured on System 7.0 and 7.0.1 under Basilisk II's slirp: no restart was needed,
and the daemon connected with the class-A default mask MacTCP proposes. The
installer picks the transport by itself — Open Transport if it is there, otherwise
MacTCP, otherwise the serial port — so there is nothing to choose in AppleBridge.

On slirp, System 7.0 to 7.5 then reports at every boot that **no driver for the selected
AppleTalk connection** was found and falls back to LocalTalk. That is harmless — slirp
carries no AppleTalk, and TCP/IP is unaffected — so **OK** is the whole answer. What the
alert reads is the connection chosen in the **Network** control panel, which keeps it in
parameter RAM; making AppleTalk *Inactive* in the Chooser does **not** silence it
(measured on System 7.0, 2026-11-22: AppleTalk inactive, the alert at the next boot all the
same). A minimal 7.0 or 7.1 install may not carry the Network control panel at all.

Do this **before** running the installer. Nothing breaks if you don't — the
daemon redials every 30 seconds and picks itself up — but an installer reporting
success over a bridge that never comes up reads like a failed install when only
one field is wrong.

Then open the **AppleBridge Kit** volume and run **AppleBridgeInstaller** from
it. It preflights the machine, refuses environments that cannot work, copies the
suite, and installs the autostart so the bridge comes up on every boot.

![The installer's preflight screen (0.8d60): System 7.0 or later, Apple Events, network transport, 32-bit addressing, memory profile and disk space all OK, ToolServer marked optional](docs/images/installer-preflight-0.8d60.png)

It says what it found before it does anything, and it names its own version so a
screenshot is answerable. On a Mac with 32 MB or less it also sizes the daemon for
it — 1,000 K up to 16 MB, 2,000 K up to 32 MB — and an update through
`mac_update_daemon` keeps that size. A `?` is not a failure — `ToolServer` is optional, and
says so. If a **required** check fails, the Install button stays disabled rather
than letting you start something that cannot finish.

Press **Install**, and it reports where everything went and offers **Restart** —
what it copies where, the install log and both configuration panels are shown
step by step in [docs/SETUP.md § 3.0](docs/SETUP.md#30-installing-from-the-kit-step-by-step).

When it is done, drag the kit volume to the Trash and remove its `disk` line.
On the first boot afterwards the daemon confirms it is running:

![The daemon's one-shot confirmation, laid out like a System 7 alert: the AppleBridge icon at the upper left, "AppleBridge is installed and running", the kit can go to the Trash, and an OK button](docs/images/installer-guest-installed-and-running.png)

**If it does not go to plan, the installer wrote down why.** It leaves a text
file called `AppleBridge Install Log` at the root of the guest's boot volume —
the preflight table, the transports it found, one line per copied binary with
its error code, and whatever the window said. It is written when the installer
opens, before you press anything, so a run whose Install button is disabled by a
failed check leaves a record too. Attach that file to an issue and the answer is
usually in it. (The host installer does the same into
`~/Library/Logs/AppleBridge/`.)

#### The control panel

The daemon is **faceless** — it runs as a service with no window — so everything a
human needs to change about it lives in two panels the installer puts in place:
**AppleBridgeConfig**, an application in the installation folder, and
**AppleBridge CP**, a real System 7 control panel in *Control Panels* (Apple menu ▸
Control Panels) with the everyday subset — status, helper apps and the console look.
Both write the same prefs file:

![AppleBridgeConfig: the animated logo and the program's name in a banner, then titled groups — Status (a light, and the startup checkbox), Host (the address with Set), Network (service, port and speed), Console Look (System 7 / NeXT) and Helper Applications (a list with Add… and Remove)](docs/images/config-panel-0.8d60.png) ![AppleBridge CP in the Control Panels: daemon and autostart lights, the host address, the helper list with Add and Remove, and the Console radios](docs/images/control-panel-cdev-0.8d60.png)

| | |
|---|---|
| **Status** | a light and a sentence: whether the service is running |
| **Start AppleBridge when this Mac starts up** | the checkbox writes (or deletes) the Startup Items alias. It points at the *watchdog*, not the daemon, because the watchdog owns the daemon's lifecycle |
| **Host address** | the one value a kit cannot know — **the host's** address, not the guest's, which is the confusion the label exists to end. **Set** (or Return) writes it and the daemon picks it up |
| **Network** | Open Transport, MacTCP or Serial. `NET=` hot-swaps between commands, without relaunching the daemon |
| **Port / Speed** | dimmed unless Serial is selected. Read at startup, not hot-swapped, so they take effect on the next launch — and the host must be set to the same baud, as there is no autobaud |
| **Helper Applications** | the applications the daemon chain-launches at startup, ToolServer first. **Add…** appends an `APP=` line, **Remove** deletes the selected one |
| **Console look** | the frame of the daemon's Verbose console: **NeXT** (the default) or **System 7** — classic scroll bars at the right and bottom. Takes effect within seconds; also in AppleBridge CP. Pictures of both in [docs/SETUP.md § 3.0](docs/SETUP.md#30-installing-from-the-kit-step-by-step) |
| *Not on the panel* | the daemon keeps its own settings in the same prefs file: `WIN=` (the console's position), `CONSOLE=classic\|dark` (the half moon, or **View → Night mode**; **File → Close** ⌘W hides the console, **View → Console** brings it back — there is deliberately no Quit). **Typing into the console:** click the window, type one of the daemon's own read-only commands and press Return — `TREE <path>` (`/F` files, `/D` to disk), `DISKINFO [vol]`, `PROCLIST`, `LISTDIR <folder>`, `HELP`; a bare volume name (`TREE MeinMac`) means the volume, ↑ recalls the last line. Nothing that writes, launches, mounts or restarts runs from there, and, by hand, `FONT=<name> <size>` for the console log (default Monaco 9). It applies `CONSOLE=` and `FONT=` live. Not saved: **View → Show details** (the AE trace and a volume list) and **View → Ping** (Cmd-P: the `PING`/`STAT` heartbeat and the watchdogs' `PROCLIST/Q` polls, hidden by default; a repeat counts up, `PING (x7)`) — [mac/config/README.md](mac/config/README.md) |
| **File ▸ Quit** (⌘Q) | quits the panel — not the daemon. The copyright and version are under **Apple ▸ About AppleBridge Config…**; **Edit** cuts, copies and pastes in the address field |

There are deliberately **no Launch/Stop buttons**. The daemon is meant to run
continuously, and quitting it tears down Open Transport in a way that has cost a
host crash. Start it through autostart, or from the Finder.

Full details, including how the autostart alias is built:
[mac/config/README.md](mac/config/README.md).

### 4. Check that it came up

```bash
cd host && printf 'MACSTATUS\n\n' | nc -w 5 localhost 9001
```

`host_connected=1` and `daemon_responding=1` mean the bridge is live. The daemon
also says so itself, in its own console in the guest: `SYNC-OK`, the host it
reached, and `HELLO:2` for the negotiated protocol.

If it does not come up, run `bridge_doctor` — it diagnoses across layers (launchd
job, listeners, emulator backend, the address the guest is configured to dial)
and answers even when the host server is down. Failure modes and their causes:
[TROUBLESHOOTING.md](TROUBLESHOOTING.md).

> **Building the guest software from source** is a different route and needs MPW
> on the guest — see [docs/SETUP.md](docs/SETUP.md) Part 3.1. The kit above
> exists so that nobody has to.

### 5. Optional: drive it from Claude Code

Everything above works without this. The bridge answers on the control port, so
any client that can open a socket can use it — that is how the verbs in this
README are shown, and it is how a machine with no Claude Code installed is
driven:

```bash
printf 'DISKINFO\n\n' | nc localhost 9001               # every mounted volume, by name
printf 'MACSTATUS\n\n' | nc localhost 9001              # is the daemon answering
printf 'LISTDIR:<volume>:AppleBridge:\n\n' | nc localhost 9001
```

`<volume>` is your guest's own boot volume — `DISKINFO` above prints it, which is why
it comes first. It is not the same on two machines.

What MCP adds is the **38 tools** below, and natural language on top of them.

**There is nothing to configure.** `.mcp.json` is committed at the root of this
repository, Claude Code reads it when it starts in the project directory, and it
launches the server itself — no `claude mcp add`, no editing, no approval step:

```json
{
  "mcpServers": {
    "applebridge": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "python", "-m", "mcp.server"],
      "env": {}
    }
  }
}
```

Measured rather than assumed (2026-08-01): a **fresh clone**, in a directory
Claude Code had never seen, had all 33 tools available in its very first session,
and no approval record was written for it. Confirm it yourself with:

```console
$ claude mcp list
applebridge: uv run python -m mcp.server - ✔ Connected
```

`✔ Connected` means the server started; it does **not** mean the guest is up —
that is step 4 above, and the two fail independently. Inside a session, `/mcp`
shows the same thing. Changing the tool list takes effect on the next session:
the server is started once, at launch.

The MCP server talks to `host_server.py` on the same control port (9001); start
the host stack with `cd host && ./start_stack.sh` (it also auto-starts via
launchd). Then:

```
You: "Execute 'Directory' command on the Mac"
Claude: [Uses mcp__applebridge__mpw_execute tool]
Result: MeinMac:MPW:AppleBridge:

You: "Create a Hello World app"
Claude: [Writes hello.c, compiles, links, launches]
Result: Mac dialog showing "Hello, World!"
```

### 6. Optional: connect Codex

Complete steps 1–4 to get the AppleBridge host server and System 7 guest running.
With the Codex CLI installed, run the following from the root of your AppleBridge
checkout:

```bash
codex mcp add applebridge --env "PYTHONPATH=$PWD" -- /usr/bin/python3 -B -m mcp.server
codex mcp list
```

The command registers AppleBridge in your user-level Codex configuration. The
absolute checkout path in `PYTHONPATH` lets Codex launch the server from other
directories. If you move the checkout, remove the registration with
`codex mcp remove applebridge` and run the setup commands from its new location.

Start a new Codex session and ask **“Check the System 7 guest status with
AppleBridge.”** The `mac_status` response should show `host_server_running`,
`daemon_connected`, and `daemon_responding` as `true`. MPW commands also require
`toolserver_running` to be `true`. If the guest status check fails, see
[Troubleshooting](TROUBLESHOOTING.md).

## Available MCP Tools

**38 tools**, in two groups. The split matters more than the list: the *command*
tier needs MPW/ToolServer on the guest, everything else does not — so a guest
with no compiler is still fully driveable.

| Group | Tools |
|---|---|
| **Command tier** (needs ToolServer) | `mpw_execute`, `mac_compile`, `mac_build`, `mac_generate_compilable`, `mac_read_file`, `mac_list_files`, `mac_send_apple_event` |
| **Move bytes, run, observe** | `mac_put_file`, `mac_get_file`, `mac_write_file`, `launch_app`, `mac_https_get`, `mac_screenshot`, `mac_fb_screenshot`, `mac_clipboard_get`, `mac_clipboard_set` |
| **Drive the guest** | `mac_type`, `mac_key`, `mac_click`, `mac_menu`, `mac_menu_front`, `mac_host_click`, `mac_host_menu`, `mac_host_type`, `mac_host_move`, `mac_host_screenshot` |
| **Network discovery** | `mac_appletalk_browse` |
| **Toolbox reference** (no guest needed) | `mac_toolbox_lookup`, `mac_toolbox_search` — THINK C 7 headers, THINK Reference and Inside Macintosh through the Mac68k Reference API |
| **Debug** (experimental; local x86_64 host, debug emulator build) | `mac_debug` — break in, break points (by address or trap name), registers, memory and 68K disassembly through cxmon inside Basilisk II, on a clone of the guest's disk — setup in [docs/MAC_DEBUG.md](docs/MAC_DEBUG.md) |
| **Lifecycle & liveness** | `mac_status`, `bridge_doctor`, `mac_verbose_log`, `mac_reboot`, `mac_shutdown`, `mac_restart_toolserver`, `mac_update_daemon`, `run_applescript` |

`mac_screenshot` reads the **emulated framebuffer** through the daemon, not the
host's window — so it is unaffected by where the emulator window sits or what
overlaps it. `mac_host_screenshot` is the host-side counterpart, for the moments
when a modal tracking loop has the guest and the daemon cannot answer.
`mac_fb_screenshot` is the third path: on a **local** Basilisk II built with the
fb-export patch it reads the framebuffer straight out of the emulator process —
12–31 ms per frame, pixel-exact, zero bridge traffic — and falls back to
`mac_screenshot` everywhere else (the reply's `source` says which path answered).

`mac_appletalk_browse` is the one entry in this table the default installation
cannot reach: it needs AppleTalk, and the `slirp` backend does not carry it (see
step 1). It works on the hand-configured `etherhelper` branch. Listing it without
that note would advertise a capability the shipping configuration does not have.

## Project Structure

```
AppleBridge/
├── mac/                          # 68k guest software (C + 68K asm)
│   ├── src/                      # daemon sources
│   ├── config/                   # AppleBridgeConfig, the control panel
│   ├── installer/                # AppleBridgeInstaller
│   ├── examples/                 # annotated single-file examples (C and 68K asm)
│   └── Makefile.68k              # MPW makefile
├── mcp/                          # Python MCP server (the MCP entry point)
│   ├── server.py                 # `python -m mcp.server` (see .mcp.json)
│   ├── tools.py                  # the 38 MCP tools
│   └── mac_connection.py         # talks to host_server.py on :9001
├── host/                         # Host server + utilities
│   ├── host_server.py            # the bridge: :9000 daemon socket + :9001 control
│   ├── start_stack.sh            # bring up the stack (+ launchd auto-start)
│   ├── encoding_convert.py       # UTF-8 ↔ MacRoman
│   └── screenshot_decode.py      # Raw Mac pixmap → PNG (stdlib only)
└── examples/                     # reference guest apps (MinAsm, MinQDC)
```

## Documentation

- **[ARCHITECTURE.md](ARCHITECTURE.md)** - Detailed explanation of the MCP + OpenTransport dual paradigm
- **[docs/SETUP.md](docs/SETUP.md)** - the detail behind the install: why the emulator's networking is configured this way, building the guest software from source, and the reference tables
- **[docs/SCREENSHOT_V2.md](docs/SCREENSHOT_V2.md)** - how a look at the guest got 30× cheaper: region, PackBits and an XOR row delta in the daemon, an indexed PNG on the host, with the before/after measurements and the VNC assessment
- **[docs/RUECKMELDUNG_2026-08-08_xavier.md](docs/RUECKMELDUNG_2026-08-08_xavier.md)** - dated feedback from the parallel (Jetson) session: four evidenced findings from one day's work, kept as delivered until each is incorporated or closed
- **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)** - Common issues, fixes, and known limitations
- **[ASSEMBLY_TEMPLATE.md](ASSEMBLY_TEMPLATE.md)** - 68k assembly programming guide

## Example Workflow

```bash
# Claude Code session:
"Create a counter app in MeinMac:MPW:OurTest that counts 0-20"

# Behind the scenes:
1. Claude writes counter.c
2. Converts to MacRoman via mac_write_file
3. Compiles: SC counter.c -o counter.o
4. Links: Link counter.o Interface.o MacRuntime.o -o Counter
5. Sets type: SetFile -t APPL Counter
6. Launches: Counter
7. Reports success with screenshot

# Total time: ~30 seconds
# Your effort: One sentence
```

## Status

**Current daemon:** 0.8d61 ("tells you when a new release exists") — the version the
daemon itself reports, from `mac/vers.r`.

- TCP bridge, NAT-reversed (the guest dials OUT), with an asynchronous connect
- Three transports behind one seam, chosen with `NET=` in the control panel:
  **Open Transport**, **MacTCP** and **Serial** — the last reaches a machine with no
  Ethernet at all, which is how the SE/30 is driven
- Application-level heartbeat + watchdog, so a host that goes away cannot freeze the guest
- **Tells you when a newer release exists** (daemon 0.8d61+): the host checks the latest
  guest kit on GitHub at most once a day and, once per version and guest, has the daemon
  raise a System 7 notice (the Notification Manager: a mark in the application menu, the
  alert sound, a small alert). It only tells — installing stays your step with the kit.
  Switch it off with `APPLEBRIDGE_UPDATE_CHECK=0` in `host/local.env`
- Apple Events command execution (ToolServer returns output; MPW Shell does not)
- Remote compilation and linking
- 38 MCP tools for Claude Code — optional, on top of the control port
- Encoding conversion (UTF-8/LF ↔ MacRoman/CR)
- Screenshot capture: the emulated framebuffer, decoded to PNG on the host
- Host server auto-start via launchd

Validated on Basilisk II (System 7.0, 7.0.1, 7.5.3 and 7.6.1), SheepShaver (Mac OS 9),
and real hardware — a Macintosh SE/30 over RS-422 and a PowerBook Duo 230 (System 7.5,
12 MB) over MacTCP. The floor is System 7.0 on a 68020 ([D-029](DECISIONS.md)).

## Credits

**Built by:** Pit with love for 68K and Claude
**AI Assistant:** Claude Sonnet 4.5 (Anthropic)
**Technologies:** Open Transport / MacTCP / serial, MCP, Apple Events, MPW, System 7
**Platform:** Basilisk II or SheepShaver on macOS — and real 68k hardware

**Daemon icon:** the Macintosh SE/30 in it is adapted from "Se30.jpg" by Danamania (Wikimedia Commons,
CC BY-SA 2.5); the Bay Bridge tower from a public-domain HAER photograph (Library of Congress). The icon
artwork is therefore CC BY-SA 2.5 — see [mac/art/photo-icon/ATTRIBUTION.md](mac/art/photo-icon/ATTRIBUTION.md).

**"Connecting classic Mac to the future"** ✨

## License

[MIT](LICENSE) — © 2026 Pit Förster. The licence covers **this project's own
source code**. The daemon's icon artwork is CC BY-SA 2.5 (see *Credits*).

**Read the warranty disclaimer, it is not boilerplate here.** This software
writes into emulator disk images, patches a system trap globally, and installs
an autostart item in the guest. It is provided as is, without warranty of any
kind.

**Apple components are not covered.** The 68K applications in
`AppleBridgeKit.dmg` are linked against Apple's MPW libraries (`MacTraps`,
`Interface.o` and relatives), which have never been released under terms that
explicitly permit redistribution. Nothing here grants you rights to those, and
an MIT header on this repository does not change their status.