Skip to main content
Glama
README.md
# turnstone-mcp

An MCP server that lets Claude, or another MCP client, look into your Turnstone agent sessions and, only if you enable it, act on them.

## The problem

When agents run in Turnstone and you want an assistant to supervise them, copying sessions by hand is slow, and raw session data is large, mostly model reasoning. turnstone-mcp returns short, readable summaries without the models' reasoning text, and keeps anything that changes Turnstone switched off until you allow it.

## Features

- Read tools: sessions, session details, worker sessions, task lists, recent output, cluster state, models.
- Answers are compact Markdown, with reasoning text removed.
- Optional write tools: send a message, remove a queued one, cancel a turn, approve or deny a waiting tool call, start a session.
- Optional full API and skill tools.
- Write switch, session allow-list, API path allow and deny lists, and an audit log of write calls.
- HTTP mode protected by its own access token, or local stdio mode.

## Tested setup

**Requirements:** A running Turnstone console with an API token, and an MCP client that supports streamable HTTP with an `Authorization` header, or the `mcp-remote` bridge for clients that cannot (see [Connecting a client](#connecting-a-client-what-you-need-and-why)). Developed against Turnstone `1.8.7`.

**How it was tested:** run as a [Dockge](https://github.com/louislam/dockge) stack on TrueNAS SCALE `27.0.0-RC.1`, used from Claude Desktop on Windows. That deployment ran the code in a stock Python image; the ready-made image is built from the same code. It has not been tested through the built-in apps interface of TrueNAS SCALE.

> **Security warning:** whoever has the access token can use everything you enabled, with the permissions of your Turnstone token. The connection is plain HTTP: use it on your home network or a VPN only, and do not expose the port to the internet. With write tools on, an assistant can approve tool calls.

## Quick start (Docker Compose)

Create a folder with these two files.

`compose.yaml`

```yaml
services:
  turnstone-mcp:
    image: mikealmogy/turnstone-mcp:${TS_IMAGE_TAG}
    container_name: turnstone-mcp
    restart: unless-stopped
    user: "${TS_UID}:${TS_GID}"
    read_only: true
    cap_drop: [ALL]
    security_opt: ["no-new-privileges:true"]
    tmpfs: ["/tmp"]
    env_file: .env
    volumes:
      - ./data:/data
    ports:
      - "${TS_PUBLISHED_PORT}:8765"
```

`.env`

```ini
TS_IMAGE_TAG=1.1.0
TS_UID=3000
TS_GID=3000
TS_PUBLISHED_PORT=30030

# Turnstone console address and API token (this server -> Turnstone)
TS_URL=https://turnstone.example.com:8443
TS_VERIFY=true
TS_TOKEN=
# Access token that MCP clients must send, at least 24 characters, not the same as TS_TOKEN
TS_MCP_TOKEN=

# 0 = read only
TS_ENABLE_WRITE=0
# Session ids or prefixes the write tools may touch. Empty = all sessions.
TS_WRITE_ALLOW_IDS=
# 1 = generic API and skill tools
TS_ENABLE_API=0
TS_API_ALLOW=
TS_API_DENY=

TS_LOG_LEVEL=WARNING
```

Set `TS_URL`, `TS_TOKEN` and `TS_MCP_TOKEN`. Create the `data` folder, writable by the user in `TS_UID` / `TS_GID`. Run `docker compose up -d`. A token can be generated with:

```
python3 -c 'import secrets; print(secrets.token_urlsafe(36))'
```

Then connect your client, as described below.

## Connecting a client: what you need and why

**The connection to this server is HTTP (streamable HTTP), not STDIO.** A client that connects over STDIO needs a bridge between the two, for example `mcp-remote`. The server expects the access token in an `Authorization` header, over plain HTTP in your network. (A local install without Docker can also run in STDIO mode.)

| Your client | What you need | Why |
| --- | --- | --- |
| Can open an HTTP MCP address and send a header (for example Claude Code) | Nothing else | It talks to the server directly. |
| Claude Desktop | Node.js 18 or newer and `mcp-remote` on your computer | See below. |

**Why Claude Desktop needs a bridge:** a custom connector added in the app is opened from Anthropic's servers, not from your computer, so it cannot reach a server in your private network. The configuration file of the app starts programs on your computer. `mcp-remote` is such a program: Claude Desktop starts it, and it forwards the requests to the server over your network and adds the token.

```
Claude Desktop -> mcp-remote (your computer) -> turnstone-mcp (your server) -> Turnstone
```

`mcp-remote` is a separate open source tool ([geelen/mcp-remote](https://github.com/geelen/mcp-remote)), not part of this project. `npx` downloads it the first time.

### Claude Code

```
claude mcp add --transport http turnstone http://<server>:30030/mcp --header "Authorization: Bearer <TS_MCP_TOKEN>"
```

### Claude Desktop

Add this to `claude_desktop_config.json` (Windows: `%APPDATA%\Claude\`, macOS: `~/Library/Application Support/Claude/`) and restart the app:

```json
{
  "mcpServers": {
    "turnstone": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://<server>:30030/mcp", "--allow-http", "--header", "Authorization:${AUTH_HEADER}"],
      "env": { "AUTH_HEADER": "Bearer <TS_MCP_TOKEN>" }
    }
  }
}
```

- `--allow-http` is required because the address is not HTTPS. Use it only on a network you trust.
- There is no space after `Authorization:` on purpose. Spaces inside arguments can break on Windows.
- This file then holds your access token. Keep it private.

Then ask the assistant to call `ts_whoami`.

## Tools

| Group | Tools |
| --- | --- |
| Read (always) | `ts_whoami`, `ts_sessions`, `ts_session`, `ts_children`, `ts_tasks`, `ts_outputs`, `ts_cluster`, `ts_models` |
| Write (`TS_ENABLE_WRITE=1`) | `ts_send`, `ts_unsend`, `ts_cancel`, `ts_decide`, `ts_new_session` |
| API (`TS_ENABLE_API=1`) | `ts_api_endpoints`, `ts_api`, `ts_skills`, `ts_skill_get`, `ts_skill_save` |

## Settings

| Variable | Meaning |
| --- | --- |
| `TS_IMAGE_TAG`, `TS_UID`, `TS_GID`, `TS_PUBLISHED_PORT` | Image version, container user and host port (compose only). |
| `TS_URL` | Turnstone console address. |
| `TS_VERIFY` | `true`, `false`, or the path of a CA file. |
| `TS_TOKEN` | Turnstone API token. |
| `TS_TOKEN_FILE` | File holding that token. Wins over `TS_TOKEN`. |
| `TS_MCP_TOKEN` | Access token for MCP clients (HTTP mode). |
| `TS_MCP_TOKEN_FILE` | File holding the access token. |
| `TS_ENABLE_WRITE` | `1` registers the write tools. |
| `TS_WRITE_ALLOW_IDS` | Limits write tools to these sessions. While set, new sessions cannot be created. |
| `TS_ENABLE_API` | `1` registers the API tools. Non-GET calls also need `TS_ENABLE_WRITE=1`. |
| `TS_API_ALLOW`, `TS_API_DENY` | Comma lists of API path prefixes. |
| `TS_FILES_DIR` | Folder in the container from which `ts_skill_save` may read files. Empty turns file reading off. |
| `TS_AUDIT_LOG` | Audit log of write calls. The image uses `/data/turnstone-audit.jsonl`. |
| `TS_TIMEOUT` | Seconds per request to Turnstone. |
| `TS_LOG_LEVEL` | `DEBUG`, `INFO`, `WARNING`, `ERROR`. |
| `TS_TRANSPORT`, `TS_HTTP_HOST`, `TS_HTTP_PORT` | Set by the image to HTTP mode on port `8765`. `stdio` is used for a local install. |

## Known limitations

- `ts_outputs` looks back at most 200 conversation rows, and items have no timestamps.
- Reading worker sessions needs a token with the `admin.cluster.inspect` permission.
- Tool calls are covered by automated tests against recorded and simulated answers; not every write and API tool has been exercised against a live Turnstone.
- Other Turnstone versions than the one above may answer differently.

## Security notes

- Write tools and API tools are off unless you turn them on.
- With `TS_ENABLE_API=1` the limits are your Turnstone token's permissions and the allow and deny lists. Give the token only what you need.
- The container in the example runs unprivileged, read-only and without Linux capabilities.
- Session content returned by the tools is sent to the AI service your MCP client uses.

## Local install on Windows (stdio)

`install/windows/install.ps1` installs the server for Claude Desktop on the same computer. Edit `TS_URL` in `turnstone.cmd`, and save your Turnstone token in `%USERPROFILE%\.claude-mcp\turnstone.token`. `turnstone-remote.cmd` instead connects Claude Desktop to the Docker service through `mcp-remote` (needs Node.js); set `TS_MCP_URL` in it.

## Build from source

```
docker build -t turnstone-mcp:local .
```

## Tests

```
pip install ".[dev]"
python3 -m pytest
```

The code is in `src/`. The test data is anonymized. Docker Hub image: `mikealmogy/turnstone-mcp`.

## License

MIT, Copyright (c) 2026 Mike Almogy. Free to use, modify and share. If you build on turnstone-mcp, a mention of the original project is appreciated.

## Credits

This document was written by MikeAlmogy and Claude (Anthropic).

TDQS

A3.6/5.0

Scored across 8 tools

Disambiguation4/5

Each tool targets a distinct data slice (tasks, session detail, children, outputs, cluster, models, identity), and descriptions clarify the boundaries. The risky pair is ts_sessions (list) vs ts_session (detail), and ts_children partially overlaps with ts_sessions filtered by kind, but the descriptions make the intended use clear enough.

Naming Consistency4/5

All names follow a uniform ts_ + noun pattern with no verb/noun or case mixing, which is predictable and readable. The one- or two-character difference between ts_session and ts_sessions is a real selection hazard, so it is not a perfect score.

Tool Count5/5

Eight tools is well-scoped for a read-only session observability server; each tool covers a distinct view (identity, sessions, detail, children, tasks, outputs, cluster, models) with no filler.

Completeness3/5

Read-only coverage of the observability domain is broad, but the surface dead-ends where it matters most: tools flag sessions 'waiting for a human' and expose pending tool calls with a judge verdict, yet there is no tool to approve/deny, message a session, or query logs/events. Task listing is also read-only, so any intervention path is missing.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues