
# Connect Grok Build

## Browser sign-in (OAuth)

Add the pre-registered public client to `~/.grok/config.toml`:

```toml
[mcp_servers.reconstruct]
url = "https://reconstruct.dev/mcp"
oauth = { clientId = "reconstruct-mcp", scopes = ["openid", "aud-mcp", "offline_access"], callbackPort = 4321 }
```

In Grok Build, open `/mcps`, press `r` to reload the configuration, select
`reconstruct`, and press `i` to sign in. The callback is
`http://127.0.0.1:4321/callback`. Keep port 4321 available. No client secret is
required: this public client uses Authorization Code with PKCE S256 and asks
for MCP consent. Grok also requests `offline_access` to renew tokens after sign-in;
it is an optional scope on this client. An account with platform access is required.

The nested OAuth settings use camelCase (`clientId`, `callbackPort`). With only
a server URL, a client may attempt dynamic registration, which this server does
not allow anonymously. See [MCP OAuth setup](../connect-ai-agents.md#oauth-browser-sign-in).

## Personal access token

Use this alternative when browser sign-in is unavailable. Do not add an
Authorization header to the OAuth entry above.

Copy your MCP access token from your [Reconstruct Platform account settings](https://reconstruct.dev/platform/). See [Personal access token](../connect-ai-agents.md#personal-access-token) for the connection requirements. Set `CR_RECONSTRUCT_MCP_TOKEN` in the environment that launches Grok Build.

Add this to your user `~/.grok/config.toml`. If the file already contains other MCP servers, keep their entries and add only the `reconstruct` section:

```toml
[mcp_servers.reconstruct]
url = "https://reconstruct.dev/mcp"
headers = { "Authorization" = "Bearer ${CR_RECONSTRUCT_MCP_TOKEN}" }
```

Grok Build expands `${CR_RECONSTRUCT_MCP_TOKEN}` from the environment when loading the configuration. Keep a literal token out of project files.

Start Grok Build with `grok`. If it is already running, open `/mcps` and press `r` to refresh after editing the configuration.

Check registration and connectivity:

```sh
grok mcp doctor reconstruct
```

Ask Grok Build to call `list_products` using the `reconstruct` tools to confirm access.

See the official [Grok Build MCP guide](https://docs.x.ai/build/features/mcp-servers). Next, try the [prompt examples](../prompt-examples.md).
