@paigy/mcp 0.19.0 → 0.21.0

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -267,7 +267,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
267
267
  tools: [
268
268
  {
269
269
  name: "pair",
270
- description: "Pair this agent with the user's Paigy account (one-time) \u2014 required before notify_user/await_reply work. It does NOT open a browser; the user enters the code in the Paigy app (or scans `qr`). Step 1: call with NO args \u2014 returns { user_code, device_code, qr, user_message } AND starts polling for approval in the background. SHOW the user `user_message` (the bare code) so it isn't buried in prose, THEN call step 2 \u2014 you can do both in the same turn (emit the code text first, then call pair). Step 2: call with that device_code to collect the result. Because approval is already being polled in the background, this returns the moment the user approves; on { status:'pending' } just call again to keep waiting; on { status:'awaiting_confirmation' } (E2EE) show the bare `user_message` verify code and call again to finish. The leading text block of every result states the code plainly, so it shows even if you emit no prose. On { status:'paired' } ALWAYS follow the `enable_prompt` \u2014 ask the user to allowlist Paigy's tools so notify/await don't prompt each time.",
270
+ description: "Pair this agent with the user's Paigy account (one-time) \u2014 required before notify_user/await_reply work. It does NOT open a browser; the user enters the code in the Paigy app (or scans `qr`). Step 1: call with NO args \u2014 returns { user_code, device_code, qr, user_message } AND starts polling for approval in the background. REQUIRED: You MUST immediately print the `user_message` (the bare code) as a text message to the user, AND in that same turn call step 2 (pair with the device_code). This ensures the user sees the code in chat while the tool blocks/polls in the background for approval. Step 2: call with that device_code to collect the result. Because approval is already being polled in the background, this returns the moment the user approves; on { status:'pending' } just call again to keep waiting; on { status:'awaiting_confirmation' } (E2EE) show the bare `user_message` verify code and call again to finish. The leading text block of every result states the code plainly, so it shows even if you emit no prose. On { status:'paired' } ALWAYS follow the `enable_prompt` \u2014 ask the user to allowlist Paigy's tools so notify/await don't prompt each time.",
271
271
  inputSchema: json(PairSchema)
272
272
  },
273
273
  {
@@ -334,13 +334,32 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
334
334
  throw e;
335
335
  }
336
336
  });
337
+ var CLIENT_LABELS = {
338
+ "claude-code": "Claude Code",
339
+ "claude-ai": "Claude",
340
+ cursor: "Cursor",
341
+ "cursor-vscode": "Cursor",
342
+ windsurf: "Windsurf",
343
+ cline: "Cline",
344
+ "roo-cline": "Roo Code",
345
+ continue: "Continue",
346
+ vscode: "VS Code",
347
+ "visual studio code": "VS Code",
348
+ zed: "Zed"
349
+ };
350
+ function suggestedAgentName() {
351
+ if (process.env.PAIGY_AGENT) return process.env.PAIGY_AGENT;
352
+ const raw = server.getClientVersion?.()?.name;
353
+ if (!raw) return void 0;
354
+ return CLIENT_LABELS[raw.toLowerCase()] ?? raw.replace(/[-_]+/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
355
+ }
337
356
  async function handleTool(request) {
338
357
  switch (request.params.name) {
339
358
  case "pair": {
340
359
  const { device_code } = PairSchema.parse(request.params.arguments ?? {});
341
360
  if (!device_code) {
342
361
  const { keyFile, offer } = startE2ee();
343
- const code = await requestCode(void 0, offer);
362
+ const code = await requestCode(suggestedAgentName(), offer);
344
363
  saveKeyFile({ ...keyFile, userCode: code.user_code });
345
364
  writeSurface("pairing code", code.user_code, code.expires_in);
346
365
  startBackgroundPair(code.device_code, code.expires_in * 1e3);
@@ -363,7 +382,7 @@ Enter it in the Paigy app: Inbox \u2192 Add a new agent.` },
363
382
  user_message: `# ${code.user_code}
364
383
 
365
384
  Enter it in the Paigy app (Inbox \u2192 Add a new agent).`,
366
- message: `SHOW the user \`user_message\` now (the bare code) so it isn't buried in prose, then call pair again with this device_code to finish \u2014 I'm ALREADY polling for approval in the background, so that call returns the moment they approve (it may still be pending, just call it again). You can do both in this same turn: emit the code text first, THEN call pair. Do NOT open a browser. The user may prefer scanning \`qr\` (print it verbatim in a fenced code block on request).`
385
+ message: `REQUIRED: You MUST immediately print \`user_message\` (the bare code) as a text message to the user, AND in that same turn call pair again with this device_code to poll. Do NOT end your turn without printing the code text, or it will be hidden inside the tool output. Because approval is already polling in the background, this call will wait for the user to approve and then return the token. Do NOT open a browser. The user may prefer scanning \`qr\` (print it verbatim in a fenced code block on request).`
367
386
  })
368
387
  }
369
388
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paigy/mcp",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Paigy MCP server — a voice inbox for your AI agents. Lets an agent notify a user and await their reply.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,8 +37,8 @@
37
37
  "typescript": "^5.7.2",
38
38
  "vitest": "^2.1.8",
39
39
  "@paigy/crypto": "0.0.0",
40
- "@paigy/sdk": "0.1.0",
41
- "@paigy/schema": "0.0.0"
40
+ "@paigy/schema": "0.0.0",
41
+ "@paigy/sdk": "0.1.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsup",