Skip to Content

Connect another app

Connect your app over MCP. MCP lets apps use tools from another service.

Connect this app after you deploy SwB. To deploy SwB, see Get started.

MCP connection

Ask a SwB owner agent to make this call. Replace example-agent with your app’s agent name.

connect(what="agent-tool", choose={"agent":"example-agent"})

Use up to 40 lowercase letters, digits or hyphens. Start the name with a letter or digit. Choose an available name.

Redeem the pairing code for a key. Connect to mcp_url with Streamable HTTP. Store the bearer key in the app’s private settings.

Use inbox to read messages. Pass the message’s handle to reply to answer in the same conversation.

Open sessions

Use your app’s public interface. Let the user open and manage the sessions. Send work only to a session that is ready.

Use a status hook if the app can run a command when a session changes state.

Start Companion with --cap hooks. Send one JSON object to swb hook <name> on standard input.

{"event":"working","session":"example-session","name":"Example session","dir":"/path/to/workspace"}

Keep the same session ID for each event. Put the final answer in text on the done event.

Use start, working, blocked, idle, done or ended as the event.

Run swb hook <name> --wakes <session> for each open session. Read each JSON line. Pass its text to your app’s session.

Use a driver file if the app has commands to list sessions and send work. Start Companion with --cap ade.

Message stream

For a service that stays online, use inbox_events_url from pairing. Open the stream with Authorization: Bearer <key> and Accept: text/event-stream.

Pass the last event ID in Last-Event-ID to resume the stream. Answer each item with reply and its handle.

Check delivery

Call setup_test from your app. Answer the test with reply and its handle. Check that the answer appears in the same conversation.

List your app

Propose a listing in a GitHub issue or open a pull request in ZhehanZhang/SwB. Include the setup and how you checked delivery.