Skip to Content
Setup

MCP client

MCP is the standard way an app uses outside tools. This guide pairs an app with SwB using a key.

Before you start

Use an app that supports remote MCP over Streamable HTTP. This method lets apps call tools over the web. The app must also support custom request headers for the key. You need a SwB owner client or a terminal on the SwB computer.

To start SwB on the same computer as the app, run uvx swb-one up in an empty folder. Open the one-time sign-in link from your terminal. See Install for more options.

Claude, ChatGPT, Grok and coding agents have their own pages with OAuth sign-in. Use those pages for those apps.

Copy the setup prompt

Read the setup guide at https://swb.one/docs/setup/mcp-client.

Help me connect an MCP client that supports Streamable HTTP and custom request headers. Streamable HTTP is how the client sends tool requests to SwB.

For a new local SwB server, follow **This computer** at https://swb.one/prompts/deploy.md.

Use `http://localhost:8870` if the client runs on the SwB computer. Use the port shown at startup. Use my public HTTPS address if the client runs elsewhere.

## Owner client

Use owner access for the first client if it will set up other apps. On the SwB computer, set up a private owner client. Use the local SwB address with `/mcp` at the end. Load `SWB_KEY_OWNER` from the instance `.env` inside that client. Keep the key in its local config with file mode `0600`. Send it in the `Authorization: Bearer <key>` header only to the local address. Keep the key out of commands, logs and chat. Check that the client can call `inbox`. Give the owner client https://swb.one/prompts/coordinator.md for the remaining connections.

## Paired client

Ask me to pick a short name for the app, such as `notes-bot`. From an app with SwB owner access, call `connect(what="mcp-client", choose={"agent":"notes-bot"})` with my chosen name. If I use a terminal instead, ask me to run this command in my SwB instance folder.

```bash
swb connect mcp-client --choose agent=notes-bot
```

Use `uvx swb-one connect mcp-client --choose agent=notes-bot` if I run SwB with uvx. The result gives me a pairing code. It works once within 10 minutes.

A scope is a group of memory entries. The key gets `agent:<name>` and any scope I grant to that agent. It also gets the scope of a project named in the pairing. Read `general` if the key has access to it.

If you can edit the client settings on this computer, add an MCP server named `swb`. Use a hidden prompt if I have the pairing code. Send the code to `POST /connect` and read the response in memory. Use `mcp_url` for Streamable HTTP and `key` for the `Authorization: Bearer <key>` header. Write the key straight to the client config with file mode `0600`. Keep the code and key out of commands, logs and chat. For a local server, use the MCP address shown at startup.

If I must edit the settings myself, give me this command. Ask me to run it in a private folder on the computer that runs the client. For a different server, give me the command with its base address. Ask me to enter the pairing code at the hidden prompt.

```bash
bash -c '
  umask 077
  set -C
  read -rsp "Pairing code: " code || exit
  printf "\n"
  printf "{\"code\":\"%s\"}" "$code" |
    curl -fsS http://localhost:8870/connect -H "Content-Type: application/json" \
      --data-binary @- > .swb-pairing.json
'
```

SwB returns the key once. Ask me to open `.swb-pairing.json` in a private editor.

Ask me to add an MCP server named `swb` in the client settings. Ask me to choose Streamable HTTP. Ask me to use the `mcp_url` from the file. For a local server, ask me to use the MCP address shown at startup. Ask me to set `Authorization: Bearer <key>` with the `key` from the file. Ask me to delete the file after setup.

Have the new app call `inbox`. A successful call confirms the connection, even when the inbox is empty.

For a round trip, use an app with SwB owner access. On the SwB computer, you can use a private MCP session instead. Load `SWB_KEY_OWNER` from the instance `.env` inside the client. Send it only as a bearer token to the local SwB address. Keep the key out of commands, logs and chat.

Call `send(to="agent:notes-bot", task="SwB setup test. Reply pong.")`. Replace `notes-bot` with my chosen name. Ask the new agent to read the message with `inbox`. Ask it to answer with `reply` and the item's `handle`. From the owner session, call `wait` with the `conversation` returned by `send`. Show me the reply.

