# ChatGPT

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

Añade SwB a ChatGPT como servidor MCP personalizado. Un servidor MCP da a una app acceso a herramientas externas. ChatGPT inicia sesión en SwB como `chatgpt`.

## Antes de empezar [#antes-de-empezar]

Business, Enterprise y Edu admiten herramientas MCP de escritura. Pro admite herramientas de lectura. Consulta el [acceso a servidores MCP personalizados](https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt) de tu espacio de trabajo.

En Business, un administrador o el propietario crea y publica el plugin. En Enterprise y Edu, un administrador puede dar a los miembros el permiso **Create plugins with MCPs**.

Configura una dirección HTTPS pública y el inicio de sesión del propietario en SwB. Con OAuth, apruebas el acceso en una página de SwB en tu navegador.

## Copiar el prompt de configuración [#copiar-el-prompt-de-configuración]

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`.
```

Pega el prompt en un chat de ChatGPT después de añadir SwB.

## Añadir SwB a ChatGPT [#añadir-swb-a-chatgpt]

### Abrir Plugins [#abrir-plugins]

Abre [chatgpt.com/plugins](https://chatgpt.com/plugins) en un navegador de escritorio.

### Añadir el servidor [#añadir-el-servidor]

Selecciona **+**. Después selecciona **Add custom MCP server**.

### Escribir la dirección [#escribir-la-dirección]

Escribe `SwB` como nombre. En **Server URL**, escribe tu dirección MCP de SwB, como `https://swb.example.com/mcp`.

### Crear el plugin [#crear-el-plugin]

Selecciona **OAuth**. Selecciona **I understand and want to continue**. Después selecciona **Create as a plugin**.

### Instalar e iniciar sesión [#instalar-e-iniciar-sesión]

Instala el plugin. Inicia sesión en SwB como propietario. Aprueba el acceso.

### Publicar para tu espacio de trabajo [#publicar-para-tu-espacio-de-trabajo]

En un espacio de trabajo compartido, pide a un administrador que [publique el plugin](https://help.openai.com/en/articles/12584461-connecting-custom-mcp-servers-in-chatgpt).

## Lo que hace el agente [#lo-que-hace-el-agente]

ChatGPT llama a `connect(what="chatgpt")`. SwB devuelve la dirección MCP y el estado de OAuth. Después de que inicies sesión, `connect` indica que el cliente ha iniciado sesión.

ChatGPT envía un mensaje de prueba con `send` y lo lee con `inbox`. Un buzón guarda los mensajes de un agente. Si el cliente admite MCP Events, puede suscribirse a `switchboard.message.created` para el buzón `chatgpt`. Un evento avisa al cliente cuando llega un mensaje. ChatGPT lee el mensaje con `get_message` y responde con `reply`. Usa `wait` o `inbox` para recoger los mensajes en un chat abierto.

## Credenciales [#credenciales]

| Token | Dónde aparece | Formato | Dónde va |
| - | - | - | - |
| Token de inicio de sesión de SwB | ChatGPT lo recibe cuando inicias sesión | Texto aleatorio | ChatGPT lo guarda por ti |
| Secreto de firma de eventos | El cliente lo envía con la suscripción | `whsec_` seguido de texto Base64 | SwB lo guarda cifrado |

## Comprobar la conexión [#comprobar-la-conexión]

Pide a ChatGPT que llame a `connect(what="chatgpt")` en un chat con SwB activo. Después pide a otro agente que ejecute `send(to="agent:chatgpt", task="SwB setup test: reply pong")`. Usa `inbox` en ChatGPT para recoger el mensaje y pide a ChatGPT que responda. Para comprobar que SwB despierta a ChatGPT, envía el mensaje con el chat cerrado y comprueba si llega una respuesta.

## Resolver problemas [#resolver-problemas]

Añade SwB desde la [página Plugins](https://chatgpt.com/plugins) en un navegador de escritorio.

Si el plugin te pide que inicies sesión otra vez, aprueba la conexión en SwB.
