# GoThru MCP for Claude Code and Codex Use this helper on the computer/server where Claude Code or Codex runs. It supports Linux and macOS with Python 3.9 or later; it needs no Python packages. The MCP endpoint remains `https://mcp.gothru.co/mcp` and sign-in is handled by `https://id.gothru.org/realms/gothru`. ## Install and sign in without a browser on the server Download the helper from GoThru: ```sh mkdir -p "$HOME/.local/share/gothru-mcp" curl --fail --show-error --location https://mcp.gothru.co/agent/gothru-mcp-agent.py \ --output "$HOME/.local/share/gothru-mcp/gothru_mcp_agent.py" python3 "$HOME/.local/share/gothru-mcp/gothru_mcp_agent.py" login --method password ``` Enter your normal GoThru email/Keycloak username and password at the terminal prompt. The password is hidden and is not saved. For automated provisioning, `login --username EMAIL --password-stdin` can read one password line from a secret-manager pipe. Do not put a password in the MCP client command, configuration, or an agent conversation. For Google-only accounts or accounts with a required verification/action, use: ```sh python3 "$HOME/.local/share/gothru-mcp/gothru_mcp_agent.py" login --method device ``` The helper shows a Keycloak URL and confirmation code. Open that URL on your own laptop or phone, sign in, and approve the request. No browser, inbound callback port, SSH tunnel or copied session cookie is needed on the remote server. The authenticated identity must already have an enabled GoThru account mapping. A Panorra/Villume-only identity does not automatically gain a GoThru account. ## Connect Codex ```sh codex mcp add gothru -- python3 "$HOME/.local/share/gothru-mcp/gothru_mcp_agent.py" serve ``` Codex launches the helper over stdio. This setup uses the helper's prior Keycloak sign-in, so a separate `codex mcp login` is not needed. Use `codex mcp get gothru` to inspect the command. ## Connect Claude Code ```sh claude mcp add --transport stdio --scope user gothru -- \ python3 "$HOME/.local/share/gothru-mcp/gothru_mcp_agent.py" serve ``` Use `/mcp` or `claude mcp list` to check the connection. For Claude Desktop, use the equivalent `mcpServers.gothru` stdio entry with `command: "python3"` and arguments `["/absolute/path/gothru_mcp_agent.py", "serve"]`. ## Sessions and account changes - Short-lived access tokens are renewed automatically before use. The helper saves the latest refresh credential under `~/.config/gothru-mcp/default.json`, mode600, inside a mode700 directory. A file lock coordinates concurrent Claude/Codex processes. The login survives helper, agent and server restarts. - The native session and MCP transport use 30-day inactivity windows. Authenticated refresh/tool activity keeps them usable. A short access-token expiry is not a request to sign in again. The shared realm's existing refresh revocation policy is preserved; this helper saves the latest returned token but does not change realm-wide token rotation. - No offline tokens are requested. Password reset, account disable, explicit revocation, or 30 days of inactivity can require a fresh login. Current session status and GoThru membership/subscription are checked by the server on every request. - A lost MCP transport session is reinitialized automatically. This does not recreate a revoked identity login. - Run `python3 /absolute/path/gothru_mcp_agent.py status` to check/renew the login, or `logout` to revoke this agent login and remove its local credentials. Reconfigure/restart the agent when changing accounts. Use separate profiles for separate people: `--profile NAME login` and `--profile NAME serve`. - Existing connections using the old `auth.gothru.co` website-cookie broker need a fresh setup using these instructions. Legacy access/refresh tokens are not Keycloak tokens. Automatic anonymous client registration has not been enabled in the shared realm. The tested remote-agent route is this stdio helper; browser-based HTTP-only clients need separately configured OAuth clients. - The helper asks for read access by default. It does not grant support impersonation or permission to another customer's tours. Existing tool and subscription restrictions still apply. ## References [Official Codex MCP setup](https://learn.chatgpt.com/docs/extend/mcp), [Claude Code MCP setup](https://code.claude.com/docs/en/mcp), [Keycloak session and device authorization](https://www.keycloak.org/docs/latest/server_admin/).