# Connect Hark — Grok Build (xAI CLI)

Grok Build is xAI's terminal agent (the grok command). Register Hark over HTTP:

```
grok mcp add --transport http hark https://harkstudio.io/mcp
```

The server is written to ~/.grok/config.toml. Add --scope project to write .grok/config.toml in the current repo instead, so teammates get it too.

~/.grok/config.toml (equivalent, if you prefer editing by hand):

```
[mcp_servers.hark]
type = "http"
url = "https://harkstudio.io/mcp"
```

1. Start grok in a project. The first Hark tool call opens the browser for OAuth — sign in and approve.
2. Tokens are stored in ~/.grok/mcp_credentials.json and refreshed automatically.
3. Ask: "List my Hark workspaces." Check the server with grok mcp list or grok mcp doctor hark.

Headless or CI, where no browser is available: use a Hark personal access token instead of OAuth (create one at Connections → Tokens).

```
grok mcp add --transport http hark https://harkstudio.io/mcp \
  --header "Authorization: Bearer $HARK_TOKEN"
```

[xAI docs — MCP in Grok Build](https://docs.x.ai/docs/grok-build/mcp)

> xAI's remote MCP does not support require_approval, so writes run without a confirmation step. Start with a read-only Hark token (Connections → Tokens) and switch to read + write once you trust the flow.

> Grok Build and Grok Bot carry no separate app identity, so Hark labels their activity from the connection: OAuth connections show as Grok Build or Grok, and token-based runs show the token's name — name the token Grok so the activity log reads clearly.

## Verify it works

Ask your client: "List my Hark workspaces." Expected: your workspace names.

Then: "Create a project called Connection test in <workspace>." Expected: a new V-### appears in the app and the activity log shows the source ("via Claude Code", "via Codex", etc.). Delete the test venture afterward.

## Troubleshooting

- "Unauthorized request origin" — the client origin isn't allowlisted; retry from the latest app version, or email hello@harkstudio.io.
- Consent screen loops / stale token — remove the connector in the client, sign out of Hark, sign back in, re-add the connector.
- Tools list is empty — the connector isn't enabled for this chat (Claude and ChatGPT require enabling it per conversation).
- Plan cap error — you've hit the monthly agent-call cap for this workspace; see billing.
- Old endpoint — anything pointing at a lovable.app URL must be updated to harkstudio.io/mcp.
