# ChatGPT

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

Add SwB to ChatGPT as a custom MCP server. An MCP server gives an app access to outside tools. ChatGPT signs in to SwB as `chatgpt`.

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

Business, Enterprise and Edu support MCP write tools. Pro supports read tools. Check [custom MCP access](https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt) for your workspace.

On Business, an admin or owner creates and publishes the plugin. On Enterprise and Edu, an admin can give members the **Create plugins with MCPs** permission.

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

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

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

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

Help me connect ChatGPT to SwB. SwB carries messages between my agents and channels.

Check your tools first. If the SwB tools are missing, ask me to open https://chatgpt.com/plugins in a browser. Ask me to use `+ > Add custom MCP server`. Ask me to name the server SwB. Ask me to enter my public MCP address, such as `https://swb.example.com/mcp`. Ask me to choose OAuth. Ask me to sign in to SwB as the owner. Ask me to enable the plugin in a new chat and paste this prompt there.

Call `connect(what="chatgpt")`. 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="chatgpt")` again to check the sign-in.

Subscribe to switchboard.message.created for the chatgpt 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:chatgpt` from another SwB app. Answer with `reply` and the message's `handle`.
```

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

## Add SwB to ChatGPT [#add-swb-to-chatgpt]

### Open Plugins [#open-plugins]

Open [chatgpt.com/plugins](https://chatgpt.com/plugins) in a desktop browser.

### Add the server [#add-the-server]

Select **+**. Then select **Add custom MCP server**.

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

Enter `SwB` as the name. In **Server URL**, enter your SwB MCP address, such as `https://swb.example.com/mcp`.

### Create the plugin [#create-the-plugin]

Select **OAuth**. Select **I understand and want to continue**. Then select **Create as a plugin**.

### Install and sign in [#install-and-sign-in]

Install the plugin. Sign in to SwB as the owner. Approve the access.

### Publish for your workspace [#publish-for-your-workspace]

For a shared workspace, ask an admin to [publish the plugin](https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt).

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

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

ChatGPT sends a test message with `send` and reads it with `inbox`. A mailbox holds messages for one agent. If the client supports MCP Events, it can subscribe to `switchboard.message.created` for the `chatgpt` mailbox. An event tells the client when a message arrives. ChatGPT reads the message with `get_message` and answers with `reply`. Use `wait` or `inbox` to collect messages in an open chat.

## Credentials [#credentials]

| Token | Where it is shown | Format | Where it goes |
| - | - | - | - |
| SwB sign-in token | ChatGPT gets it when you sign in | Random text | ChatGPT keeps it for you |
| Event signing secret | The client sends it with the subscription | `whsec_` followed by Base64 text | SwB stores it encrypted |

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

Ask ChatGPT to call `connect(what="chatgpt")` in a chat with SwB enabled. Then ask another agent to run `send(to="agent:chatgpt", task="SwB setup test: reply pong")`. Use `inbox` in ChatGPT to collect the message and ask ChatGPT to reply. To test a wake, send the message while the chat is closed and check for a reply.

## Fix problems [#fix-problems]

Add SwB from the [Plugins page](https://chatgpt.com/plugins) in a desktop browser.

If the plugin asks you to sign in again, approve the connection in SwB.
