Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

outside-agents.md

55 lines3.4 KB

1# Outside agents
2​
3Connect external agents (Claude Code or Codex in your terminal, ChatGPT, or any OAuth-capable MCP client) to your T3 Code environment over MCP to read projects/threads, launch and message threads, and monitor events.
4​
5## Quick setup
6​
7Open the command palette (`Cmd/Ctrl+K`) and run **Use T3 Code in another app (MCP)** (or open **Settings → Sharing & access**), pick your app, and follow the prompts.
8​
9- Cloud assistants (like ChatGPT or Claude) require **T3 Connect** enabled on the environment.
10- To also reach other machines through the same connection, enable **Settings → Labs → Linked environments** and [link them](./remote-access.md#link-another-environment).
11- To copy the raw MCP endpoint (`https://<environment-address>/mcp`), open an environment's menu in **Settings → Environments → Copy MCP URL**. OAuth requires `https://` or `localhost` (plain `http://` LAN/Tailscale addresses cannot complete OAuth).
12​
13### CLI clients and ChatGPT
14​
15- **Claude Code**:
16 ```sh
17 claude mcp add --transport http t3 https://<environment-address>/mcp
18 claude mcp login t3 # add --no-browser on headless hosts
19 ```
20- **Codex**:
21 ```sh
22 codex mcp add t3 --url https://<environment-address>/mcp
23 codex mcp login t3 # add --no-browser on headless hosts
24 ```
25- **ChatGPT / other OAuth MCP clients**: Add a custom remote MCP server pointing to `https://<environment-address>/mcp` with **OAuth** authentication (no client ID or secret needed).
26​
27## Approve access and permissions
28​
29The first time an outside agent connects, approve its sign-in page (via your T3 Connect account, an already-authorized browser, or a one-time pairing code from **Settings → Sharing & access** / `t3 auth pairing create`).
30​
31- **Read only**: Inspect projects, threads, providers, and models.
32- **Supervised → Full access**: Also launch, message, and stop threads up to the granted permission mode. Managing [workflow runs](./workflows.md) or using approval-skipping agent modes requires **Full access** (or your policy's maximum mode).
33- Sign-ins last **30 days**; revoke anytime in **Settings → Sharing & access**.
34​
35## Available tools and limits
36​
37Tools that act as a running T3 thread (`delegate_task`, `create_threads`, `request_secret`, `html_render`, `preview_*`, `device_*`, `t3_worktree_handoff`) only work for agents running **inside** T3 Code.
38​
39- Use `t3_thread_launch` + `t3_thread_wait` / `t3_thread_read` to run and follow work.
40- Pass `projectId` or `threadId` explicitly (or `allProjects: true` on `t3_thread_list`).
41- **MCP Events (`io.modelcontextprotocol/events`)**: Bots can poll, stream, or subscribe via HTTPS webhooks (up to 1-hour leases; latest 1,000 milestones buffered in memory) for turn, approval, guest, PR watch, and workflow events. For local webhook testing, set `T3CODE_MCP_WEBHOOK_ALLOWED_HOSTS=localhost,127.0.0.1` on the server.
42​
43## Host scripts (`t3 thread`)
44​
45On the server machine itself, drive threads directly without OAuth:
46​
47```sh
48id=$(t3 thread start . "Find why the tests are slow")
49t3 thread send "$id" "Now fix it" --wait
50t3 thread show "$id"
51t3 thread list
52```
53​
54- Pass `--worktree <base-branch>`, `--title` / `--generate-title`, `--provider <id> --model <slug>`, `--option id=value` (e.g. `reasoningEffort=high` for Codex, `effort=high` for Claude), or `-` to read the prompt from stdin.
55- `--wait` prints the reply and exits `1` on failure/stop or `2` when waiting for user input. Add `--json` for structured output including the thread ID.