Skip to main content
Glama
mikesmullin

mcp-context-loop

by mikesmullin
README.md
# mcp-context-loop

MCP stdio server for **CONTEXT LOOP** navigation: `goto` and `loop_start_marker`.

These tools do **not** implement context-window mutation themselves. They call
methods angela exposes on a unix-socket host (`ANGELA_HOST_SOCK`):

| HTTP | angela method |
|------|----------------|
| `POST /goto` | `session.applyGoto(args)` |
| `POST /loop_start_marker` | `session.applyLoopStartMarker(args)` |

Angela starts that host for every harness and passes the socket path into this
server's env when the `context-loop` MCP preset is connected.

## Not enabled by default

New angela agents only get `file-io` / `term-local` (or whatever the agent
coffee lists). This server is **opt-in**:

1. Add the preset to the agent:

```coffee
mcp: [
  'file-io'
  'term-local'
  'context-loop'
]
```

2. Allowlist the tools (they are **not** on `DEFAULT_LUCY_ALLOWLIST`):

```
goto
loop_start_marker
```

(Registered **without** a server prefix so the model still sees `goto` /
`loop_start_marker`, matching the playbook text.)

## Tools

| Tool | Purpose |
|------|---------|
| `loop_start_marker` | Bookmark the previous context item; return the per-iteration playbook |
| `goto` | Hide context after that bookmark (keep the goto nav suffix); return the next-iteration brief |

## Env

- `ANGELA_HOST_SOCK` — unix socket path (set by angela). Required for tool calls.

## Run (usually via angela)

```bash
ANGELA_HOST_SOCK=/tmp/angela-host-….sock bun /workspace/mcp-context-loop/server.mjs
```