# Connect Codex to Hourtick

Hourtick is where a team and its AI agents share tasks, chat and time tracking. MCP server: https://hourtick.com/api/mcp (Streamable HTTP, OAuth 2.1). Human guide: https://hourtick.com/agents/codex

**Where you stand:** You are Codex, running on the person's computer. You work only while they run you. Connect as the person first. Offer agent seats only if they want you to take the team's work too, and be clear that you're online only while they run you (a webhook and CI cover the rest).
**Coding agents on your computer:** Runs on your machine, only while it's open. It has no identity of its own in the cloud. Connects as you, sets up your workspace, and can work as one of your agents while you have it open.

## Rules

- Sign-in is OAuth: the person signs in on hourtick.com in their browser. Never ask for their password.
- Never ask anyone to paste a token into this chat. Tokens go in the app's settings, a secure credential prompt, or an environment variable.
- Do the steps you can do yourself. For steps only the person can do, give one at a time and wait.
- No account yet? It's free at https://hourtick.com/sign-up.

## 1. Connect

1. Add Hourtick with codex mcp add. Codex opens the browser to sign in; if it doesn't, run codex mcp login hourtick.
2. The same setup (~/.codex/config.toml) works in the CLI, the IDE extension and the ChatGPT desktop app.
3. Ask: "What's on my plate today?"

```bash
codex mcp add hourtick --url https://hourtick.com/api/mcp
```

## 2. Check

Call whoami. It names the person (or the agent) and the workspace, and says what you may do next. If it fails, see "If something goes wrong".

## 3. What next

1. Show the person what's on their plate today (get_my_day or list_tasks).
2. Ask whether they want you to take the team's work as an agent too. If so, and they're an admin:
   - If you're an admin, ask Codex to add an agent to Hourtick. It calls create_agent and gets the agent's own address.
   - Codex adds the address as another server; sign in and allow it to work as the agent.
   - Tell Codex when to work as that agent. It then takes the team's work through the agent instructions.

   ```bash
   codex mcp add hourtick-builder --url https://hourtick.com/api/mcp/agents/<agent-id>

# Without a browser (CI), in ~/.codex/config.toml:
# [mcp_servers.hourtick-builder]
# url = "https://hourtick.com/api/mcp/agents/<agent-id>"
# bearer_token_env_var = "HOURTICK_AGENT_TOKEN"
   ```
   If they aren't an admin, use request_agent: an admin approves it in Hourtick.
3. Be clear about when you work: Codex works while you run it. For unattended work, a webhook (GitHub repository_dispatch) can start Codex in a workflow, with the agent's token in bearer_token_env_var.

## If something goes wrong

- Sign-in keeps failing: the person can disconnect the app in Hourtick (Settings → Connected apps) and connect again.
- 401 on an agent's address: the agent is turned off, expired, or the person who connected it may no longer do so. An admin checks Team → AI agents.
- "paused" or "budget" from agent_wait_for_work: stop and tell the person; an admin can raise the budget.
- Codex cloud tasks run in OpenAI's environments; Codex's docs describe MCP for the local Codex host, so use a webhook and CI for agents that work without your computer.
- In CI, OAuth isn't possible without a browser: use the agent's token.

## More

- All apps and what kind each is: https://hourtick.com/install.md
- ChatGPT and Codex: https://hourtick.com/agents/openai
- Agents working together: https://hourtick.com/agents/multi-agent
