Skip to main content

Quick Setup

macOS / Linux

Recommended command:
This opens browser approval and writes MCP config automatically.

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:
You should see:
  • "hasApiKey": true
  • "autoSyncEnabled": true (if you enabled auto-sync)
  • "codexAutoSyncEnabled": true (unless intentionally disabled)
  • "local.codexDir": true when Codex sessions are discoverable
Then restart Claude Code and ask:
“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:
Or configure manually with claude mcp add:

OpenCode (opencode.ai)

OpenCode reads MCP servers from ~/.config/opencode/opencode.json (or opencode.jsonc). Add CostHawk under mcp:
If you also use Claude Code or the OpenAI Codex CLI on this machine, you can enable local auto-sync by adding "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:

Claude Desktop

macOS

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

Windows

Edit %APPDATA%\Claude\claude_desktop_config.json:
Then restart Claude Desktop.

Updating

The MCP server uses costhawk@latest, which usually refreshes automatically after restart. To force refresh and verify the binary in use:
If needed, clear the npx cache:
Then restart Claude Code/Desktop.

Environment Variables


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:
This returns the full payload without making any network requests.

See What Files We Access

Run this command to see all files CostHawk would read:
The command output lists detected directories and sample files read for local parsing.

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
We never send:
  • Your code or files
  • Prompt content or conversations
  • File paths or project names
  • Any personally identifiable information