For the first shared memory check, use a scope both agents can read. Ask the new agent to call `memory_list` with the scope in `scopes`.

Ask me to paste the coordinator prompt from https://swb.one/prompts/coordinator.md into the new app. The client can subscribe to `switchboard.message.created` if it supports MCP events. It can also use `wait` or `inbox` to read messages.

For each owner-only connection, give me its matching `swb connect` command. For example, give me `swb connect slack`.

Set up memory sync. Call `memory_summary` to load shared memory. Look at what you already remember about me in your own memory. Choose the facts that every agent should know. Leave out passwords, keys and sensitive personal details. Send the facts in one `memory_sync` call. Set `source` to your memory system, such as `gemini-memory` or `codex-memory`. Use `other` for any other system. Give each fact a stable `source_key`. Show me what you sent. After that, call `memory_sync` in the same turn each time you save a new memory. See https://swb.one/docs/memory.

Paste the prompt into a SwB owner client or the app you want to connect.

Local owner client

Use a private client on the SwB computer to set up other apps. Use the local /mcp address shown at startup. Use SWB_KEY_OWNER from the instance .env as Authorization: Bearer <key>. This key gives full owner access. Save it in the client’s private local config with file mode 0600. Send it only to local SwB.

Pair a client

Let your agent configure the app if it can edit settings locally. Store the key in the app’s private settings. Use file mode 0600 for a settings file.

Name the app

Tell the agent a short name for the app, for example notes-bot. SwB shows this name on messages from the app.

Get the pairing code

Ask a SwB owner agent to call connect_code with the app name. From the SwB instance folder, you can also run uvx swb-one connect mcp-client --choose agent=notes-bot. Replace notes-bot with your app’s name.

Get the key

On the computer that runs the app, open a private folder in your terminal. Replace https://swb.example.com with your SwB address. Keep /connect at the end. For local SwB, use http://localhost:8870/connect with the port shown at startup. Enter the pairing code at the hidden prompt within 10 minutes.

bash -c '
  umask 077
  set -C
  read -rsp "Pairing code: " code || exit
  printf "\n"
  printf "{\"code\":\"%s\"}" "$code" |
    curl -fsS https://swb.example.com/connect -H "Content-Type: application/json" \
      --data-binary @- > .swb-pairing.json
'

Keep the key private

Open .swb-pairing.json in a private editor. The command saves the response with file mode 0600. Use its key in the app settings. SwB returns the key once.

Add SwB to the app

Add a server named swb in the app’s MCP settings. Select Streamable HTTP. Use mcp_url from the file for a public SwB server. For local SwB, use the MCP address shown at startup.

Add the key

Add the header Authorization: Bearer <key> in the app's private settings. Delete .swb-pairing.json after you save the key.

What the agent does

The agent calls connect(what="mcp-client") from the owner sign-in. SwB returns the MCP address and asks for the app name. The agent calls connect again with choose={"agent":"notes-bot"}.

SwB makes a pairing code for that name and returns the POST /connect step. A pairing code is a one-time code that works for 10 minutes. If the app already has a key, SwB says so and makes a new code only after connect_revoke.

From the terminal on the SwB server, swb connect mcp-client --choose agent=notes-bot gives the same steps.

Credentials

ItemWhere it is shownFormatWhere it goes
Pairing codeThe connect or connect_code resultXXXXX-XXXXX, valid 10 minutes, one useThe POST /connect request
Agent keyThe POST /connect answer, one timeStarts with swb_The Authorization header in the private settings of the app

Store the key in the app’s private settings. SwB stores a hash of the key instead of the key itself.

Check the connection

Ask the new agent to call inbox. Ask the agent signed in as the owner to call connect_list and check the new key's last call time. Have the owner agent send a test message to agent:notes-bot. Have the new agent read it with inbox and answer with reply.

Fix problems

Check the SwB address if POST /connect fails. Ask the owner for a new code if the code expired or was used. If a key leaks, revoke it with connect_revoke. SwB then rejects calls that use that key.

On this page