@paigy/mcp 0.8.0 → 0.8.1
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 +45 -0
- package/dist/{chunk-4MRCUW5I.js → chunk-2BJSWNUX.js} +34 -11
- package/dist/index.js +36 -10
- package/dist/listen.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,6 +45,51 @@ npx -p @paigy/mcp paigy-mcp-onboard
|
|
|
45
45
|
It talks to the hosted backend by default — no config needed. Set
|
|
46
46
|
`PAIGY_BACKEND_URL=http://localhost:3000` only for local development.
|
|
47
47
|
|
|
48
|
+
### Codex CLI (OpenAI)
|
|
49
|
+
|
|
50
|
+
Codex speaks MCP, so the same server drops in. Add it (writes `~/.codex/config.toml`):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
codex mcp add paigy --env PAIGY_AGENT=codex -- npx -y @paigy/mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or add the entry to `~/.codex/config.toml` by hand:
|
|
57
|
+
|
|
58
|
+
```toml
|
|
59
|
+
[mcp_servers.paigy]
|
|
60
|
+
command = "npx"
|
|
61
|
+
args = ["-y", "@paigy/mcp"]
|
|
62
|
+
env = { PAIGY_AGENT = "codex" }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then pair: `npx -p @paigy/mcp paigy-mcp-onboard` (or have the agent call the `pair` tool).
|
|
66
|
+
|
|
67
|
+
### Gemini CLI
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
gemini mcp add -s user -e PAIGY_AGENT=gemini paigy npx -y @paigy/mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`-s user` makes it available across all projects — omit it for just the current one.
|
|
74
|
+
Or add the entry to `~/.gemini/settings.json`:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"mcpServers": {
|
|
79
|
+
"paigy": {
|
|
80
|
+
"command": "npx",
|
|
81
|
+
"args": ["-y", "@paigy/mcp"],
|
|
82
|
+
"env": { "PAIGY_AGENT": "gemini" }
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Then pair: `npx -p @paigy/mcp paigy-mcp-onboard`.
|
|
89
|
+
|
|
90
|
+
> `PAIGY_AGENT` just names the agent on the device-approval screen (defaults to
|
|
91
|
+
> `mcp-agent`) — set it per client so you can tell your connected agents apart.
|
|
92
|
+
|
|
48
93
|
## Tools
|
|
49
94
|
|
|
50
95
|
- **`notify_user`** — notify the user (context: title + description chunks, plus optional options — each an answerable choice that can carry a sandboxed `html` or `image` preview for visual "pick one" decisions — visuals, `urgency`, and `parentId` for a clarification). Returns a request id + thread id. If a reply comes back as `{kind:'clarify', chunks:[...]}`, respond via notify_user with the SAME threadId and an expanded description.
|
|
@@ -134,6 +134,14 @@ var InboxItemSchema = z.object({
|
|
|
134
134
|
createdAt: z.string().datetime(),
|
|
135
135
|
snoozedUntil: z.string().datetime().optional(),
|
|
136
136
|
agentState: AgentStateSchema.default("idle"),
|
|
137
|
+
/** Whose action the item is waiting on: "you" = an agent asked you (the default,
|
|
138
|
+
* every agent→user notification); "agent" = you sent a request and it's awaiting the
|
|
139
|
+
* agent (held in the inbox until the agent replies on the thread). */
|
|
140
|
+
turn: z.enum(["you", "agent"]).default("you"),
|
|
141
|
+
/** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
|
|
142
|
+
* the agent (provider-agnostic; set server-side). Absent = no hard error, though the
|
|
143
|
+
* client may still flag a stall by age. Drives the inbox error badge + Retry. */
|
|
144
|
+
error: z.string().optional(),
|
|
137
145
|
parentId: z.string().optional(),
|
|
138
146
|
select: z.enum(["one", "many", "rank", "confirm"]).default("one"),
|
|
139
147
|
confirmStyle: z.enum(["yesno", "approve"]).default("yesno").describe(
|
|
@@ -151,6 +159,16 @@ var PushTokenSchema = z.object({
|
|
|
151
159
|
alertToken: z.string().min(1).optional(),
|
|
152
160
|
platform: z.literal("ios")
|
|
153
161
|
});
|
|
162
|
+
var MissedCallSchema = z.enum([
|
|
163
|
+
"retry_10m",
|
|
164
|
+
"retry_30m",
|
|
165
|
+
"retry_60m",
|
|
166
|
+
"backoff_gentle",
|
|
167
|
+
"backoff_standard",
|
|
168
|
+
"backoff_aggressive",
|
|
169
|
+
"inbox",
|
|
170
|
+
"dismiss"
|
|
171
|
+
]);
|
|
154
172
|
var UserSettingsSchema = z.object({
|
|
155
173
|
permissions: z.object({
|
|
156
174
|
call: z.boolean(),
|
|
@@ -159,7 +177,10 @@ var UserSettingsSchema = z.object({
|
|
|
159
177
|
}),
|
|
160
178
|
sessionMode: z.enum(["default", "all_calls", "silent"]),
|
|
161
179
|
silentPush: z.boolean(),
|
|
162
|
-
autoCallback: z.boolean()
|
|
180
|
+
autoCallback: z.boolean(),
|
|
181
|
+
/** Opt-in (default false) to using your content to improve Paigy and train models. */
|
|
182
|
+
improveConsent: z.boolean(),
|
|
183
|
+
missedCall: MissedCallSchema.default("backoff_standard")
|
|
163
184
|
});
|
|
164
185
|
var HistoryItemSchema = z.object({
|
|
165
186
|
id: z.string(),
|
|
@@ -181,7 +202,13 @@ var ConnectionSummarySchema = z.object({
|
|
|
181
202
|
agent: z.string(),
|
|
182
203
|
device: z.string().nullable(),
|
|
183
204
|
nickname: z.string(),
|
|
184
|
-
createdAt: z.string().datetime()
|
|
205
|
+
createdAt: z.string().datetime(),
|
|
206
|
+
/** Most recent notification on this connection, either direction. Null = no contact yet.
|
|
207
|
+
* Drives the agents-page recency grouping (Today / This week / …). */
|
|
208
|
+
lastContactAt: z.string().datetime().nullable(),
|
|
209
|
+
/** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
|
|
210
|
+
* false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
|
|
211
|
+
managed: z.boolean()
|
|
185
212
|
});
|
|
186
213
|
var CreateRequestSchema = z.object({
|
|
187
214
|
/** The connection (token id) to send to, from GET /api/tokens. */
|
|
@@ -197,15 +224,6 @@ var OAuthStartSchema = z.object({
|
|
|
197
224
|
provider: z.enum(["cma"]),
|
|
198
225
|
returnTo: z.string().min(1)
|
|
199
226
|
});
|
|
200
|
-
var SetProviderSchema = z.object({
|
|
201
|
-
provider: z.enum(["cma"]),
|
|
202
|
-
/** Provider-side agent id (e.g. CMA `agent_…`). */
|
|
203
|
-
agentRef: z.string().min(1),
|
|
204
|
-
/** Provider-side environment id (e.g. CMA `env_…`). */
|
|
205
|
-
environmentId: z.string().min(1),
|
|
206
|
-
/** The delegated API key Paigy holds (in Vault) to spawn sessions on the user's behalf. */
|
|
207
|
-
apiKey: z.string().min(1)
|
|
208
|
-
});
|
|
209
227
|
var DeliveryConfigSchema = z.object({
|
|
210
228
|
tokenId: z.string(),
|
|
211
229
|
mode: DeliveryModeSchema,
|
|
@@ -247,6 +265,11 @@ var DeviceTokenSchema = z.object({
|
|
|
247
265
|
agent: z.string(),
|
|
248
266
|
device: z.string().nullable()
|
|
249
267
|
});
|
|
268
|
+
var SupportRequestSchema = z.object({
|
|
269
|
+
email: z.string().email().max(320),
|
|
270
|
+
message: z.string().trim().min(1).max(5e3),
|
|
271
|
+
name: z.string().trim().max(120).optional()
|
|
272
|
+
});
|
|
250
273
|
|
|
251
274
|
// src/client.ts
|
|
252
275
|
import { existsSync, readFileSync } from "fs";
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
scheduleCallback,
|
|
12
12
|
setTaskState,
|
|
13
13
|
submitNotification
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2BJSWNUX.js";
|
|
15
15
|
import {
|
|
16
16
|
deleteToken,
|
|
17
17
|
openBrowser,
|
|
@@ -32,7 +32,33 @@ import {
|
|
|
32
32
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
33
33
|
import { execSync } from "child_process";
|
|
34
34
|
import { z } from "zod";
|
|
35
|
+
|
|
36
|
+
// src/schema.ts
|
|
35
37
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
38
|
+
function draft2020(node) {
|
|
39
|
+
if (Array.isArray(node)) return node.map(draft2020);
|
|
40
|
+
if (node && typeof node === "object") {
|
|
41
|
+
const o = node;
|
|
42
|
+
for (const [excl, lim] of [["exclusiveMinimum", "minimum"], ["exclusiveMaximum", "maximum"]]) {
|
|
43
|
+
if (typeof o[excl] === "boolean") {
|
|
44
|
+
if (o[excl] === true && typeof o[lim] === "number") {
|
|
45
|
+
o[excl] = o[lim];
|
|
46
|
+
delete o[lim];
|
|
47
|
+
} else delete o[excl];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (const k of Object.keys(o)) o[k] = draft2020(o[k]);
|
|
51
|
+
return o;
|
|
52
|
+
}
|
|
53
|
+
return node;
|
|
54
|
+
}
|
|
55
|
+
function json(s) {
|
|
56
|
+
const schema = zodToJsonSchema(s, { target: "jsonSchema2019-09", $refStrategy: "none" });
|
|
57
|
+
delete schema.$schema;
|
|
58
|
+
return draft2020(schema);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/index.ts
|
|
36
62
|
var PollAnswerSchema = z.object({
|
|
37
63
|
id: z.string().describe("Request id returned by notify_user.")
|
|
38
64
|
});
|
|
@@ -80,47 +106,47 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
80
106
|
{
|
|
81
107
|
name: "pair",
|
|
82
108
|
description: "Pair this agent with the user's Paigy account (one-time) \u2014 required before notify_user/await_reply work. Two steps: (1) call with NO args to start; it opens the user's browser and returns { verification_uri_complete, user_code, device_code } \u2014 show the user the URL + user_code and ask them to approve. (2) call again passing that device_code to finish; it waits for approval and saves the token. If it returns { status:'pending' }, the user hasn't approved yet \u2014 call again with the same device_code to keep waiting.",
|
|
83
|
-
inputSchema:
|
|
109
|
+
inputSchema: json(PairSchema)
|
|
84
110
|
},
|
|
85
111
|
{
|
|
86
112
|
name: "unpair",
|
|
87
113
|
description: "Log out / unpair this agent from the user's Paigy account: revokes the token server-side (it stops working everywhere) and deletes the local ~/.paigy/token.json. Takes no arguments. After this, notify_user/await_reply won't work until the user pairs again with the pair tool.",
|
|
88
|
-
inputSchema:
|
|
114
|
+
inputSchema: json(z.object({}))
|
|
89
115
|
},
|
|
90
116
|
{
|
|
91
117
|
name: "notify_user",
|
|
92
118
|
description: "Notify the user via Paigy and get a request id to poll for their answer. Provide context.title (a specific, non-empty one-line headline \u2014 this is what the user sees first, and what shows on the ring for a call) and context.description (an array of standalone, non-empty detail chunks the user can selectively ask you to expand). Set `urgency`: 'inbox' (default) drops it silently in their inbox; 'push' is a quiet passive notification (no sound); 'banner' sends a time-sensitive banner/lock-screen push (a 'paige') they tap to open \u2014 for when you need them soon-ish but not enough to ring them; 'call' rings their phone now as a voice call \u2014 only when you genuinely need them in the moment (blocked/waiting, time-sensitive). ON A CALL, your title + description are READ ALOUD by a voice \u2014 write them to be HEARD, not read: keep it short and conversational, front-load the ask, and refer to things BY NAME, not by ID or code (say 'the pull request about the agents page', not 'PR #235'; 'the login-bug ticket', not 'ABC-1234'). Spell out only what's natural to say out loud. MATCH the answer shape to the question \u2014 pick the best tool for the job, not always yes/no. The user can ALWAYS add free text on top of any shape, so structuring loses nothing. Choose `select`: yes/no \u2192 select:'confirm' \u2192 {kind:'confirm', approved:boolean}. Approve/deny an action \u2192 select:'confirm' + confirmStyle:'approve' \u2192 {kind:'confirm', approved:boolean}. Both are answerable right from the banner. Pick one of several \u2192 options + select:'one' \u2192 {kind:'option', optionId}. Pick several / a subset \u2192 options + select:'many' \u2192 {kind:'multi', optionIds:[...]}. Rank or prioritize \u2192 options + select:'rank', user taps in preferred order \u2192 {kind:'ranked', optionIds:[...]}. For visual choices give each option a sandboxed `html` or an `image` preview (e.g. layout/UI alternatives). Only leave options off (pure free text / voice) when the answer genuinely can't be structured. Plus optional visuals. If a reply comes back as {kind:'clarify', chunks:[...]}, the user wants more detail on those chunks \u2014 respond via notify_user with the SAME threadId and an expanded description. Pass `threadId` from a prior notify_user result or an await_reply reply to continue that conversation thread; omit it to start a new one. To follow up on a call (e.g. the user asked you to 'call me back when it's done'), reuse the threadId from that call's reply so it threads as the same conversation.",
|
|
93
|
-
inputSchema:
|
|
119
|
+
inputSchema: json(NotifyRequestSchema)
|
|
94
120
|
},
|
|
95
121
|
{
|
|
96
122
|
name: "poll_answer",
|
|
97
123
|
description: "Fetch the user's answer to a previous notify_user request. Returns status pending | answered | ignored, with the answer once present. Errors if the id is unknown or expired.",
|
|
98
|
-
inputSchema:
|
|
124
|
+
inputSchema: json(PollAnswerSchema)
|
|
99
125
|
},
|
|
100
126
|
{
|
|
101
127
|
name: "await_reply",
|
|
102
128
|
description: "Wait for the user's reply to THE specific notification you sent for the current request (pass its id from notify_user). This is how you wait for your answer in-context. Polls ~5 min; returns { type:'reply', answer } when they respond, { type:'remind', remindInSeconds } on snooze (ScheduleWakeup then await_reply again), or { type:'idle' }. Scoped to that one notification \u2014 it NEVER returns replies meant for other notifications/requests, so concurrent requests don't cross. A CALL answer can come back as {kind:'turns', turns:[{prompt,reply}]} \u2014 the ordered log of that call. Read turns[0].reply as the user's main instruction and any later turns as their follow-up (e.g. the end-of-call 'call me back when it's done / I have a blocking question' reply). If they asked for a callback, re-engage in the SAME thread (notify_user with the reply's threadId) when the task is done or you hit a blocker \u2014 urgency:'call' for a blocker, 'banner'/'push'/'inbox' for done. Paigy has no scheduler; the callback is yours to send (use ScheduleWakeup/cron for timing).",
|
|
103
|
-
inputSchema:
|
|
129
|
+
inputSchema: json(AwaitReplySchema)
|
|
104
130
|
},
|
|
105
131
|
{
|
|
106
132
|
name: "check_replies",
|
|
107
133
|
description: "The catch-up router for everything NOT tied to your current request: returns replies the user sent that you haven't seen yet (now marked seen), still-pending notifications you sent, and `requests` \u2014 new requests the user started toward you (each { notificationId, threadId, text }, returned once). Act on each request and reply with notify_user on the SAME threadId. Use it when booting up / starting a session, or when you've been waiting a long time on something else, to discover acks or work you're unaware of. To wait on a request you just sent, use await_reply instead. Also returns owedCallbacks: callbacks now due that you promised \u2014 fulfill each with notify_user on its threadId.",
|
|
108
|
-
inputSchema:
|
|
134
|
+
inputSchema: json(CheckRepliesSchema)
|
|
109
135
|
},
|
|
110
136
|
{
|
|
111
137
|
name: "set_task_state",
|
|
112
138
|
description: "Report progress on a request you received: in_progress (you started working), completed (done), or needs_input (you need more from the user \u2014 usually paired with a notify_user carrying parentId = this request's id).",
|
|
113
|
-
inputSchema:
|
|
139
|
+
inputSchema: json(SetTaskStateToolSchema)
|
|
114
140
|
},
|
|
115
141
|
{
|
|
116
142
|
name: "register_delivery",
|
|
117
143
|
description: "Choose how Paigy reaches you when a reply or new request lands. 'self_hosted' makes Paigy PUSH it instantly over a realtime channel instead of you polling \u2014 but it only helps if a `paigy listen` daemon is running (npx -y @paigy/mcp paigy-listen), which the user runs once. 'poll' (default) keeps the catch-up model (check_replies / await_reply). Either way no work is ever lost: a missed push is reconciled by your next check_replies sweep.",
|
|
118
|
-
inputSchema:
|
|
144
|
+
inputSchema: json(RegisterDeliveryToolSchema)
|
|
119
145
|
},
|
|
120
146
|
{
|
|
121
147
|
name: "schedule_callback",
|
|
122
148
|
description: "Promise the user a follow-up you'll keep even if you go idle. Use it when they ask you to report back: trigger 'on_done' (when you finish \u2014 fires when you call set_task_state completed), 'on_blocked' (if you hit a blocker \u2014 fires on set_task_state needs_input), or 'scheduled' with dueInSeconds (e.g. 'remind me in 10 min'). Pass the threadId of the conversation and a short note. Fulfill it by calling notify_user on that threadId; check_replies re-lists due callbacks until you do.",
|
|
123
|
-
inputSchema:
|
|
149
|
+
inputSchema: json(ScheduleCallbackSchema)
|
|
124
150
|
}
|
|
125
151
|
]
|
|
126
152
|
}));
|
package/dist/listen.js
CHANGED