t3-remote-mcp
by tranbao0
README.md
# t3-remote-mcp
`t3-remote-mcp` connects Claude on Apple Watch, iPhone, and web to a local T3 Code server.
It serves T3 Code over Streamable HTTP and OAuth 2.1 with short spoken replies.
## Requirements
- Node.js 22 or newer
- `pnpm`
- A running local T3 Code server (`0.1.13` or newer)
- Tailscale with Funnel enabled on your tailnet
- A Claude account with custom connectors
## Quickstart
Clone the repository and build the bridge:
```bash
git clone https://github.com/tranbao0/t3-remote-mcp.git
cd t3-remote-mcp
pnpm install
pnpm build
```
### 1. Run guided setup
```bash
node dist/bin.js setup
```
Setup saves your local T3 token, Tailscale Funnel origin, and approval passphrase in `~/.config/t3-remote-mcp/config.json`.
Setup then prints your connector URL and your approval passphrase:
```text
https://<your-host>.<your-tailnet>.ts.net/mcp
```
Claude custom remote MCP connectors require HTTPS port 443; non-standard ports such as 8443 fail before OAuth.
Save the approval passphrase for step 3.
### 2. Start the bridge
```bash
node dist/bin.js start
```
The bridge listens on `http://127.0.0.1:4123` by default.
### 3. Add the connector in Claude
1. Open Claude.
2. Open **Settings -> Connectors -> Add custom connector**.
3. Paste the connector URL from step 1 (`https://<your-host>.<your-tailnet>.ts.net/mcp`).
4. Enter your approval passphrase on the approval screen.
5. Select **Approve**.
## CLI Commands
Run commands with `t3-remote-mcp` when installed globally, or with `node dist/bin.js` from this repository.
| Command | Description |
| --- | --- |
| `t3-remote-mcp setup` | Configure the local T3 token, Tailscale Funnel origin, and approval passphrase. |
| `t3-remote-mcp start` | Start the local MCP bridge server. |
| `t3-remote-mcp doctor` | Check config permissions, public origin port, local T3 reachability, Tailscale Funnel, and OAuth metadata endpoints. |
| `t3-remote-mcp revoke` | Remove every stored sign-in grant; the passphrase stays the same and Claude must sign in again. |
| `t3-remote-mcp service install` | Install and enable a `systemd --user` background service on Linux and WSL, or print `launchd` instructions on macOS. |
| `t3-remote-mcp service uninstall` | Stop and remove the `systemd --user` background service on Linux and WSL, or print `launchd` instructions on macOS. |
| `t3-remote-mcp service status` | Show the status of the background service on Linux and WSL, or print `launchd` instructions on macOS. |
## Voice Alerts on Apple Watch and iPhone
Pair the official T3 Code iPhone app (`T3 Code - Remote Claude & more`) to mirror alerts to Apple Watch while two-way voice runs in Claude.
1. Run `t3 connect` on the machine that runs T3 Code.
2. Open **T3 Code - Remote Claude & more** on your iPhone.
3. Pair the app with your T3 Code server.
4. Enable notifications for T3 Code in iPhone Settings.
5. Mirror T3 Code notifications in the Apple Watch app.
## Available Voice Tools
Every tool returns short plain text for voice playback.
| Tool | Access | Description |
| --- | --- | --- |
| `t3_brief` | Read-only | Summarize threads that need attention, active runs, recent failures, and finished work. |
| `t3_list_projects` | Read-only | List your T3 Code projects. |
| `t3_list_threads` | Read-only | List threads across all projects or filter by project, status, or title. |
| `t3_read_thread` | Read-only | Read recent updates and pending questions in a thread. |
| `t3_pull_requests` | Read-only | List pull requests linked to a thread, read pull request details, or inspect failing CI logs. |
| `t3_send_message` | Write | Send a message to a thread in auto, queue, or steer mode. |
| `t3_answer_question` | Write | Answer a pending question in a thread. |
| `t3_launch_thread` | Write | Start a new thread in a project or scratch workspace with optional branch, worktree, or model settings. |
| `t3_organize_thread` | Write | Pin, settle, snooze, archive, mark unread, or flag a thread for reply. |
| `t3_pr_action` | Write | Rerun CI checks, watch or unwatch a pull request, or post a pull request comment. |
| `t3_interrupt_thread` | Destructive | Stop an active run in a thread, or interrupt and restart the thread with a new message. |
| `t3_merge_pull_request` | Destructive | Merge a pull request; Claude asks for confirmation first. |
## Manual Setup Reference
Use these commands to configure the bridge manually or override saved settings.
### Local T3 session token
Issue a local T3 session token:
```bash
t3 auth session issue --ttl 365d --label t3-remote-mcp --token-only
```
Passing `--token-only` or `--json` keeps stdout clean when your `t3` CLI version differs from the running T3 server.
Keep the default scopes so the session includes `access:write`, `orchestration:read`, `orchestration:operate`, `settings:write`, and `source-control:write`.
`t3-remote-mcp` uses this token (`T3_ADMIN_TOKEN`) to mint and renew 30-day full-access MCP tokens automatically.
You can also pass a direct `mcp-client` bearer token through `T3_MCP_TOKEN`.
When you omit `T3_MCP_URL`, the bridge reads the local T3 URL from `~/.t3/userdata/server-runtime.json` (or `$T3CODE_HOME/userdata/server-runtime.json`).
### Configuration and environment variables
The bridge reads saved settings from `~/.config/t3-remote-mcp/config.json` (directory mode `0700`, file mode `0600`).
Environment variables override saved values from `config.json`:
| Variable | Description |
| --- | --- |
| `T3_REMOTE_PUBLIC_ORIGIN` | Public HTTPS origin on port 443 (`https://<your-host>.<your-tailnet>.ts.net`). |
| `T3_REMOTE_LISTEN_HOST` | Local bind host (default `127.0.0.1`). |
| `T3_REMOTE_LISTEN_PORT` | Local bind port (default `4123`). |
| `T3_MCP_URL` | Local T3 Code `/mcp` endpoint override. |
| `T3_ADMIN_TOKEN` | Local T3 session token that mints and renews full-access MCP tokens. |
| `T3_MCP_TOKEN` | Direct local T3 `mcp-client` bearer token. |
| `T3_REMOTE_OWNER_SECRET` | Plaintext approval passphrase override for temporary or automated runs. |
### Tailscale Funnel
Expose the local bridge port (default `4123`) on HTTPS port 443:
```bash
tailscale funnel --bg --https=443 http://127.0.0.1:4123
```
Set `T3_REMOTE_PUBLIC_ORIGIN` to `https://<your-host>.<your-tailnet>.ts.net` and use `https://<your-host>.<your-tailnet>.ts.net/mcp` as your connector URL.
Check your active Funnel routes:
```bash
tailscale funnel status
```
The bridge builds its OAuth issuer, discovery metadata, and token audience from `T3_REMOTE_PUBLIC_ORIGIN`.
Start the bridge with `node dist/bin.js start` and verify your setup with `node dist/bin.js doctor`.
## Security
- **OAuth 2.1 with PKCE**: Clients authorize with `S256` code challenges and single-use authorization codes.
- **Discovery and registration**: The bridge serves RFC 9728 protected resource metadata (`/.well-known/oauth-protected-resource` and `/.well-known/oauth-protected-resource/mcp`), RFC 8414 authorization server metadata (`/.well-known/oauth-authorization-server`), and RFC 7591 public-client dynamic registration.
- **Audience binding**: Access tokens follow RFC 8707 and bind strictly to your configured connector URL (`https://<your-host>.<your-tailnet>.ts.net/mcp`).
- **Short-lived tokens and rotation**: Access tokens expire after 1 hour by default and refresh tokens rotate on each use.
Reusing a rotated refresh token revokes the full token family.
- **Token revocation**: Clients can revoke access or refresh tokens at `POST /oauth/revoke` (RFC 7009).
- **Passphrase gate and rate limiting**: The bridge stores the approval passphrase as a salted `scrypt` hash, verifies it in constant time, protects the approval form with a CSRF token, and rate-limits repeated failed attempts.
- **Restricted local storage**: The bridge stores `config.json`, `oauth-store.json`, and `t3-credential.json` inside a `0700` directory with `0600` file permissions, saves only SHA-256 hashes of OAuth tokens, and binds cached T3 credentials to the SHA-256 fingerprint of the configured T3 admin token.
### End access
To end active connector grants while keeping the same passphrase, run `node dist/bin.js revoke`.
The running bridge rejects the old grants at once.
Claude must sign in again.
To replace the approval passphrase as well:
1. Run `node dist/bin.js setup`.
2. Choose a new approval passphrase when setup asks.
3. Restart the bridge.
4. Connect Claude again with the new passphrase.
If you replace the T3 token during setup, run `t3 auth session list --json`.
Then revoke each old session with `t3 auth session revoke <session-id>`.
## License
MIT. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues