mindmeld-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/README.md +8 -1
- package/dist/cli.js +19 -1
- package/dist/config.js +8 -1
- package/dist/mcp.js +50 -2
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ The answer comes from a **read-only copy of the Claude session your teammate has
|
|
|
16
16
|
claude plugin install mindmeld --marketplace dhrupad-sah/mindmeld
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Restart Claude Code afterwards. The plugin
|
|
19
|
+
Restart Claude Code afterwards. The server is bundled into the plugin, so there's nothing else to download. The only requirement is Node 20+.
|
|
20
20
|
|
|
21
21
|
<details><summary>Without the plugin</summary>
|
|
22
22
|
|
|
@@ -35,6 +35,7 @@ Joining exposes nothing. **Every session is private until you share it:**
|
|
|
35
35
|
|
|
36
36
|
- **Them, in the session that has the answers:** `/mindmeld:share scraper work`. The group can now see "scraper work" and ask it questions. They see your name, that label and when the session was last active. Never your prompts, files or transcript.
|
|
37
37
|
- `/mindmeld:stop` makes it private again. Closing the session does too.
|
|
38
|
+
- `/mindmeld:leave` leaves the group entirely. Every session on this machine disconnects and the pairing is deleted, after a confirmation. To reconnect you'll need a new invite.
|
|
38
39
|
- `/mindmeld:peers` lists the sessions people are sharing. `/mindmeld:status` shows whether you're connected, whether this session is shared, who's "always allowed", and every recent question in and out.
|
|
39
40
|
|
|
40
41
|
## Use
|
|
@@ -63,11 +64,16 @@ If Sarim shares several sessions, the question goes to the one used most recentl
|
|
|
63
64
|
| `invite_peer` / `join_peer` | pair with a teammate |
|
|
64
65
|
| `share_session` / `stop_sharing` | make this session visible and askable, or private again |
|
|
65
66
|
| `status` | connection, sharing state, trusted people, recent questions |
|
|
67
|
+
| `leave_group` | leave the group and disconnect every session on this machine |
|
|
66
68
|
| `trust_peer` | always allow, or stop allowing, someone's questions |
|
|
67
69
|
| `list_peers` | sessions teammates are sharing |
|
|
68
70
|
| `ask_peer` | ask a question; blocks until the answer arrives |
|
|
69
71
|
| `share_snippet` / `read_inbox` | send or receive code and notes, no reply needed |
|
|
70
72
|
|
|
73
|
+
### Removing someone from a group
|
|
74
|
+
|
|
75
|
+
Everyone in a group shares one key, so you can't remove one person on their own. Instead, the rest of you run `/mindmeld:leave` and pair again with a fresh `/mindmeld:invite`. That creates a new key the removed person doesn't have.
|
|
76
|
+
|
|
71
77
|
## Terminal commands (optional)
|
|
72
78
|
|
|
73
79
|
Everything above works from inside Claude. The CLI is there for scripts and servers:
|
|
@@ -75,6 +81,7 @@ Everything above works from inside Claude. The CLI is there for scripts and serv
|
|
|
75
81
|
```sh
|
|
76
82
|
mindmeld pair / join <code> # pair from a terminal instead
|
|
77
83
|
mindmeld up --auto-approve # an always-on answerer for a project (no dialogs; trusted groups only)
|
|
84
|
+
mindmeld leave # leave your group (asks to confirm; -y to skip)
|
|
78
85
|
mindmeld sessions # list Claude sessions in this directory
|
|
79
86
|
mindmeld relay # self-host a relay
|
|
80
87
|
```
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
import { answerWithFork } from "./answerer.js";
|
|
6
6
|
import { generateGroupSecret, generateInviteCode } from "./crypto.js";
|
|
7
|
-
import { DEFAULT_RELAY, defaultName, loadConfig, saveConfig } from "./config.js";
|
|
7
|
+
import { DEFAULT_RELAY, defaultName, deleteConfig, loadConfig, saveConfig } from "./config.js";
|
|
8
8
|
import { Daemon } from "./daemon.js";
|
|
9
9
|
import { runMcpServer } from "./mcp.js";
|
|
10
10
|
import { runInviter, runJoiner } from "./pairing.js";
|
|
@@ -17,6 +17,7 @@ const USAGE = `mindmeld — let teammates' Claude Code sessions ask each other q
|
|
|
17
17
|
mindmeld join <code> [--name bob] join with a friend's invite code
|
|
18
18
|
mindmeld up [--session <id|latest>] [--auto-approve]
|
|
19
19
|
run the daemon (in your project dir)
|
|
20
|
+
mindmeld leave [-y] leave your group (disconnects every session here)
|
|
20
21
|
mindmeld sessions list Claude sessions in this directory
|
|
21
22
|
mindmeld mcp MCP server (used by Claude Code)
|
|
22
23
|
mindmeld relay [--port 8787] self-host a relay (optional; a hosted one is the default)
|
|
@@ -38,6 +39,7 @@ async function main() {
|
|
|
38
39
|
"auto-approve": { type: "boolean" },
|
|
39
40
|
"new-group": { type: "boolean" },
|
|
40
41
|
session: { type: "string" },
|
|
42
|
+
yes: { type: "boolean", short: "y" },
|
|
41
43
|
},
|
|
42
44
|
});
|
|
43
45
|
switch (cmd) {
|
|
@@ -78,6 +80,22 @@ async function main() {
|
|
|
78
80
|
console.log(`Next: in Claude Code, run ${bold("/mindmeld:share")} in a session to let them ask it (sessions are private by default).`);
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
83
|
+
case "leave": {
|
|
84
|
+
if (!loadConfigOrNull()) {
|
|
85
|
+
console.log("You're not in a mindmeld group.");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!values.yes) {
|
|
89
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
90
|
+
const a = (await rl.question("Leave your mindmeld group? Every session on this machine disconnects, and you'll need a new invite to reconnect. [y/N] ")).trim().toLowerCase();
|
|
91
|
+
rl.close();
|
|
92
|
+
if (a !== "y" && a !== "yes")
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
deleteConfig();
|
|
96
|
+
console.log(`${cyan("✓")} left the group. Open Claude sessions disconnect within a few seconds.`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
81
99
|
case "sessions": {
|
|
82
100
|
const sessions = listSessions(process.cwd());
|
|
83
101
|
if (sessions.length === 0)
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
-
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir, userInfo } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
export function homeDir() {
|
|
@@ -40,6 +40,13 @@ export function loadConfig() {
|
|
|
40
40
|
return c;
|
|
41
41
|
}
|
|
42
42
|
export const saveConfig = (c) => writeJson("config.json", c);
|
|
43
|
+
/** Leave the group: forget the group secret (and the legacy copy, so it isn't migrated back). */
|
|
44
|
+
export function deleteConfig() {
|
|
45
|
+
rmSync(join(homeDir(), "config.json"), { force: true });
|
|
46
|
+
if (!process.env.MINDMELD_HOME && !process.env.CLAUDE_SHARE_HOME) {
|
|
47
|
+
rmSync(join(homedir(), ".claude-share", "config.json"), { force: true });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
43
50
|
/** Hosted relay (Cloudflare Worker, relay-worker/). It only ever sees ciphertext. Override with --relay or MINDMELD_RELAY. */
|
|
44
51
|
export const DEFAULT_RELAY = process.env.MINDMELD_RELAY ?? process.env.CLAUDE_SHARE_RELAY ?? "wss://claude-share-relay.thedhrupad.workers.dev";
|
|
45
52
|
/** git's user.name if set, else the OS username. */
|
package/dist/mcp.js
CHANGED
|
@@ -4,7 +4,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { answerWithFork } from "./answerer.js";
|
|
7
|
-
import { DEFAULT_RELAY, defaultName, homeDir, loadConfig, saveConfig } from "./config.js";
|
|
7
|
+
import { DEFAULT_RELAY, defaultName, deleteConfig, homeDir, loadConfig, saveConfig } from "./config.js";
|
|
8
8
|
import { generateGroupSecret, generateInviteCode } from "./crypto.js";
|
|
9
9
|
import { Daemon } from "./daemon.js";
|
|
10
10
|
import { runInviter, runJoiner } from "./pairing.js";
|
|
@@ -61,7 +61,7 @@ function ago(ms) {
|
|
|
61
61
|
* dialogs in that session and answered by a read-only fork of it.
|
|
62
62
|
*/
|
|
63
63
|
export async function runMcpServer() {
|
|
64
|
-
const server = new McpServer({ name: "mindmeld", version: "0.4.
|
|
64
|
+
const server = new McpServer({ name: "mindmeld", version: "0.4.2" });
|
|
65
65
|
const cwd = process.env.CLAUDE_PROJECT_DIR ?? process.cwd();
|
|
66
66
|
const mySessionId = process.env.CLAUDE_CODE_SESSION_ID;
|
|
67
67
|
let daemon = null;
|
|
@@ -147,9 +147,29 @@ export async function runMcpServer() {
|
|
|
147
147
|
});
|
|
148
148
|
daemon.start();
|
|
149
149
|
}
|
|
150
|
+
function disconnect() {
|
|
151
|
+
void daemon?.stop();
|
|
152
|
+
daemon = null;
|
|
153
|
+
share = null;
|
|
154
|
+
}
|
|
150
155
|
const existing = loadConfigOrNull();
|
|
151
156
|
if (existing)
|
|
152
157
|
connect(existing);
|
|
158
|
+
// Every open session holds its own connection. If the group changes elsewhere (left, or
|
|
159
|
+
// re-paired from another session or the CLI), follow it here within a few seconds.
|
|
160
|
+
let knownSecret = existing?.secret ?? null;
|
|
161
|
+
const watch = setInterval(() => {
|
|
162
|
+
const c = loadConfigOrNull();
|
|
163
|
+
const secret = c?.secret ?? null;
|
|
164
|
+
if (secret === knownSecret)
|
|
165
|
+
return;
|
|
166
|
+
knownSecret = secret;
|
|
167
|
+
if (c)
|
|
168
|
+
connect(c);
|
|
169
|
+
else
|
|
170
|
+
disconnect();
|
|
171
|
+
}, 3000);
|
|
172
|
+
watch.unref();
|
|
153
173
|
server.registerTool("list_peers", {
|
|
154
174
|
title: "List peers",
|
|
155
175
|
description: "List the sessions teammates are sharing through mindmeld right now (only shared sessions are visible).",
|
|
@@ -270,6 +290,34 @@ export async function runMcpServer() {
|
|
|
270
290
|
lines.push("- none yet");
|
|
271
291
|
return text(lines.join("\n"));
|
|
272
292
|
});
|
|
293
|
+
server.registerTool("leave_group", {
|
|
294
|
+
title: "Leave the mindmeld group",
|
|
295
|
+
description: "Disconnect this machine from the user's mindmeld group and forget the pairing, in every open session. " +
|
|
296
|
+
"Only when the user asks to leave or disconnect. Reconnecting needs a new invite.",
|
|
297
|
+
inputSchema: {
|
|
298
|
+
confirmed: z.boolean().optional().describe("Set true only if the user has explicitly confirmed in chat; otherwise a dialog asks them"),
|
|
299
|
+
},
|
|
300
|
+
}, async ({ confirmed }) => {
|
|
301
|
+
if (!loadConfigOrNull())
|
|
302
|
+
return text("You're not in a mindmeld group.");
|
|
303
|
+
if (!confirmed) {
|
|
304
|
+
if (!server.server.getClientCapabilities()?.elicitation) {
|
|
305
|
+
return text("Ask the user to confirm leaving the group, then call leave_group again with confirmed: true.", true);
|
|
306
|
+
}
|
|
307
|
+
const r = await elicit([
|
|
308
|
+
"Leave your mindmeld group?",
|
|
309
|
+
"",
|
|
310
|
+
"This disconnects every Claude session on this machine and deletes the pairing. You'll need a new invite to reconnect.",
|
|
311
|
+
"Your teammates stay connected to each other. To remove someone else, the rest of you leave and pair again with a new invite: that creates a new group key they don't have.",
|
|
312
|
+
].join("\n"), { type: "object", properties: {} });
|
|
313
|
+
if (r.action !== "accept")
|
|
314
|
+
return text("Okay, staying in the group.");
|
|
315
|
+
}
|
|
316
|
+
disconnect();
|
|
317
|
+
deleteConfig();
|
|
318
|
+
knownSecret = null;
|
|
319
|
+
return text("Left the group. Every session on this machine is now disconnected and the pairing is deleted. Use /mindmeld:invite or /mindmeld:join to connect again.");
|
|
320
|
+
});
|
|
273
321
|
server.registerTool("trust_peer", {
|
|
274
322
|
title: "Always allow (or stop allowing) a teammate",
|
|
275
323
|
description: "When the user says to always allow someone, their questions get answered without approval dialogs. " +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindmeld-mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "mindmeld: let your Claude Code session ask a teammate's Claude Code session questions. E2E encrypted, read-only answers, approved in Claude.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"build": "tsc",
|
|
19
19
|
"test": "vitest run",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
|
-
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
21
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build",
|
|
22
|
+
"build:plugin": "esbuild src/cli.ts --bundle --platform=node --target=node20 --format=cjs --outfile=plugin/server/mindmeld.cjs --external:bufferutil --external:utf-8-validate --legal-comments=none --minify-whitespace --minify-syntax --log-level=warning",
|
|
23
|
+
"pretest": "npm run build:plugin"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
26
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
@@ -30,6 +32,7 @@
|
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@types/node": "^26.6.5",
|
|
32
34
|
"@types/ws": "^8.18.2",
|
|
35
|
+
"esbuild": "^0.28.2",
|
|
33
36
|
"typescript": "^7.0.2",
|
|
34
37
|
"vitest": "^4.1.12"
|
|
35
38
|
},
|