# In-Game TrapOS, AI, MCP Guide Follow this order while playing. ## 1. Install TrapOS On the ComputerCraft computer: ```sh wget run https://os.trapcloud.fr/install ``` If the computer asks to reboot, reboot it. ## 2. Start OpenCode On Host On your real machine: ```sh opencode serve --hostname 0.0.0.0 --port 4242 ``` If exposing beyond your machine, use a password: ```sh OPENCODE_SERVER_PASSWORD=secret opencode serve --hostname 0.0.0.0 --port 4242 ``` ## 3. Connect `ai.lua` On the ComputerCraft computer, use your public host: ```sh set opencc.server_url http://:4242 ``` If you set a password: ```sh set opencc.password secret ``` Optional model settings: ```sh set opencc.provider_id anthropic set opencc.model_id claude-opus-4-7 ``` Optional agent setting for the in-game ComputerCraft assistant: ```sh set opencc.agent atm10-expert ``` Test it: ```sh ai ping ai "say hello from TrapOS" ``` Expected ping: `pong`. ## 4. Start The Cloud Gateway On Host The MCP tools now ride on the `trapos-server` gateway (the same WS connection used for cloud health). From this repository on your real machine: ```sh just serve ``` This serves two listeners: ```text Gateway (in-game computers connect here): ws://:4444/gateway MCP endpoint (OpenCode connects here): http://127.0.0.1:4445 ``` The MCP endpoint stays bound to `127.0.0.1` on purpose: `exec-lua` / `write-file` are as powerful as the linked computer, so only local processes (your OpenCode) reach them. `TRAPOS_SERVER_PASSWORD` (and `OPENCODE_SERVER_PASSWORD`) must be set in `.env`: the gateway connection requires this shared secret, and the server refuses to start if either is empty (run `just install` to generate them). An empty password would expose the gateway unauthenticated, so it is never allowed. ## 5. Link The Computer To The Gateway On the ComputerCraft computer, point it at the gateway and reboot: ```sh set cloud.url ws://:4444 set cloud.password secret # must match TRAPOS_SERVER_PASSWORD on the host reboot ``` The `daemons/cloud` daemon connects automatically at boot, and `daemons/mcp-computer-server` starts serving `exec-lua` / `write-file` over that one connection. Check the link with: ```sh cloud health ``` ## 6. Connect OpenCode To MCP Add the gateway's MCP endpoint as an MCP HTTP server in your OpenCode MCP config: ```text http://127.0.0.1:4445 ``` Then ask OpenCode to use the MCP tool `probe-computers`. It lists each connected computer's `traposId` (the `":