@vdoninja/mcp 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/SKILL.md +8 -6
- package/assets/browser-agent/audio-worklet.js +17 -0
- package/assets/browser-agent/client.js +124 -0
- package/assets/browser-agent/index.html +50 -0
- package/assets/cloudflare/worker-proxy.js +3 -0
- package/docs/.nojekyll +0 -0
- package/docs/404.html +28 -0
- package/docs/advanced-diagnostics.html +101 -0
- package/docs/assets/apple-touch-icon.png +0 -0
- package/docs/assets/favicon.svg +7 -0
- package/docs/assets/how-it-works.svg +62 -0
- package/docs/assets/icon-192.png +0 -0
- package/docs/assets/icon-512.png +0 -0
- package/docs/assets/icon-maskable-512.png +0 -0
- package/docs/assets/icons.svg +42 -0
- package/docs/assets/logo.svg +7 -0
- package/docs/assets/og-image.png +0 -0
- package/docs/assets/site.css +735 -0
- package/docs/assets/site.js +289 -0
- package/docs/browser-agent.html +122 -0
- package/docs/browser-worker.html +165 -0
- package/docs/client-config-examples.html +254 -0
- package/docs/direction.html +175 -0
- package/docs/favicon.ico +0 -0
- package/docs/guide.html +872 -0
- package/docs/http-relay.html +154 -0
- package/docs/index.html +834 -0
- package/docs/mcp-tool-contract.html +226 -0
- package/docs/quickstart-and-compat.html +222 -0
- package/docs/site.webmanifest +16 -0
- package/docs/sitemap.xml +63 -0
- package/docs/ssapp-integration.html +594 -0
- package/docs/vdo-ninja-p2p-data-notes.html +225 -0
- package/package.json +67 -11
- package/references/advanced-diagnostics.md +6 -4
- package/references/browser-agent.md +53 -0
- package/references/browser-worker.md +142 -0
- package/references/client-config-examples.md +253 -0
- package/references/direction.md +88 -0
- package/references/http-relay.md +107 -0
- package/references/mcp-tool-contract.md +16 -6
- package/references/quickstart-and-compat.md +18 -6
- package/references/ssapp-integration.md +371 -0
- package/references/vdo-ninja-p2p-data-notes.md +3 -1
- package/scripts/demo-file-workflow.js +25 -6
- package/scripts/demo-message-workflow.js +25 -6
- package/scripts/install-mcp.js +55 -4
- package/scripts/lib/bridge-session.js +143 -26
- package/scripts/lib/bridge-utils.js +3 -0
- package/scripts/lib/browser-agent.js +255 -0
- package/scripts/lib/browser-media.js +79 -0
- package/scripts/lib/browser-routes.js +119 -0
- package/scripts/lib/browser-rpc.js +214 -0
- package/scripts/lib/browser-setup.js +133 -0
- package/scripts/lib/browser-worker.js +216 -0
- package/scripts/lib/fake-network-sdk.js +3 -0
- package/scripts/lib/http-relay-transport.js +294 -0
- package/scripts/lib/load-vdo-sdk.js +3 -0
- package/scripts/lib/mcp-stdio-parser.js +3 -0
- package/scripts/lib/ssapp-worker.js +198 -0
- package/scripts/lib/tool-profiles.js +3 -0
- package/scripts/vdo-data-bridge.js +3 -0
- package/scripts/vdo-mcp-browser-agent.js +132 -0
- package/scripts/vdo-mcp-browser.js +218 -0
- package/scripts/vdo-mcp-relay.js +207 -0
- package/scripts/vdo-mcp-server.js +87 -8
- package/scripts/vdo-mcp-ssapp.js +208 -0
- package/scripts/vdo-mcp-streamable-http.js +23 -4
- package/server.json +26 -10
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# VDO.Ninja MCP Client Config Examples
|
|
2
|
+
|
|
3
|
+
[Read this guide in HTML](https://steveseguin.github.io/ninjamcp/client-config-examples.html)
|
|
4
|
+
|
|
5
|
+
Ready-to-paste config for popular MCP clients.
|
|
6
|
+
|
|
7
|
+
## Prereqs (No Clone)
|
|
8
|
+
|
|
9
|
+
Install in the project/folder where you want to use the MCP:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i @vdoninja/mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Server script path used below:
|
|
16
|
+
|
|
17
|
+
- Linux/macOS: `./node_modules/@vdoninja/mcp/scripts/vdo-mcp-server.js`
|
|
18
|
+
- Windows: `.\node_modules\@vdoninja\mcp\scripts\vdo-mcp-server.js`
|
|
19
|
+
|
|
20
|
+
Use an absolute path if your client launches from another working directory.
|
|
21
|
+
|
|
22
|
+
## Onboarding Pattern (What Works Best)
|
|
23
|
+
|
|
24
|
+
Popular MCP servers with strong onboarding docs generally do these things:
|
|
25
|
+
|
|
26
|
+
1. Give one copy/paste install path.
|
|
27
|
+
2. Provide per-client config snippets.
|
|
28
|
+
3. Tell users the first tool call to run.
|
|
29
|
+
4. Show one deterministic "it works" workflow with expected output.
|
|
30
|
+
|
|
31
|
+
This file follows that same pattern.
|
|
32
|
+
|
|
33
|
+
## Generic `stdio` MCP Template
|
|
34
|
+
|
|
35
|
+
Most MCP clients need the same three things:
|
|
36
|
+
|
|
37
|
+
1. `command` (usually `node`)
|
|
38
|
+
2. `args` (script path + optional flags)
|
|
39
|
+
3. `env` (optional)
|
|
40
|
+
|
|
41
|
+
Example:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"command": "node",
|
|
46
|
+
"args": [
|
|
47
|
+
"/ABSOLUTE/PATH/node_modules/@vdoninja/mcp/scripts/vdo-mcp-server.js",
|
|
48
|
+
"--tool-profile",
|
|
49
|
+
"core"
|
|
50
|
+
],
|
|
51
|
+
"env": {
|
|
52
|
+
"VDON_MCP_TOOL_PROFILE": "core"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Cursor
|
|
58
|
+
|
|
59
|
+
Cursor reads MCP config from:
|
|
60
|
+
|
|
61
|
+
- Global: `~/.cursor/mcp.json`
|
|
62
|
+
- Project: `.cursor/mcp.json`
|
|
63
|
+
|
|
64
|
+
Example:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"mcpServers": {
|
|
69
|
+
"vdo-ninja-mcp": {
|
|
70
|
+
"command": "node",
|
|
71
|
+
"args": [
|
|
72
|
+
"/ABSOLUTE/PATH/node_modules/@vdoninja/mcp/scripts/vdo-mcp-server.js"
|
|
73
|
+
],
|
|
74
|
+
"env": {
|
|
75
|
+
"VDON_MCP_TOOL_PROFILE": "core"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Gemini CLI
|
|
83
|
+
|
|
84
|
+
Gemini CLI supports MCP via `mcpServers` in `settings.json`.
|
|
85
|
+
|
|
86
|
+
Common config file locations:
|
|
87
|
+
|
|
88
|
+
- Project: `.gemini/settings.json`
|
|
89
|
+
- Linux/macOS: `~/.gemini/settings.json`
|
|
90
|
+
- Windows: `%USERPROFILE%\\.gemini\\settings.json`
|
|
91
|
+
|
|
92
|
+
Example:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"vdo-ninja-mcp": {
|
|
98
|
+
"command": "node",
|
|
99
|
+
"args": [
|
|
100
|
+
"/ABSOLUTE/PATH/node_modules/@vdoninja/mcp/scripts/vdo-mcp-server.js"
|
|
101
|
+
],
|
|
102
|
+
"env": {
|
|
103
|
+
"VDON_MCP_TOOL_PROFILE": "core"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
After restarting Gemini CLI, use `/mcp` to confirm server status.
|
|
111
|
+
|
|
112
|
+
## OpenCode
|
|
113
|
+
|
|
114
|
+
OpenCode MCP config lives under `mcp` in OpenCode config.
|
|
115
|
+
|
|
116
|
+
Common config file locations:
|
|
117
|
+
|
|
118
|
+
- Global: `~/.config/opencode/opencode.json`
|
|
119
|
+
- Project: `opencode.json` (project root)
|
|
120
|
+
|
|
121
|
+
Example:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"$schema": "https://opencode.ai/config.json",
|
|
126
|
+
"mcp": {
|
|
127
|
+
"vdo-ninja-mcp": {
|
|
128
|
+
"type": "local",
|
|
129
|
+
"command": [
|
|
130
|
+
"node",
|
|
131
|
+
"/ABSOLUTE/PATH/node_modules/@vdoninja/mcp/scripts/vdo-mcp-server.js",
|
|
132
|
+
"--tool-profile",
|
|
133
|
+
"core"
|
|
134
|
+
],
|
|
135
|
+
"enabled": true,
|
|
136
|
+
"environment": {
|
|
137
|
+
"VDON_MCP_TOOL_PROFILE": "core"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Codex CLI and Claude Code (CLI Automation)
|
|
145
|
+
|
|
146
|
+
Auto-register if either/both CLIs are installed:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npx vdon-mcp-install
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
If only one CLI is installed:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npx vdon-mcp-install --codex-only
|
|
156
|
+
npx vdon-mcp-install --claude-only
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Sanity Check (All Clients)
|
|
160
|
+
|
|
161
|
+
First tool call should be:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{ "name": "vdo_capabilities", "arguments": {} }
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Then connect:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{ "name": "vdo_connect", "arguments": { "room": "lab_1" } }
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
If `vdo_capabilities` works, your MCP wiring is correct.
|
|
174
|
+
|
|
175
|
+
## Context Budget Note
|
|
176
|
+
|
|
177
|
+
Adding MCP servers increases tool/context footprint. Start with one MCP and least-privilege profile (`core`) first, then add more only as needed.
|
|
178
|
+
|
|
179
|
+
## First Functional Workflows (Clear Result)
|
|
180
|
+
|
|
181
|
+
Use unique room names to avoid collisions.
|
|
182
|
+
|
|
183
|
+
### Codex to Codex (Two Terminals)
|
|
184
|
+
|
|
185
|
+
1. Install/register once:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm i @vdoninja/mcp
|
|
189
|
+
npx vdon-mcp-install --codex-only
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
2. Open two Codex sessions (`A` and `B`) with MCP enabled.
|
|
193
|
+
3. In session `A`, call:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{ "name": "vdo_connect", "arguments": { "room": "codex_lab_001", "stream_id": "codex_a" } }
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
4. In session `B`, call:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{ "name": "vdo_connect", "arguments": { "room": "codex_lab_001", "stream_id": "codex_b", "target_stream_id": "codex_a" } }
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
5. In session `A`, send:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"name": "vdo_send",
|
|
210
|
+
"arguments": {
|
|
211
|
+
"session_id": "<codex_a_session_id>",
|
|
212
|
+
"data": { "type": "chat.message", "text": "hello from codex_a" }
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
6. In session `B`, receive:
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"name": "vdo_receive",
|
|
222
|
+
"arguments": {
|
|
223
|
+
"session_id": "<codex_b_session_id>",
|
|
224
|
+
"wait_ms": 1000
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Expected result: a `data_received` event containing `"hello from codex_a"`.
|
|
230
|
+
|
|
231
|
+
### Claude to Claude (Two Terminals)
|
|
232
|
+
|
|
233
|
+
1. Install/register once:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
npm i @vdoninja/mcp
|
|
237
|
+
npx vdon-mcp-install --claude-only
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
2. Repeat the same tool flow as above with a new room name, e.g. `claude_lab_001`.
|
|
241
|
+
|
|
242
|
+
Expected result: the second Claude session receives the message in `vdo_receive` with `event.type = "data_received"`.
|
|
243
|
+
|
|
244
|
+
### Fast Scripted Proof (No Manual Tool Calls)
|
|
245
|
+
|
|
246
|
+
If you just want a quick pass/fail:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
npx vdon-mcp-demo-message
|
|
250
|
+
npx vdon-mcp-demo-file
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Expected result: each script exits successfully and reports message/file workflow completion.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Direction: live tools and perception for MCP agents
|
|
2
|
+
|
|
3
|
+
[Read this guide in HTML](https://steveseguin.github.io/ninjamcp/direction.html)
|
|
4
|
+
|
|
5
|
+
Ninja MCP should give an MCP-capable agent a focused way to reach trusted peers, use authorized remote tools, and see and hear selected live context across computers. Keep setup small, prefer direct peer connections, and preserve useful data interactions when WebRTC is unavailable.
|
|
6
|
+
|
|
7
|
+
The defining experience is an agent working with someone through their existing AI client: the person shows a camera or screen, the agent uses an authorized remote tool or consults a peer, and the result comes back with live context. The person can interrupt speech, change the request, take back control, or stop sharing immediately.
|
|
8
|
+
|
|
9
|
+
Two agents exchanging a short text message must remain easy. Media, a model-provider account, a background daemon, and a workflow engine should be optional.
|
|
10
|
+
|
|
11
|
+
## Complement ninja-p2p
|
|
12
|
+
|
|
13
|
+
| Project | Main responsibility | User's starting point |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| **Ninja MCP** | Active connections, MCP tool contracts, scoped remote operations, and live media access, including an optional shared Chrome worker. | Add an MCP server to an existing AI client and call a tool. |
|
|
16
|
+
| [ninja-p2p](https://github.com/steveseguin/ninja-p2p) | The continuing team workspace: sidecars, identities and profiles, local inbox/outbox, handoffs, receipts, wake hooks, files, and the operator dashboard. | Start a sidecar, join the team, and retain work between agent turns. |
|
|
17
|
+
| [VDO.Ninja SDK](https://sdk.vdo.ninja/) | Reusable peer connectivity, data channels, and audio/video transport. | Build an application or adapter. |
|
|
18
|
+
|
|
19
|
+
ninja-p2p owns the room's continuing conversation and work lifecycle. Ninja MCP owns how an MCP client accesses an active peer or remote capability. A shared Chrome worker belongs with Ninja MCP's remote tool adapters; assigning its work and retaining the team's handoffs belong with ninja-p2p. Voice and vision support both experiences through shared SDK media adapters. See [ninja-p2p's north star](https://github.com/steveseguin/ninja-p2p/blob/main/docs/north-star.md).
|
|
20
|
+
|
|
21
|
+
Keep both usable independently. An optional Ninja MCP adapter should expose ninja-p2p's existing directory, inbox, handoff, and receipt operations, with ninja-p2p remaining the owner of those records. It should preserve origin, request identity, permissions, and the difference between storage acknowledgement and task completion. Extend that integration for background work instead of adding a second inbox, wake scheduler, or team task store to Ninja MCP.
|
|
22
|
+
|
|
23
|
+
Current room and file envelopes differ between the packages. Sharing the SDK or a room name does not provide application interoperability; use matching packages until an explicit adapter is available. Coordinate reusable relay contracts and media adapters across the projects while keeping their storage and execution guarantees explicit.
|
|
24
|
+
|
|
25
|
+
## Available foundation
|
|
26
|
+
|
|
27
|
+
- MCP tools for messages, files, peer discovery, and shared state.
|
|
28
|
+
- Direct WebRTC and optional TURN connectivity.
|
|
29
|
+
- An explicit, self-hosted encrypted HTTP relay for machines and networks without WebRTC.
|
|
30
|
+
- Tool profiles, peer allowlists, join tokens, and per-peer protocol MACs.
|
|
31
|
+
- An optional [Chrome worker](browser-worker.md) with individual client credentials, tab leases, snapshots, screenshots, and SDK tab audio/video.
|
|
32
|
+
- Guided browser setup, connection diagnostics, and automatic WebRTC/HTTP routing with one request identity and worker result cache.
|
|
33
|
+
- An optional [browser companion](browser-agent.md) with OpenAI Realtime speech, selected browser frames, explicit control permission, and interruption.
|
|
34
|
+
- An optional [SSApp bridge](ssapp-integration.md) for the running app's MCP tools, screenshots, input and dialogs, with individual credentials and one controller at a time.
|
|
35
|
+
|
|
36
|
+
The HTTP path uses POST and long polling with bounded replay. It is a live transport, not a durable inbox. Ordinary room sessions choose matching transports explicitly; the browser adapter can use both. Browser media uses WebRTC separately. A compatible ninja-p2p relay can serve both projects, while its hosted mailboxes retain work between agent turns. Relay acceptance, agent wake, and completed work remain separate outcomes.
|
|
37
|
+
|
|
38
|
+
## What to build next
|
|
39
|
+
|
|
40
|
+
1. **Make live tool interactions dependable.** Expose peer capabilities, active connection status, bounded requests, and clear results through a small MCP surface. Distinguish queue acceptance, peer responses, progress, and completion. Bind remote operations to an authenticated caller and an explicit worker permission. Receiving a message never grants permission to execute commands.
|
|
41
|
+
2. **Extend dependable routing beyond browser tools.** Preserve request identity, authentication, and receipt meaning when moving between direct WebRTC, TURN, and the HTTP relay. Carry the browser adapter's direct, relay-only, and automatic policies into other tool adapters where execution can be reconciled. Add SSE where it helps, and make interrupted or uncertain operations visible. Build the optional ninja-p2p adapter for work that must wait in a persistent inbox. Keep large file bytes separate from latency-sensitive events.
|
|
42
|
+
3. **Expand shared perception deliberately.** Build on the browser companion's microphone, selected frames, timestamps, and interruptible speech. Add camera and screen selection before expanding providers, keeping recipients visible and recording off by default. Preserve text and selected snapshots when live media cannot connect. Reuse the media adapter in ninja-p2p's team dashboard.
|
|
43
|
+
4. **Connect to continuing collaboration.** Expose ninja-p2p handoffs and receipts through an optional MCP adapter, preserving the sidecar's state and delivery semantics. Map progress, artifacts, input requests, cancellation, and results to the owning worker or task system. An A2A adapter should share those contracts across the projects. Keep delegation limits and background wake policy with the system that runs them.
|
|
44
|
+
|
|
45
|
+
Transporting a video track does not make a model understand it. Media adapters should support native streaming models or a pipeline of speech recognition, a text/vision model, and speech synthesis. Stop queued speech on interruption; treat cancelling the underlying task as a separate action.
|
|
46
|
+
|
|
47
|
+
## Build on the VDO.Ninja SDK
|
|
48
|
+
|
|
49
|
+
The MCP bridge already uses `@vdoninja/sdk`. Reuse its media publishing and track events for voice, camera, screen, and browser streams. Its request/reply helpers provide a starting point for remote operations; application authorization, stable task IDs, and retry handling still belong to the worker. Keep large transfers on separate data channels and use queue limits so file traffic does not delay controls. See the [SDK API](https://sdk.vdo.ninja/docs/api-reference.html) and [remote-control guide](https://sdk.vdo.ninja/docs/remote-control.html).
|
|
50
|
+
|
|
51
|
+
The SDK's RPC helpers and Ninja MCP's room protocol are separate interfaces. Connect them through a versioned adapter that preserves authentication and request identity across WebRTC and HTTP. Do not assume an SDK request handler inherits the MCP bridge's peer checks.
|
|
52
|
+
|
|
53
|
+
## Optional shared Chrome worker
|
|
54
|
+
|
|
55
|
+
The [browser worker](browser-worker.md) lets people and agents use one isolated remote Chrome tab. The host runs a local Chrome DevTools MCP server and a Ninja room participant. Agents send authenticated tool requests through Ninja MCP; the worker executes them locally and returns results. The host connects outward through WebRTC or the configured HTTPS relay, keeping Chrome's debugging endpoint private. This design needs no VPN, VNC, or VLC. Connectivity still depends on the host's allowed outbound routes.
|
|
56
|
+
|
|
57
|
+
The adapter pins [Chrome DevTools MCP](https://github.com/ChromeDevTools/chrome-devtools-mcp) and Puppeteer as optional dependencies, with explicit page targeting and a separate browser runtime. An extension-based server such as [mcp-chrome](https://github.com/hangwin/mcp-chrome) remains an alternative for an operator's existing browser. [Remote Ninja](https://github.com/steveseguin/remote_ninja) provides an existing VDO.Ninja example of forwarding remote operations to a local application.
|
|
58
|
+
|
|
59
|
+
Allow multiple observers and give one agent a time-limited control lease for a tab. Hold the lease across a multi-step interaction, check its owner and generation before executing queued commands, and reject stale commands after handoff. Use explicit page IDs and require fresh page state after navigation. Operations affecting the whole browser need coordination across tabs. A human can revoke control; disconnected controllers must not retain an indefinite lock.
|
|
60
|
+
|
|
61
|
+
Optional live video and captured tab audio travel through SDK media tracks, separately from commands and file transfers. The host explicitly enables Chrome tab capture for the isolated worker. Snapshots remain available when live media cannot connect, and visual responses carry capture timestamps. The browser companion consumes selected frames and the operator's microphone, with separate controls for live viewing, model sharing, and browser control.
|
|
62
|
+
|
|
63
|
+
The first worker milestone is two agents taking turns on one isolated tab, a human watching its SDK stream, and correlated command results across reconnects. Use bounded requests, enforce permissions at the worker, and reconcile uncertain outcomes before retrying clicks or form submissions. Live audio capture and interruption belong in that milestone's media path; a video recording alone does not provide an interactive call. Shared room membership or possession of a relay key must not automatically grant browser control.
|
|
64
|
+
|
|
65
|
+
## Ideas to carry forward
|
|
66
|
+
|
|
67
|
+
| Project | Useful contribution |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| [Reason Network](https://github.com/reason-machines/reason-network) | A directory of live sessions, context-aware addressing, immediate or deferred delivery, and relay-backed connectivity. |
|
|
70
|
+
| [A2A](https://a2a-protocol.org/latest/specification/) | Capability cards, explicit task lifecycles, streaming progress, and artifacts. |
|
|
71
|
+
| [Agent Relay](https://github.com/AgentWorkforce/relay) | Direct messages, channels, threads, and an inspectable conversation. |
|
|
72
|
+
| [MCP Agent Mail](https://github.com/Dicklesworthstone/mcp_agent_mail) | Durable mail and searchable threads for ninja-p2p's continuing workspace, accessible through an optional MCP adapter. |
|
|
73
|
+
| [agents-party](https://github.com/1gr14/agents-party) | A shared room where people can follow and participate in agent collaboration. |
|
|
74
|
+
| [ntfy](https://docs.ntfy.sh/subscribe/api/) and [NATS JetStream](https://docs.nats.io/learn/jetstream/delivery-and-acknowledgment) | Replay cursors, bounded retrieval, explicit acknowledgements, and redelivery. |
|
|
75
|
+
| [Pipecat](https://github.com/pipecat-ai/pipecat), [LiveKit Agents](https://docs.livekit.io/agents/), and [FastRTC](https://github.com/gradio-app/fastrtc) | Agents as media participants, interchangeable media/model adapters, interruption handling, and short runnable examples. |
|
|
76
|
+
| [Social Stream](https://github.com/steveseguin/social_stream/blob/main/api.md) | Simple POST and SSE interaction patterns for a separately operated agent relay. |
|
|
77
|
+
|
|
78
|
+
Use these as design references. Adopt an idea when it helps participants communicate, retain context, share perception, or control the work. Keep orchestration platforms, public directories, file reservations, and search optional until their value justifies their complexity.
|
|
79
|
+
|
|
80
|
+
## Product boundaries
|
|
81
|
+
|
|
82
|
+
Ninja MCP should stay useful to one MCP client using one remote capability. ninja-p2p should stay useful to a continuing team using its CLI, library, or dashboard. The SDK and shared transport/media adapters support both. A feature belongs in Ninja MCP when it improves tool access, active-session reliability, remote control, or live perception; durable team coordination belongs in ninja-p2p.
|
|
83
|
+
|
|
84
|
+
Privacy needs explicit membership and route visibility. Future invitations should be revocable and scoped. Relay authentication and encryption are separate concerns; a TLS connection alone does not hide plaintext from a relay. Cloud model processing must be visible even when transport to the agent is encrypted.
|
|
85
|
+
|
|
86
|
+
Reliable delivery does not guarantee exactly-once execution of an external action. Preserve request IDs, use idempotency where supported, and expose an uncertain outcome after a crash instead of silently repeating consequential work.
|
|
87
|
+
|
|
88
|
+
Judge progress by successful collaborations with a clear result and less manual context copying. Track time to first exchange, missing or duplicate deliveries, reconnect delay, file integrity, and resource cost. For media, measure transport delay, model response time, and interruption response separately.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Connect without WebRTC
|
|
2
|
+
|
|
3
|
+
[Read this guide in HTML](https://steveseguin.github.io/ninjamcp/http-relay.html)
|
|
4
|
+
|
|
5
|
+
Use the HTTP relay when a machine cannot run the native WebRTC library or its network blocks WebRTC. Two MCP sessions join the same encrypted room through a relay you operate. Messages, file transfers, and shared state use the existing MCP tools.
|
|
6
|
+
|
|
7
|
+
WebRTC remains the default. Select `transport: "http"` on both participants to use the relay. Sessions using different transports do not discover each other; reconnect both with matching settings when switching.
|
|
8
|
+
|
|
9
|
+
## Run the relay
|
|
10
|
+
|
|
11
|
+
The relay needs Node.js 18 or newer and no native dependencies. From a checkout:
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
$env:VDON_RELAY_TOKEN = '<a random access token, at least 32 characters>'
|
|
15
|
+
node scripts/vdo-mcp-relay.js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
From an installed package, use `npx vdon-mcp-relay`. The default listener is `127.0.0.1:8790`. Set `VDON_RELAY_HOST` and `VDON_RELAY_PORT` to change it.
|
|
19
|
+
|
|
20
|
+
Generate the access token and a separate room key by running this command twice:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Keep the room key on the participating clients. The relay receives only the access token. Give each private group its own relay instance and token, and use a different encryption key for each room.
|
|
27
|
+
|
|
28
|
+
For other computers to connect, put the relay behind an HTTPS reverse proxy on your server. Forward `/v1/rooms/` unchanged, preserve the `Authorization` header, disable caching, allow request bodies up to 768 KiB, and allow responses to wait at least 30 seconds. Keep the Node listener private to the proxy. Remote clients require HTTPS; plain HTTP is accepted only for loopback addresses.
|
|
29
|
+
|
|
30
|
+
## Configure each MCP client
|
|
31
|
+
|
|
32
|
+
Install without the optional native WebRTC library if needed:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @vdoninja/mcp --omit=optional
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Set these variables in the environment of each MCP server process. In a client that supports a JSON server configuration:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"command": "node",
|
|
43
|
+
"args": ["/absolute/path/node_modules/@vdoninja/mcp/scripts/vdo-mcp-server.js"],
|
|
44
|
+
"env": {
|
|
45
|
+
"VDON_MCP_RELAY_URL": "https://relay.example.com",
|
|
46
|
+
"VDON_MCP_RELAY_TOKEN": "<relay access token>",
|
|
47
|
+
"VDON_MCP_RELAY_KEY": "<64 hex characters from the second command>"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For two clients on the relay computer, use `http://127.0.0.1:8790`. Both clients need the same relay URL, access token, room key, and room name. Each needs a different `stream_id`.
|
|
53
|
+
|
|
54
|
+
Keep secrets in the server environment where possible. `vdo_connect` also accepts `relay_url`, `relay_token`, and `relay_key` for clients that need separate settings per session. These secrets are omitted from status and connection results.
|
|
55
|
+
|
|
56
|
+
## Join and send
|
|
57
|
+
|
|
58
|
+
Connect the first agent:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{ "name": "vdo_connect", "arguments": { "transport": "http", "room": "project_room", "stream_id": "planner" } }
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Connect the second agent:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{ "name": "vdo_connect", "arguments": { "transport": "http", "room": "project_room", "stream_id": "reviewer" } }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use `vdo_sync_peers` to wait for discovery, then address a peer by its stream ID:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{ "name": "vdo_send", "arguments": { "session_id": "<planner-session>", "target": "reviewer", "data": { "text": "Please review the plan." } } }
|
|
74
|
+
{ "name": "vdo_receive", "arguments": { "session_id": "<reviewer-session>", "wait_ms": 1000 } }
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
File tools use the same target and retain chunk hashes, acknowledgements, retries, and completion checks. For shared state with `require_session_mac: true`, use the peer UUID from `vdo_sync_peers` as the state operation's `target`; the MAC belongs to that peer connection.
|
|
78
|
+
|
|
79
|
+
## Delivery and recovery
|
|
80
|
+
|
|
81
|
+
The relay accepts encrypted events through POST. Clients receive them through long polling with a cursor. Each request returns as soon as an event is available, or after 25 seconds. This path does not need SSE or WebSockets.
|
|
82
|
+
|
|
83
|
+
| Result or event | Meaning and action |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `vdo_send`: `delivery_stage: "queued"` | The local transport accepted the message. Save its `message_id` if you need to track it. |
|
|
86
|
+
| `relay_receipt`: `stage: "relay_accepted"` | The relay accepted the event. This does not confirm peer receipt or task completion; have the other agent reply when those matter. |
|
|
87
|
+
| `relay_receipt`: `stage: "delivery_unknown"` | POST retries failed. The relay may have accepted a request whose response was lost. Check with the peer before repeating a consequential task. |
|
|
88
|
+
| `data_received` | The receiving bridge accepted a message. Its `message_id` matches the sender's ID. The AI client still needs to poll and act on it. |
|
|
89
|
+
| `relay_connection` | The reader lost or regained connectivity. Use `vdo_status` to inspect the current connection. |
|
|
90
|
+
| `relay_history_lost` | The cursor is no longer available. Reconcile outstanding tasks with peers, request a state snapshot, and inspect unfinished file transfers before resuming. |
|
|
91
|
+
| `relay_message_rejected` | An event failed decryption or validation. Check matching room keys and synchronized clocks. |
|
|
92
|
+
|
|
93
|
+
Retries within the retained history reuse the same encrypted event ID. Distinct messages with identical text keep distinct IDs. Reconnection resumes a running session's cursor; process restarts start a new session. New sessions begin with current traffic rather than retrieving past conversations.
|
|
94
|
+
|
|
95
|
+
The relay keeps at most 512 events or 8 MiB per room for up to five minutes, across at most 16 rooms. It has no disk archive. A restart clears its history. Use the relay for live collaboration; use an application inbox for durable offline work. A busy room or large transfer can exhaust replay before five minutes.
|
|
96
|
+
|
|
97
|
+
Queues and request sizes are bounded. `vdo_send` can return `ok: false` when the transport has no known peer, is disconnected, or its queue is full. Wait for discovery or recovery before retrying. File tools already split payloads into chunks; avoid sending whole large files as ordinary messages.
|
|
98
|
+
|
|
99
|
+
## Trust and privacy
|
|
100
|
+
|
|
101
|
+
Room payloads use AES-256-GCM with a fresh random nonce and a key derived from the shared room key. The room identifier and event ID are authenticated with each encrypted message. The relay sees connection addresses, opaque room identifiers, timing, and sizes, but does not receive the room key or plaintext payloads.
|
|
102
|
+
|
|
103
|
+
Every holder of a room key can decrypt that room's traffic, including messages addressed to another participant, and can claim a participant identity. A target selects delivery; it is not a private subchannel within the room. Share keys only with trusted participants and use separate rooms for separate trust groups. Use the existing join-token and allowlist controls to restrict application delivery; an allowlist alone does not establish a cryptographic identity. Rotate shared keys and reconnect participants when access changes.
|
|
104
|
+
|
|
105
|
+
This group-key mode has no forward secrecy: a disclosed key can decrypt previously captured room traffic. Use WebRTC when its connection-level privacy is required. Keep clocks synchronized; expired or far-future events are rejected.
|
|
106
|
+
|
|
107
|
+
The HTTP relay carries data. The optional [browser adapter](browser-worker.md) supports automatic WebRTC/HTTP routing for its commands and images; live browser audio/video still uses WebRTC. Ordinary room sessions choose their transport explicitly. The `vdon-mcp-http` command exposes MCP itself over HTTP; `vdon-mcp-relay` carries encrypted events between peers. They are different services.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# VDO.Ninja MCP Tool Contract
|
|
2
2
|
|
|
3
|
+
[Read this guide in HTML](https://steveseguin.github.io/ninjamcp/mcp-tool-contract.html)
|
|
4
|
+
|
|
3
5
|
Implemented by:
|
|
4
6
|
|
|
5
|
-
- `
|
|
6
|
-
- Installer automation: `
|
|
7
|
-
- Discovery manifest: `
|
|
7
|
+
- `scripts/vdo-mcp-server.js`
|
|
8
|
+
- Installer automation: `scripts/install-mcp.js`
|
|
9
|
+
- Discovery manifest: `server.json`
|
|
8
10
|
|
|
9
11
|
## Transport
|
|
10
12
|
|
|
@@ -23,7 +25,7 @@ Implemented by:
|
|
|
23
25
|
|
|
24
26
|
## Server CLI Flags
|
|
25
27
|
|
|
26
|
-
Supported by `
|
|
28
|
+
Supported by `scripts/vdo-mcp-server.js`:
|
|
27
29
|
|
|
28
30
|
- `--tool-profile <core|file|state|full>`
|
|
29
31
|
- `--max-message-bytes <bytes>`
|
|
@@ -56,13 +58,19 @@ Enforcement:
|
|
|
56
58
|
|
|
57
59
|
### `vdo_connect` notable options
|
|
58
60
|
|
|
59
|
-
- transport: `room`, `stream_id`, `target_stream_id`, `
|
|
61
|
+
- transport: `room`, `stream_id`, `target_stream_id`, `transport` (`webrtc` by default or `http`)
|
|
62
|
+
- WebRTC: `host`, `password`, `force_turn`
|
|
63
|
+
- HTTP relay: `relay_url`, `relay_token`, `relay_key`, with defaults from `VDON_MCP_RELAY_URL`, `VDON_MCP_RELAY_TOKEN`, `VDON_MCP_RELAY_KEY`; see [relay setup and delivery semantics](http-relay.md)
|
|
60
64
|
- resiliency: `heartbeat_ms`, `reconnect_ms`, `max_reconnect_ms`
|
|
61
65
|
- security: `join_token`, `join_token_secret`, `join_token_ttl_ms`, `enforce_join_token`, `allow_peer_stream_ids`, `require_session_mac`
|
|
62
66
|
- file defaults: `file_chunk_bytes`, `file_max_bytes`, `file_ack_timeout_ms`, `file_max_retries`
|
|
63
67
|
- file spooling: `file_spool_dir`, `file_spool_threshold_bytes`, `keep_spool_files`
|
|
64
68
|
- state limits: `state_max_keys`, `state_max_snapshot_entries`
|
|
65
69
|
|
|
70
|
+
`vdo_status` identifies the selected `transport`. HTTP is an explicit peer transport, independent of the HTTP endpoint used to expose MCP. Both participants must use the same transport. WebRTC-only options are rejected in HTTP mode; encryption cannot be disabled on the HTTP relay.
|
|
71
|
+
|
|
72
|
+
In HTTP mode, `vdo_send` returns `message_id` and `delivery_stage` (`queued` or `rejected`). A later `relay_receipt` event reports `relay_accepted` or `delivery_unknown`. Acceptance does not confirm peer consumption. `data_received` includes the matching `message_id`. `relay_history_lost` means a replay gap requires application reconciliation. Ordinary message queues and relay history are in memory; file completion still requires the existing peer acknowledgement.
|
|
73
|
+
|
|
66
74
|
## Sync Tools
|
|
67
75
|
|
|
68
76
|
- `vdo_sync_peers`: peer handshake/auth/state capabilities
|
|
@@ -77,6 +85,8 @@ Enforcement:
|
|
|
77
85
|
- `vdo_file_receive`: read completed incoming payload (`base64`/`utf8`/`json`)
|
|
78
86
|
- `vdo_file_save`: save completed incoming transfer directly to disk
|
|
79
87
|
|
|
88
|
+
A retained incoming `transfer_id` is bound to its originating peer UUID and offer metadata (content hash, byte count, chunk layout, name, and MIME type). Identical retries from that peer can resume or confirm completion. Reusing the ID for different content/metadata or from another peer is rejected; use a new ID for a new transfer. Reconnection with a new peer UUID does not transfer ownership of an existing retained ID. Completion acknowledgements must match the sender's content hash and byte count.
|
|
89
|
+
|
|
80
90
|
## State Sync Tools (CRDT-lite)
|
|
81
91
|
|
|
82
92
|
- `vdo_state_set`: update key/value with local monotonic clock
|
|
@@ -140,7 +150,7 @@ Tools return `isError: true` with:
|
|
|
140
150
|
Automated registration:
|
|
141
151
|
|
|
142
152
|
```bash
|
|
143
|
-
npm i @vdoninja/mcp
|
|
153
|
+
npm i @vdoninja/mcp
|
|
144
154
|
npx vdon-mcp-install
|
|
145
155
|
```
|
|
146
156
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# VDO.Ninja MCP Quickstart
|
|
2
2
|
|
|
3
|
+
[Read this guide in HTML](https://steveseguin.github.io/ninjamcp/quickstart-and-compat.html)
|
|
4
|
+
|
|
3
5
|
This is the fast path for users and AI agents.
|
|
4
6
|
|
|
5
7
|
## Transport Truth
|
|
@@ -13,7 +15,7 @@ This is the fast path for users and AI agents.
|
|
|
13
15
|
Install locally (no clone), including a Node WebRTC implementation:
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
npm i @vdoninja/mcp
|
|
18
|
+
npm i @vdoninja/mcp
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
Register MCP for Codex/Claude:
|
|
@@ -28,6 +30,9 @@ Start the local MCP server:
|
|
|
28
30
|
npx vdon-mcp-server
|
|
29
31
|
```
|
|
30
32
|
|
|
33
|
+
If started directly in a terminal, it prints a short `Server running (stdio)` banner and a first-call hint.
|
|
34
|
+
If started by an MCP client, no interactive banner may appear, which is normal.
|
|
35
|
+
|
|
31
36
|
Optional least-privilege profile:
|
|
32
37
|
|
|
33
38
|
```bash
|
|
@@ -38,7 +43,7 @@ Repo-local equivalents still work when developing in this repo:
|
|
|
38
43
|
|
|
39
44
|
```bash
|
|
40
45
|
npm run mcp:install
|
|
41
|
-
node
|
|
46
|
+
node scripts/vdo-mcp-server.js
|
|
42
47
|
```
|
|
43
48
|
|
|
44
49
|
AI-first sanity check (recommended first call):
|
|
@@ -186,13 +191,20 @@ npm run test:mcp:all
|
|
|
186
191
|
|
|
187
192
|
## Compatibility Notes
|
|
188
193
|
|
|
189
|
-
- Codex
|
|
190
|
-
-
|
|
191
|
-
-
|
|
194
|
+
- Works with any MCP client that supports local `stdio` transport (Codex CLI, Claude Code, Cursor, and other MCP-compatible CLIs).
|
|
195
|
+
- Codex and Claude can be auto-registered via `npx vdon-mcp-install`.
|
|
196
|
+
- Cursor and other GUI tools typically need manual MCP JSON config using:
|
|
197
|
+
- `command`: your Node executable
|
|
198
|
+
- `args`: path to `.../node_modules/@vdoninja/mcp/scripts/vdo-mcp-server.js` plus optional flags
|
|
199
|
+
- Ready-to-paste per-client examples are in `references/client-config-examples.md`.
|
|
200
|
+
- Registry metadata is in `server.json`.
|
|
201
|
+
- Tool contracts are in `references/mcp-tool-contract.md`.
|
|
192
202
|
- `@vdoninja/mcp` depends on `@vdoninja/sdk`, so SDK is installed transitively.
|
|
203
|
+
- `@vdoninja/mcp` is MIT licensed. Its SDK dependency is separately licensed
|
|
204
|
+
under MPL-2.0, with some separately marked wrappers and adapters under MIT.
|
|
193
205
|
|
|
194
206
|
## Optional Advanced Diagnostics
|
|
195
207
|
|
|
196
208
|
For soak/matrix/preset-matrix/sweep tuning and all reliability knobs, use:
|
|
197
209
|
|
|
198
|
-
- `
|
|
210
|
+
- `references/advanced-diagnostics.md`
|