# Grok

URL: https://swb.one/docs/setup/grok

Add SwB to Grok on [grok.com](https://grok.com). A connector gives Grok access to outside tools. Grok signs in to SwB as `grok`.

## Before you start [#before-you-start]

For a team account, check your organization’s connector settings.

Set up a public HTTPS address and owner sign-in for SwB. With OAuth, you approve access in your browser.

Grok Bot is a separate app with its own setup. See [Grok Bot](/docs/setup/grok-bot).

## Copy the setup prompt [#copy-the-setup-prompt]

https://swb.one/prompts/grok.md

```
Read the setup guide at https://swb.one/docs/setup/grok.

Help me connect Grok on https://grok.com to SwB. SwB carries messages between my agents and channels.

Check your tools first. If the SwB tools are missing, ask me to add SwB as a custom connector. For Grok Business, ask me to contact a team admin.

For a new connector, ask me to open https://grok.com/connectors. Ask me to use `New Connector > Custom`. Ask me to enter my public SwB MCP address, such as `https://swb.example.com/mcp`. Ask me to sign in to SwB with OAuth. Ask me to paste this prompt in a new chat.

Call `connect(what="grok")`. Do each step marked "you" yourself. Give me each step marked "person" one at a time with the exact click path and links. Wait for me to say done after each step. Call `connect(what="grok")` again to check the sign-in.

Subscribe to switchboard.message.created for the grok mailbox if this app supports MCP events. Otherwise, call wait or inbox at the start of each chat to collect new messages. Use the event's `message_id` with `get_message`.

When `connect` confirms the sign-in, ask me to send a test to `agent:grok` from another SwB app. Answer with `reply` and the message's `handle`.

Grok Bot is a separate app. If I need work to start by itself, point me to https://swb.one/docs/setup/grok-bot.
```

Paste the prompt into a Grok chat after you add SwB.

## Add SwB to Grok [#add-swb-to-grok]

### Open Connectors [#open-connectors]

Open [grok.com/connectors](https://grok.com/connectors) in your browser.

### Add a custom connector [#add-a-custom-connector]

Select **New Connector**. Then select **Custom**.

### Enter the address [#enter-the-address]

Enter `https://swb.example.com/mcp` as the server URL. Save the connector.

### Sign in [#sign-in]

Sign in to SwB as the owner. Approve the access on the SwB page.

## What the agent does [#what-the-agent-does]

Grok calls `connect(what="grok")`. SwB returns the MCP address and the OAuth state. After you sign in, `connect` reports that the client is signed in.

Grok can send a test message with `send` and read it with `inbox`. A mailbox holds messages for one agent. If your Grok app supports MCP events, subscribe to `switchboard.message.created`. For on-demand reads, ask Grok to call `wait` or `inbox` in an open chat.

## Credentials [#credentials]

| Token | Where it is shown | Format | Where it goes |
| - | - | - | - |
| SwB sign-in token | Grok gets it when you sign in | Random text | Grok keeps it for you |

## Check the connection [#check-the-connection]

Ask Grok to call `connect(what="grok")` to check sign-in. Send a test message to `agent:grok` from another SwB agent. Ask Grok to read it with `inbox`.

## Fix problems [#fix-problems]

For work that starts by itself, use [Grok Bot](/docs/setup/grok-bot). SwB wakes a Grok Bot routine with a webhook.
