muse-bridge-mcp
by edigeh
README.md
# muse-bridge
[](https://github.com/edigeh/muse-bridge/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/muse-bridge)
[](LICENSE)
Talk to your [Muse AI](https://muse.ai) VM from the terminal, from an AI agent, or from your own Node code.
muse-bridge speaks the VM's native protocol (a Noise XX handshake carrying Protobuf RPC over WebSocket) and gives you:
- **A CLI** (`muse-bridge`) for sessions, chat, file transfer with SHA-256 checks, and a product-video job runner.
- **An MCP server** (`muse-bridge-mcp`) that exposes the same operations as tools to Claude Code, Claude Desktop, Cursor and other MCP clients.
- **A Node library** with the Noise, Protobuf, RPC and job-pipeline pieces as separate modules.
- **A VM skill** (`product-video`) that turns a product photo into a verified 720x1280 video on the VM.
It has no runtime dependencies and needs Node.js 22 or newer.
## Install
```sh
npm install -g muse-bridge
```
Or run it without installing: `npx muse-bridge help`.
## Credentials
muse-bridge needs your VM id and a gateway token from your muse.ai account. It looks for them in this order:
1. **Environment variables:** `MUSE_VM_ID` and `MUSE_AUTH_TOKEN`, plus `MUSE_NOTARY_TOKEN` if your account issues one.
2. **A credentials command:** `MUSE_CREDENTIALS_COMMAND`, a shell command that prints one JSON object. It runs again on every reconnect, so it can refresh expired tokens.
3. **Library callers only:** credentials or a `mintFn` passed to `resolveCredentials`.
### Getting a token from your browser
Print a snippet for your browser's DevTools console:
```sh
muse-bridge credentials-script
```
Open https://muse.ai while signed in, open DevTools (Console tab), paste the snippet and press Enter. It prints `export MUSE_VM_ID=…` and `export MUSE_AUTH_TOKEN=…` lines. Paste them into your shell. The snippet runs only in your browser and sends requests only to muse.ai.
Tokens expire. When a command fails with an auth error, run the snippet again.
### Automating it with a credentials command
`MUSE_CREDENTIALS_COMMAND` can be anything that prints JSON in this shape:
```json
{ "vmId": "…", "token": "…", "notaryToken": "…" }
```
snake_case keys (`vm_id`, `auth_token`, `notary_token`) work too. Some examples:
```sh
# A file you keep outside the repo
export MUSE_CREDENTIALS_COMMAND='cat ~/.config/muse-bridge/credentials.json'
# A password manager
export MUSE_CREDENTIALS_COMMAND='op read op://Private/muse-bridge/credentials'
# Your own browser automation
export MUSE_CREDENTIALS_COMMAND='node ~/bin/muse-credentials.mjs'
```
For browser automation, `browserCredentialExpression()` returns the same script as a JavaScript expression you can pass to Playwright's or Puppeteer's `page.evaluate` on a signed-in muse.ai page:
```js
import { chromium } from 'playwright';
import { browserCredentialExpression } from 'muse-bridge';
const context = await chromium.launchPersistentContext('/path/to/profile', { headless: true });
const page = await context.newPage();
await page.goto('https://muse.ai/');
const creds = await page.evaluate(browserCredentialExpression());
process.stdout.write(JSON.stringify(creds));
await context.close();
```
muse-bridge never prints tokens. Errors, logs, CLI output and MCP results all go through a redactor first, and credential objects keep tokens in non-enumerable properties.
## CLI
Check the connection first:
```sh
muse-bridge doctor
```
`doctor` resolves credentials, completes the handshake, lists sessions, and writes, reads back and deletes a probe file.
```text
muse-bridge <command> [options]
doctor Credentials, handshake, sessions.list and fs probe roundtrip
credentials-script Print a browser console snippet that reads Muse credentials
install-skill Upload and SHA-256 verify the product-video skill
sessions list|start|archive|delete
fs list|stat|upload|download|delete
chat send --session <id> (--text <prompt> | --file <path>)
chat history <sessionId>
job run --image <png> --product <name> [--title <t>] [--duration <sec>] [--dry-run]
help
--json Machine-readable output
```
Run `muse-bridge help` for every option.
### Product-video job
```sh
muse-bridge install-skill
muse-bridge job run --image ./bottle.png --product "Amber Oil" --title "Amber Oil" --out-dir ./out
```
The job uploads the image, has Muse generate a still and a clip, assembles a 720x1280 H.264 video on the VM with ffmpeg, and downloads it with SHA-256 checks. Use `--dry-run` to see the steps without running them.
## MCP server
Add it to your MCP client. For Claude Code:
```sh
claude mcp add muse-bridge -e MUSE_CREDENTIALS_COMMAND='cat ~/.config/muse-bridge/credentials.json' -- npx -y muse-bridge-mcp
```
For clients configured with JSON (Claude Desktop, Cursor and others):
```json
{
"mcpServers": {
"muse-bridge": {
"command": "npx",
"args": ["-y", "muse-bridge-mcp"],
"env": { "MUSE_CREDENTIALS_COMMAND": "cat ~/.config/muse-bridge/credentials.json" }
}
}
}
```
Tools:
| Tool | What it does |
| --- | --- |
| `muse_doctor` | Check credentials, handshake, sessions and a file round trip |
| `muse_sessions_list` | List chat sessions |
| `muse_session_start` | Start an isolated side-chat session |
| `muse_fs_list`, `muse_fs_stat` | Browse the VM filesystem |
| `muse_fs_upload`, `muse_fs_download` | Transfer files with SHA-256 verification |
| `muse_chat_send` | Send a prompt and wait for the matching reply |
| `muse_chat_history` | Read a session's history |
| `muse_install_skill` | Install the product-video skill on the VM |
| `muse_job_run` | Run the product-video job end to end |
## Library
```js
import { ConnectionManager, runDoctor } from 'muse-bridge';
const connectionManager = new ConnectionManager();
try {
console.log(await runDoctor({ connectionManager }));
} finally {
connectionManager.close();
}
```
Each layer is also exported on its own: `muse-bridge/noise`, `/protobuf`, `/auth`, `/rpc`, `/reply-matcher`, `/pipeline`, `/operations`, `/cli` and `/mcp`. [ARCHITECTURE.md](ARCHITECTURE.md) documents every module and its signatures.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md). To report a security problem, see [SECURITY.md](SECURITY.md).
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues