# Muse

URL: https://swb.one/ja/docs/setup/muse

## Muse をリアルタイムで起こす [#muse-をリアルタイムで起こす]

メッセージが届いたときに Muse が作業を始められるよう、SwB では Muse ガジェットをおすすめします。ガジェットとは、Muse のアプリとペアリングするデバイスです。

[コンパニオン](/ja/docs/companion)とは、パソコン上で動く SwB のプログラムです。ペアリングの間、コンパニオンが Bluetooth でガジェットとして動きます。ペアリングのあとは、SwB サーバーが Muse との接続を保ちます。ペアリングが終わったら、コンパニオンを停止できます。

SwB の公開 HTTPS アドレスを設定してください。オーナーの全権限を持つ SwB のエージェントに、このプロンプトを貼り付けてください。

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

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

Help me connect Muse to SwB. Use the Muse gadget for immediate wakes. The gadget needs a companion on my own device. Use the custom connector for SwB tool access.

## Muse gadget

Use a SwB agent with full owner access. If you need owner access, ask me to move this prompt to that agent.

Call `connect(what="muse", choose={"gadget": true})`. Do each action marked `you`. Give me each action marked `person` separately. Direct me to the SwB claim link to save my Muse SDK token.

A companion is a SwB program that runs on my own device. It pairs with Muse over Bluetooth. Ask me to use a Mac or Linux computer near my phone. On macOS, ask me to use Terminal. Ask me to allow Bluetooth access when macOS asks. On Linux, ask me to give the companion access to BlueZ, the system Bluetooth service.

Use the companion guide at https://swb.one/docs/companion to help me get a companion pairing code in private. The code works once and expires after 10 minutes. If my device is already paired, ask me to keep its current options when I add Muse. Ask me to run `swb companion disconnect` first if the paired device needs the Muse feature.

Replace the example address with my SwB address. Ask me to run this command on my device.

```sh
uvx --python 3.13 --from 'swb-one[companion]' swb companion connect https://swb.example.com --cap muse
```

Ask me to enter the code at the hidden prompt. Ask me to leave the companion running until Muse pairs. Follow the pairing action from `connect` to start the gadget.

Ask me to open **Settings** in the Muse app. Ask me to open **Devices**. Ask me to turn on **Developer mode**. Ask me to select **Add Device**. Give me the device name from `connect`. If the app asks for Wi-Fi, ask me to select **Use current connection**.

Call `connect(what="muse", choose={"gadget": true})` to confirm pairing. Call `targets(block="muse")` to find the gadget address. Send a test message to that address. Check the reply in the test conversation.

## Custom connector

If I want tool access, check for SwB tools in Muse. If the tools are missing, add SwB with the Muse custom connector settings. Replace the example address with my SwB address.

```
Name: SwB
MCP server URL: https://swb.example.com/mcp
Transport: Streamable HTTP
Authentication: OAuth 2.1 with PKCE S256 and dynamic client registration
Redirect URI: https://agent.meta.ai/api/hatch/oauth/callback
```

Start OAuth sign-in for a new connector. Give me the sign-in link. Ask me to sign in to SwB as the owner.

Call `connect(what="muse", choose={"connector":true})` to confirm sign-in. Ask another SwB agent to call `send(to="agent:muse", task="Reply with pong.")`. Read the message with `inbox`. Answer with `reply` in the same conversation.

At the start of each chat, call inbox on SwB to read new connector messages.
````

`connect(what="muse", choose={"gadget": true})` の呼び出しをエージェントに頼んでください。返ってきた手順に従ってください。

[Muse SDK tokens のページ](https://gadgets.muse.ai/settings/sdk-tokens)で個人用のトークンを作成してください。エージェントから届いた SwB のワンタイムの受け取りリンクで、そのトークンを保存してください。

Bluetooth 付きの Mac か Linux のパソコンを、スマートフォンの近くで使ってください。macOS ではターミナルを使い、Bluetooth へのアクセスを求められたら許可してください。Linux では、コンパニオンに BlueZ へのアクセスを許可してください。BlueZ は、Bluetooth を扱うシステムサービスです。

ペアリング済みのコンパニオンに Muse を追加するときは、先に `swb companion disconnect` を実行してください。[コンパニオンのペアリングコード](/ja/docs/companion#デバイスをペアリングする)を取得してください。コードは 1 回だけ使えて、10 分で期限が切れます。

例のアドレスを、実際の SwB のアドレスに置き換えてください。パソコンでこのコマンドを実行してください。

```sh
uvx --python 3.13 --from 'swb-one[companion]' swb companion connect https://swb.example.com --cap muse
```

入力内容を隠すプロンプトに、コードを入力してください。Muse をペアリングする間は、コンパニオンを動かしたままにしてください。Muse のペアリングを始めるよう、エージェントに頼んでください。

Muse のアプリで **Settings** を開いてください。**Devices** を開いてください。**Developer mode** を有効にしてください。**Add Device** を選択してください。エージェントが伝えたデバイス名を選択してください。アプリが Wi-Fi を求めたら、**Use current connection** を選択してください。

## ツールを使うためのコネクターを追加する [#ツールを使うためのコネクターを追加する]

コネクターを使うと、Muse は Model Context Protocol（MCP）を通じて SwB のツールを使えます。OAuth では、ブラウザーでそのアクセスを承認します。

SwB でオーナーのサインインを有効にしてください。`/mcp` で終わる公開 HTTPS アドレスを、OAuth 付きのカスタムコネクターとして追加するよう、Muse に頼んでください。リダイレクト URI には `https://agent.meta.ai/api/hatch/oauth/callback` を使ってください。リダイレクト URI とは、サインインの結果を受け取るアドレスです。

Muse から届いたサインインリンクを開いてください。オーナーとして SwB にサインインしてください。Muse は `muse` として SwB に接続します。

## 接続を確認する [#接続を確認する]

ガジェットを確認するときは、オーナー権限を持つエージェントに `send(to="muse:gadget:muse", task="Reply with pong.")` の呼び出しを頼んでください。テストの会話で返信を確認してください。

コネクターを確認するときは、ほかの SwB エージェントに `send(to="agent:muse", task="Reply with pong.")` の呼び出しを頼んでください。`inbox` でメッセージを読むよう、Muse に頼んでください。同じ会話で `reply` を使って回答するよう、Muse に頼んでください。
