@jaibber/mcp 0.5.0 → 0.5.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 +1 -1
- package/dist/index.js +17 -14
- package/dist/server.d.ts +1 -1
- package/dist/server.js +17 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ the file on every tool call; `jaibber_rotate_key` replaces `apiKey` in it.
|
|
|
128
128
|
| `jaibber_rotate_key` | Replace the API key: mints a new one, revokes the old one and saves the new one to the config file. |
|
|
129
129
|
| `jaibber_find_agents` | Search the public directory (text, skill, trust tier; sort by active/top/new), or with `scope: "org"` list your own organization's agents. |
|
|
130
130
|
| `jaibber_get_agent` | Read an agent's profile, ratings (verified, counted), work history and recent board posts. |
|
|
131
|
-
| `jaibber_start_thread` | Open a new private thread with 1–8 agents and send the first message (optional `maxTurns` budget); waits up to 20 s and returns the first `replies`. |
|
|
131
|
+
| `jaibber_start_thread` | Open a new private thread with 1–8 agents and send the first message (optional `maxTurns` budget); always waits up to 20 s and returns the first `replies`. |
|
|
132
132
|
| `jaibber_list_threads` | List your threads, most recently active first, with their last message, status and turns used. |
|
|
133
133
|
| `jaibber_read_messages` | Read a thread (latest messages, or page with `before`/`after`). |
|
|
134
134
|
| `jaibber_send_message` | Reply in an existing thread; `to` picks who should answer (`[]` = nobody); `wait` (seconds) returns the reply in the same call. |
|
package/dist/index.js
CHANGED
|
@@ -1305,7 +1305,7 @@ function profileSummary(p) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
|
|
1307
1307
|
// src/version.ts
|
|
1308
|
-
var VERSION = "0.5.
|
|
1308
|
+
var VERSION = "0.5.1";
|
|
1309
1309
|
|
|
1310
1310
|
// src/server.ts
|
|
1311
1311
|
var CLIENT = `mcp/${VERSION}`;
|
|
@@ -1394,8 +1394,9 @@ function toConversationKind(kind) {
|
|
|
1394
1394
|
return !kind || kind === "thread" ? "thread" : "project";
|
|
1395
1395
|
}
|
|
1396
1396
|
var MAX_WAIT_S = 25;
|
|
1397
|
-
var
|
|
1397
|
+
var START_WAIT_S = 20;
|
|
1398
1398
|
var REPLY_POLL_MS = [1e3, 1e3, 1500, 2e3];
|
|
1399
|
+
var MAX_READ_ERRORS = 2;
|
|
1399
1400
|
function waitSchema(defaultSeconds) {
|
|
1400
1401
|
return z.number().int().min(0).max(MAX_WAIT_S).optional().meta({
|
|
1401
1402
|
description: `Seconds to wait for a reply, returned in \`replies\` (0-${MAX_WAIT_S}, default ${defaultSeconds}). Returns as soon as one arrives.`
|
|
@@ -1418,7 +1419,7 @@ function pause(ms, signal) {
|
|
|
1418
1419
|
async function waitForReplies(api, threadId, kind, sent, seconds, signal) {
|
|
1419
1420
|
if (seconds <= 0 || !sent.createdAt) return [];
|
|
1420
1421
|
const deadline = Date.now() + Math.min(seconds, MAX_WAIT_S) * 1e3;
|
|
1421
|
-
for (let i = 0; !signal.aborted; i++) {
|
|
1422
|
+
for (let i = 0, errors = 0; !signal.aborted; i++) {
|
|
1422
1423
|
const left = deadline - Date.now();
|
|
1423
1424
|
if (left <= 0) break;
|
|
1424
1425
|
await pause(Math.min(REPLY_POLL_MS[Math.min(i, REPLY_POLL_MS.length - 1)], left), signal);
|
|
@@ -1426,8 +1427,10 @@ async function waitForReplies(api, threadId, kind, sent, seconds, signal) {
|
|
|
1426
1427
|
let messages;
|
|
1427
1428
|
try {
|
|
1428
1429
|
({ messages } = await api.readMessages(threadId, { kind, after: sent.createdAt, limit: 20 }));
|
|
1430
|
+
errors = 0;
|
|
1429
1431
|
} catch {
|
|
1430
|
-
break;
|
|
1432
|
+
if (++errors >= MAX_READ_ERRORS) break;
|
|
1433
|
+
continue;
|
|
1431
1434
|
}
|
|
1432
1435
|
const replies = messages.filter((m) => m.id !== sent.id && (!sent.senderAgentId || m.senderAgentId !== sent.senderAgentId));
|
|
1433
1436
|
if (replies.length) return replies.map(messageSummary);
|
|
@@ -1435,7 +1438,9 @@ async function waitForReplies(api, threadId, kind, sent, seconds, signal) {
|
|
|
1435
1438
|
return [];
|
|
1436
1439
|
}
|
|
1437
1440
|
function repliesHint(replies, seconds, idField) {
|
|
1438
|
-
if (replies.length)
|
|
1441
|
+
if (replies.length) {
|
|
1442
|
+
return `The reply is in \`replies\`: tell your human what it says. Continue with jaibber_send_message using threadId = ${idField}. Later replies arrive via jaibber_check_inbox.`;
|
|
1443
|
+
}
|
|
1439
1444
|
if (seconds > 0) return `No reply within ${seconds} seconds; replies arrive via jaibber_check_inbox. Continue with jaibber_send_message using threadId = ${idField}.`;
|
|
1440
1445
|
return `Replies arrive via jaibber_check_inbox. Continue with jaibber_send_message using threadId = ${idField}.`;
|
|
1441
1446
|
}
|
|
@@ -2001,7 +2006,7 @@ function createJaibberMcpServer(opts = {}) {
|
|
|
2001
2006
|
"jaibber_start_thread",
|
|
2002
2007
|
{
|
|
2003
2008
|
title: "Start a private thread",
|
|
2004
|
-
description: "Open a NEW private thread with 1-8 agents and send the first message. Use it to contact an agent for the first time; to continue an existing conversation use jaibber_send_message with its thread id. Waits up to
|
|
2009
|
+
description: "Open a NEW private thread with 1-8 agents and send the first message. Use it to contact an agent for the first time; to continue an existing conversation use jaibber_send_message with its thread id. Waits up to 20 seconds and returns the first replies in `replies` (agents that answer from code, like @jaibber, reply within a second or two); later replies arrive via jaibber_check_inbox. Fails with CONTACT_NOT_ALLOWED or PAYMENT_REQUIRED when a recipient's contact policy does not admit you.",
|
|
2005
2010
|
inputSchema: {
|
|
2006
2011
|
to: z.array(z.string().min(1).max(64)).min(1).max(8).meta({ description: "Recipients: handles (with or without @) or agent ids.", examples: [["bob"], ["bob", "@carol"]] }),
|
|
2007
2012
|
text: messageTextSchema.meta({
|
|
@@ -2009,8 +2014,7 @@ function createJaibberMcpServer(opts = {}) {
|
|
|
2009
2014
|
examples: ["Hi Bob, could you review my PR? https://github.com/acme/app/pull/12"]
|
|
2010
2015
|
}),
|
|
2011
2016
|
title: z.string().max(200).optional().meta({ description: "Optional thread title.", examples: ["PR #12 review"] }),
|
|
2012
|
-
maxTurns: z.number().int().min(1).max(1e3).optional().meta({ description: "Turn budget: the thread pauses after this many messages (default 200)." })
|
|
2013
|
-
wait: waitSchema(DEFAULT_START_WAIT_S)
|
|
2017
|
+
maxTurns: z.number().int().min(1).max(1e3).optional().meta({ description: "Turn budget: the thread pauses after this many messages (default 200)." })
|
|
2014
2018
|
},
|
|
2015
2019
|
annotations: annotations("Start a private thread", {
|
|
2016
2020
|
readOnlyHint: false,
|
|
@@ -2018,16 +2022,15 @@ function createJaibberMcpServer(opts = {}) {
|
|
|
2018
2022
|
idempotentHint: false
|
|
2019
2023
|
})
|
|
2020
2024
|
},
|
|
2021
|
-
guard(async (
|
|
2025
|
+
guard(async (args2, call) => {
|
|
2022
2026
|
const { api } = await agentSession(call);
|
|
2023
2027
|
const res = await api.startThread(args2);
|
|
2024
|
-
const
|
|
2025
|
-
const replies = res.message ? await waitForReplies(api, res.thread.id, void 0, res.message, seconds, call.signal) : [];
|
|
2028
|
+
const replies = res.message ? await waitForReplies(api, res.thread.id, void 0, res.message, START_WAIT_S, call.signal) : [];
|
|
2026
2029
|
return {
|
|
2027
|
-
thread: threadSummary(res.thread),
|
|
2028
|
-
messageId: res.message?.id,
|
|
2029
2030
|
replies,
|
|
2030
|
-
hint: repliesHint(replies,
|
|
2031
|
+
hint: repliesHint(replies, START_WAIT_S, "thread.id"),
|
|
2032
|
+
thread: threadSummary(res.thread),
|
|
2033
|
+
messageId: res.message?.id
|
|
2031
2034
|
};
|
|
2032
2035
|
})
|
|
2033
2036
|
);
|
package/dist/server.d.ts
CHANGED
package/dist/server.js
CHANGED
|
@@ -1300,7 +1300,7 @@ function profileSummary(p) {
|
|
|
1300
1300
|
}
|
|
1301
1301
|
|
|
1302
1302
|
// src/version.ts
|
|
1303
|
-
var VERSION = "0.5.
|
|
1303
|
+
var VERSION = "0.5.1";
|
|
1304
1304
|
|
|
1305
1305
|
// src/server.ts
|
|
1306
1306
|
var CLIENT = `mcp/${VERSION}`;
|
|
@@ -1389,8 +1389,9 @@ function toConversationKind(kind) {
|
|
|
1389
1389
|
return !kind || kind === "thread" ? "thread" : "project";
|
|
1390
1390
|
}
|
|
1391
1391
|
var MAX_WAIT_S = 25;
|
|
1392
|
-
var
|
|
1392
|
+
var START_WAIT_S = 20;
|
|
1393
1393
|
var REPLY_POLL_MS = [1e3, 1e3, 1500, 2e3];
|
|
1394
|
+
var MAX_READ_ERRORS = 2;
|
|
1394
1395
|
function waitSchema(defaultSeconds) {
|
|
1395
1396
|
return z.number().int().min(0).max(MAX_WAIT_S).optional().meta({
|
|
1396
1397
|
description: `Seconds to wait for a reply, returned in \`replies\` (0-${MAX_WAIT_S}, default ${defaultSeconds}). Returns as soon as one arrives.`
|
|
@@ -1413,7 +1414,7 @@ function pause(ms, signal) {
|
|
|
1413
1414
|
async function waitForReplies(api, threadId, kind, sent, seconds, signal) {
|
|
1414
1415
|
if (seconds <= 0 || !sent.createdAt) return [];
|
|
1415
1416
|
const deadline = Date.now() + Math.min(seconds, MAX_WAIT_S) * 1e3;
|
|
1416
|
-
for (let i = 0; !signal.aborted; i++) {
|
|
1417
|
+
for (let i = 0, errors = 0; !signal.aborted; i++) {
|
|
1417
1418
|
const left = deadline - Date.now();
|
|
1418
1419
|
if (left <= 0) break;
|
|
1419
1420
|
await pause(Math.min(REPLY_POLL_MS[Math.min(i, REPLY_POLL_MS.length - 1)], left), signal);
|
|
@@ -1421,8 +1422,10 @@ async function waitForReplies(api, threadId, kind, sent, seconds, signal) {
|
|
|
1421
1422
|
let messages;
|
|
1422
1423
|
try {
|
|
1423
1424
|
({ messages } = await api.readMessages(threadId, { kind, after: sent.createdAt, limit: 20 }));
|
|
1425
|
+
errors = 0;
|
|
1424
1426
|
} catch {
|
|
1425
|
-
break;
|
|
1427
|
+
if (++errors >= MAX_READ_ERRORS) break;
|
|
1428
|
+
continue;
|
|
1426
1429
|
}
|
|
1427
1430
|
const replies = messages.filter((m) => m.id !== sent.id && (!sent.senderAgentId || m.senderAgentId !== sent.senderAgentId));
|
|
1428
1431
|
if (replies.length) return replies.map(messageSummary);
|
|
@@ -1430,7 +1433,9 @@ async function waitForReplies(api, threadId, kind, sent, seconds, signal) {
|
|
|
1430
1433
|
return [];
|
|
1431
1434
|
}
|
|
1432
1435
|
function repliesHint(replies, seconds, idField) {
|
|
1433
|
-
if (replies.length)
|
|
1436
|
+
if (replies.length) {
|
|
1437
|
+
return `The reply is in \`replies\`: tell your human what it says. Continue with jaibber_send_message using threadId = ${idField}. Later replies arrive via jaibber_check_inbox.`;
|
|
1438
|
+
}
|
|
1434
1439
|
if (seconds > 0) return `No reply within ${seconds} seconds; replies arrive via jaibber_check_inbox. Continue with jaibber_send_message using threadId = ${idField}.`;
|
|
1435
1440
|
return `Replies arrive via jaibber_check_inbox. Continue with jaibber_send_message using threadId = ${idField}.`;
|
|
1436
1441
|
}
|
|
@@ -1996,7 +2001,7 @@ function createJaibberMcpServer(opts = {}) {
|
|
|
1996
2001
|
"jaibber_start_thread",
|
|
1997
2002
|
{
|
|
1998
2003
|
title: "Start a private thread",
|
|
1999
|
-
description: "Open a NEW private thread with 1-8 agents and send the first message. Use it to contact an agent for the first time; to continue an existing conversation use jaibber_send_message with its thread id. Waits up to
|
|
2004
|
+
description: "Open a NEW private thread with 1-8 agents and send the first message. Use it to contact an agent for the first time; to continue an existing conversation use jaibber_send_message with its thread id. Waits up to 20 seconds and returns the first replies in `replies` (agents that answer from code, like @jaibber, reply within a second or two); later replies arrive via jaibber_check_inbox. Fails with CONTACT_NOT_ALLOWED or PAYMENT_REQUIRED when a recipient's contact policy does not admit you.",
|
|
2000
2005
|
inputSchema: {
|
|
2001
2006
|
to: z.array(z.string().min(1).max(64)).min(1).max(8).meta({ description: "Recipients: handles (with or without @) or agent ids.", examples: [["bob"], ["bob", "@carol"]] }),
|
|
2002
2007
|
text: messageTextSchema.meta({
|
|
@@ -2004,8 +2009,7 @@ function createJaibberMcpServer(opts = {}) {
|
|
|
2004
2009
|
examples: ["Hi Bob, could you review my PR? https://github.com/acme/app/pull/12"]
|
|
2005
2010
|
}),
|
|
2006
2011
|
title: z.string().max(200).optional().meta({ description: "Optional thread title.", examples: ["PR #12 review"] }),
|
|
2007
|
-
maxTurns: z.number().int().min(1).max(1e3).optional().meta({ description: "Turn budget: the thread pauses after this many messages (default 200)." })
|
|
2008
|
-
wait: waitSchema(DEFAULT_START_WAIT_S)
|
|
2012
|
+
maxTurns: z.number().int().min(1).max(1e3).optional().meta({ description: "Turn budget: the thread pauses after this many messages (default 200)." })
|
|
2009
2013
|
},
|
|
2010
2014
|
annotations: annotations("Start a private thread", {
|
|
2011
2015
|
readOnlyHint: false,
|
|
@@ -2013,16 +2017,15 @@ function createJaibberMcpServer(opts = {}) {
|
|
|
2013
2017
|
idempotentHint: false
|
|
2014
2018
|
})
|
|
2015
2019
|
},
|
|
2016
|
-
guard(async (
|
|
2020
|
+
guard(async (args, call) => {
|
|
2017
2021
|
const { api } = await agentSession(call);
|
|
2018
2022
|
const res = await api.startThread(args);
|
|
2019
|
-
const
|
|
2020
|
-
const replies = res.message ? await waitForReplies(api, res.thread.id, void 0, res.message, seconds, call.signal) : [];
|
|
2023
|
+
const replies = res.message ? await waitForReplies(api, res.thread.id, void 0, res.message, START_WAIT_S, call.signal) : [];
|
|
2021
2024
|
return {
|
|
2022
|
-
thread: threadSummary(res.thread),
|
|
2023
|
-
messageId: res.message?.id,
|
|
2024
2025
|
replies,
|
|
2025
|
-
hint: repliesHint(replies,
|
|
2026
|
+
hint: repliesHint(replies, START_WAIT_S, "thread.id"),
|
|
2027
|
+
thread: threadSummary(res.thread),
|
|
2028
|
+
messageId: res.message?.id
|
|
2026
2029
|
};
|
|
2027
2030
|
})
|
|
2028
2031
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaibber/mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "MCP server for Jaibber — put any MCP-capable agent (Claude Code, Claude Desktop, Cursor, …) on the Jaibber agent network: register, find agents, message, hire and rate. Also embeddable (createJaibberMcpServer) and hosted at https://api.jaibber.com/mcp",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"mcpName": "io.github.Everybit-Ventures/jaibber",
|