Quick Setup
macOS / Linux
Recommended command:Windows
Use the same login flow:What Login Creates
- One hybrid token with scopes:
mcp:read,mcp:write,otel:ingest - Claude MCP config written automatically
- Optional OpenCode config if selected in setup prompts
Verify Installation
After setup, verify it worked:"hasApiKey": true"autoSyncEnabled": true(if you enabled auto-sync)"codexAutoSyncEnabled": true(unless intentionally disabled)"local.codexDir": truewhen Codex sessions are discoverable
“What CostHawk tools are available?” “List my Codex sessions from the last 7 days”
Need Explicit Diagnostics?
Follow the MCP Operations Runbook for self-test interpretation, auto-sync checks, and Codex troubleshooting.
Alternative: —setup Command (All Platforms)
If you already have a token and want token mode directly:claude mcp add:
OpenCode (opencode.ai)
OpenCode reads MCP servers from~/.config/opencode/opencode.json (or opencode.jsonc). Add CostHawk under mcp:
"COSTHAWK_AUTO_SYNC": "true" (and optionally "COSTHAWK_CODEX_AUTO_SYNC": "false" to disable Codex sync).
Prefer a guided setup? Run:
Claude-Only Mode
If you want to sync Claude Code usage but not Codex CLI, add the extra env var:- macOS/Linux
- Windows (manual)
Claude Desktop
macOS
Edit~/Library/Application Support/Claude/claude_desktop_config.json:
Windows
Edit%APPDATA%\Claude\claude_desktop_config.json:
Updating
The MCP server usescosthawk@latest, which usually refreshes automatically after restart.
To force refresh and verify the binary in use:
- macOS/Linux
- Windows
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
COSTHAWK_API_KEY | Yes | - | Your CostHawk access token |
COSTHAWK_API_URL | No | https://costhawk.ai | API base URL |
COSTHAWK_AUTO_SYNC | No | false | Enable automatic sync on tool calls |
COSTHAWK_CODEX_AUTO_SYNC | No | true when auto-sync is enabled | Include Codex CLI data in syncs |
COSTHAWK_CODEX_SESSIONS_DIR | No | auto-discovery | Override Codex sessions directory if your setup is non-standard (useful when Codex install or CODEX_HOME changes paths) |
Trust & Privacy Features
CostHawk is designed with transparency in mind. Here’s how to verify what the MCP server does:Preview Mode (Dry Run)
Before syncing any data, you can preview exactly what would be sent:See What Files We Access
Run this command to see all files CostHawk would read:What Data We Send
When you sync, CostHawk sends only:- Token counts - Input/output/cache tokens per session
- Model identifiers - Which AI models were used
- Timestamps - When sessions occurred
- Hashed project IDs - For grouping (never actual project names or paths)
- Calculated costs - Based on token counts and current pricing
- Your code or files
- Prompt content or conversations
- File paths or project names
- Any personally identifiable information
