Open History to see the last commit
1# Outside agents
2
3Agents that T3 Code did not start can work with an environment through its MCP
4server. They can read projects and threads, start and message threads, and
5check which providers and models are available. This covers Claude Code or
6Codex in your own terminal, ChatGPT, and bots that support MCP. Each agent signs
7in once, and you choose what it may do.
8
9## Get the MCP URL
10
11In **Settings → Environments**, open a saved environment's menu and choose
12**Copy MCP URL**. The URL is the environment's address followed by `/mcp`, for
13example:
14
15```text
16https://<environment-address>/mcp
17```
18
19The copied URL uses the route this device is connected over, so an agent on the
20same device can reach it.
21
22- **An agent on your own computers** can use `localhost` on the host, T3
23 Connect, or any `https` address, such as
24 [Tailscale HTTPS](./remote-access.md#tailscale-https). Signing in sends the
25 agent's credentials to the environment, and agents only do that over `https`
26 or to `localhost`. A plain-`http` LAN or Tailscale address, like
27 `http://100.x.y.z:3773`, lets an agent find the environment but not finish
28 signing in.
29- **A hosted agent**, such as ChatGPT or a bot running in the cloud, must reach
30 the environment from the internet. Use the T3 Connect address. A Tailscale
31 address only works from your own tailnet.
32
33## Approve a sign-in
34
35The first time an agent connects, it opens a sign-in page on the environment.
36The page names the agent and where its access goes:
37
38- For an agent on your computer, approval returns to a `localhost` address on
39 the computer that opened the page.
40- For a hosted agent, approval goes to that service, such as `chatgpt.com`.
41 Anyone who runs that service gets the access.
42
43Only approve a sign-in you just started. To approve, enter a pairing code from
44**Settings → Sharing & access** or from `t3 auth pairing create` on the host. A
45browser already signed in to the environment with permission to manage access
46can approve without a code.
47
48Then choose what the agent may do:
49
50- **Read only** is the default. The agent can read projects and threads and see
51 the available providers and models. It cannot change anything.
52- **Supervised** through **Full access** also let it start, message and stop
53 threads in every project. A thread it starts or steers cannot run with more
54 permissions than the mode you chose.
55
56## Claude Code
57
58```sh
59claude mcp add --transport http t3 https://<environment-address>/mcp
60claude mcp login t3
61```
62
63`claude mcp login` opens the sign-in page in your browser. On a machine
64without a browser, add `--no-browser`, open the printed URL elsewhere, and
65paste the final URL back when asked. `claude mcp list` shows `t3` as connected
66once you approve.
67
68## Codex
69
70```sh
71codex mcp add t3 --url https://<environment-address>/mcp
72codex mcp login t3
73```
74
75`codex mcp login --no-browser` prints the sign-in URL instead of opening it.
76`codex mcp list` shows `t3` with OAuth once you approve.
77
78## ChatGPT
79
80Add the environment as a custom MCP app in ChatGPT's apps settings:
81
821. Create a new app or plugin with a custom MCP server.
832. Set the server URL to `https://<environment-address>/mcp`, using the T3
84 Connect address.
853. Choose **OAuth** for authentication. ChatGPT discovers the rest; you do not
86 need a client ID or secret.
874. Create the app, then approve the sign-in page that opens.
88
89## Other agents and bots
90
91Any agent that supports remote MCP servers over HTTP with OAuth can connect. Give
92it the MCP URL and choose OAuth, and the agent finds the sign-in settings itself.
93Agents without OAuth support cannot connect.
94
95## Scripts on the host
96
97On the machine that runs the environment, `t3 thread` uses the same tools
98without a sign-in:
99
100```sh
101id=$(t3 thread start . "Find why the tests are slow")
102t3 thread send "$id" "Now fix it" --wait
103t3 thread show "$id"
104t3 thread list
105```
106
107`.` means the project that contains the current folder; a project id also
108works. A new thread uses the project's default model and permission mode, and
109runs in the project folder unless you pass `--worktree <base-branch>`. `send`
110never interrupts: a busy thread gets the message as its next turn. Pass `-` as
111the message to read it from stdin.
112
113`--wait` prints the agent's reply. It exits 1 when the run fails or stops, and
1142 when the agent waits for an answer you give in the app. Add `--json` for a
115result that always includes the thread id.
116
117## Remove an agent
118
119Approved agents appear under **Settings → Sharing & access** like other clients.
120Revoke one there to cut off its access immediately. A sign-in lasts 30 days;
121after that the agent asks you to approve it again.