@jive-ai/cli 0.0.13 → 0.0.14
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/dist/index.mjs +52 -29
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
|
17
17
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
18
18
|
import fs$1 from "fs";
|
|
19
19
|
import { fileURLToPath } from "url";
|
|
20
|
+
import dedent from "dedent";
|
|
20
21
|
|
|
21
22
|
//#region src/lib/config.ts
|
|
22
23
|
const CREDENTIALS_PATH = path.join(os.homedir(), ".jive", "credentials.json");
|
|
@@ -719,7 +720,10 @@ async function initCommand() {
|
|
|
719
720
|
}
|
|
720
721
|
}
|
|
721
722
|
spinner.text = "Adding Jive server to .mcp.json...";
|
|
722
|
-
await addMcpServer("jive-mcp", {
|
|
723
|
+
await addMcpServer("jive-mcp", {
|
|
724
|
+
command: "jive",
|
|
725
|
+
args: ["mcp", "start"]
|
|
726
|
+
});
|
|
723
727
|
spinner.text = "Removing uploaded MCP servers from local .mcp.json...";
|
|
724
728
|
if (mcpConfig?.mcpServers) {
|
|
725
729
|
const serversToRemove = [...uploadedServers.map((server) => server.name), ...skippedServers.map((server) => server.name)];
|
|
@@ -1176,6 +1180,13 @@ function generateToolId(serverName, toolName) {
|
|
|
1176
1180
|
return `${serverName}__${toolName}`;
|
|
1177
1181
|
}
|
|
1178
1182
|
|
|
1183
|
+
//#endregion
|
|
1184
|
+
//#region src/utils/truncateString.ts
|
|
1185
|
+
function truncateString(str, maxLength) {
|
|
1186
|
+
if (str.length <= maxLength) return str;
|
|
1187
|
+
return `${str.slice(0, maxLength)}...`;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1179
1190
|
//#endregion
|
|
1180
1191
|
//#region src/mcp/connection-manager.ts
|
|
1181
1192
|
/**
|
|
@@ -1270,6 +1281,13 @@ var McpConnectionManager = class {
|
|
|
1270
1281
|
}
|
|
1271
1282
|
return results;
|
|
1272
1283
|
}
|
|
1284
|
+
listTools() {
|
|
1285
|
+
return Array.from(this.tools.values()).map((tool) => ({
|
|
1286
|
+
id: tool.id,
|
|
1287
|
+
name: tool.toolName,
|
|
1288
|
+
description: truncateString(tool.description, 100)
|
|
1289
|
+
}));
|
|
1290
|
+
}
|
|
1273
1291
|
/**
|
|
1274
1292
|
* Get full tool definitions including TypeScript code
|
|
1275
1293
|
*/
|
|
@@ -1344,7 +1362,8 @@ function log(...args) {
|
|
|
1344
1362
|
*/
|
|
1345
1363
|
async function startMcpServer() {
|
|
1346
1364
|
log("=== Jive Server Starting ===");
|
|
1347
|
-
|
|
1365
|
+
const teamId = (await getProjectConfig())?.activeTeamId;
|
|
1366
|
+
if (!teamId) {
|
|
1348
1367
|
log("Error: No team ID found, select one with `jive team switch`");
|
|
1349
1368
|
process.exit(1);
|
|
1350
1369
|
return;
|
|
@@ -1379,16 +1398,8 @@ async function startMcpServer() {
|
|
|
1379
1398
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
1380
1399
|
return { tools: [
|
|
1381
1400
|
{
|
|
1382
|
-
name: "
|
|
1383
|
-
description: "
|
|
1384
|
-
inputSchema: {
|
|
1385
|
-
type: "object",
|
|
1386
|
-
properties: { query: {
|
|
1387
|
-
type: "string",
|
|
1388
|
-
description: "Search query for subagents"
|
|
1389
|
-
} },
|
|
1390
|
-
required: ["query"]
|
|
1391
|
-
}
|
|
1401
|
+
name: "list_subagents",
|
|
1402
|
+
description: "List all subagents for the selected team. Returns lightweight list of subagent names, descriptions and IDs."
|
|
1392
1403
|
},
|
|
1393
1404
|
{
|
|
1394
1405
|
name: "call_subagent",
|
|
@@ -1409,16 +1420,8 @@ async function startMcpServer() {
|
|
|
1409
1420
|
}
|
|
1410
1421
|
},
|
|
1411
1422
|
{
|
|
1412
|
-
name: "
|
|
1413
|
-
description: "
|
|
1414
|
-
inputSchema: {
|
|
1415
|
-
type: "object",
|
|
1416
|
-
properties: { query: {
|
|
1417
|
-
type: "string",
|
|
1418
|
-
description: "Search query for tools"
|
|
1419
|
-
} },
|
|
1420
|
-
required: ["query"]
|
|
1421
|
-
}
|
|
1423
|
+
name: "list_tools",
|
|
1424
|
+
description: "List all MCP tools for the selected team. Returns lightweight list of tool names, descriptions and IDs."
|
|
1422
1425
|
},
|
|
1423
1426
|
{
|
|
1424
1427
|
name: "get_tools",
|
|
@@ -1440,7 +1443,26 @@ async function startMcpServer() {
|
|
|
1440
1443
|
type: "object",
|
|
1441
1444
|
properties: { code: {
|
|
1442
1445
|
type: "string",
|
|
1443
|
-
description:
|
|
1446
|
+
description: dedent`
|
|
1447
|
+
TypeScript code to execute. Must call the \`callMcpTool\` function to call MCP tools.
|
|
1448
|
+
If applicable, write code that transforms the result of the tool call into your desired output to save tokens.
|
|
1449
|
+
|
|
1450
|
+
Don't import \`callMcpTool\` -- it is injected into the execution environment.
|
|
1451
|
+
You can call multiple MCP tools if you wish. You must include the relevant TypeScript definitions returned by the \`get_tools\` tool.
|
|
1452
|
+
Return the value you want to return to agent context.
|
|
1453
|
+
|
|
1454
|
+
Example:
|
|
1455
|
+
|
|
1456
|
+
\`\`\`ts
|
|
1457
|
+
// With code execution - filter in the execution environment
|
|
1458
|
+
const allRows = await callMcpTool('gdrive', 'getSheet', { sheetId: 'abc123' });
|
|
1459
|
+
const pendingOrders = allRows.filter(row =>
|
|
1460
|
+
row["Status"] === 'pending'
|
|
1461
|
+
);
|
|
1462
|
+
console.log(\`Found \${pendingOrders.length} pending orders\`);
|
|
1463
|
+
return pendingOrders.slice(0, 5); // Only log first 5 for review
|
|
1464
|
+
\`\`\`
|
|
1465
|
+
`
|
|
1444
1466
|
} },
|
|
1445
1467
|
required: ["code"]
|
|
1446
1468
|
}
|
|
@@ -1480,8 +1502,8 @@ async function startMcpServer() {
|
|
|
1480
1502
|
try {
|
|
1481
1503
|
if (!args) throw new Error("Missing arguments");
|
|
1482
1504
|
switch (name) {
|
|
1483
|
-
case "
|
|
1484
|
-
const results = await apiRequest(
|
|
1505
|
+
case "list_subagents": {
|
|
1506
|
+
const results = await apiRequest(`/api/teams/${teamId}/subagents`);
|
|
1485
1507
|
return { content: [{
|
|
1486
1508
|
type: "text",
|
|
1487
1509
|
text: JSON.stringify(results, null, 2)
|
|
@@ -1491,8 +1513,8 @@ async function startMcpServer() {
|
|
|
1491
1513
|
type: "text",
|
|
1492
1514
|
text: (await apiRequest(`/api/subagents/${args.id}/call`, { prompt: args.prompt })).prompt
|
|
1493
1515
|
}] };
|
|
1494
|
-
case "
|
|
1495
|
-
const results = connectionManager.
|
|
1516
|
+
case "list_tools": {
|
|
1517
|
+
const results = connectionManager.listTools();
|
|
1496
1518
|
return { content: [{
|
|
1497
1519
|
type: "text",
|
|
1498
1520
|
text: JSON.stringify(results, null, 2)
|
|
@@ -1509,7 +1531,8 @@ async function startMcpServer() {
|
|
|
1509
1531
|
code = code.replace(/import\s+.*?from\s+['"].*?['"];?\s*/g, "");
|
|
1510
1532
|
const result = ts.transpileModule(code, { compilerOptions: {
|
|
1511
1533
|
module: ts.ModuleKind.ESNext,
|
|
1512
|
-
target: ts.ScriptTarget.ES2020
|
|
1534
|
+
target: ts.ScriptTarget.ES2020,
|
|
1535
|
+
strict: true
|
|
1513
1536
|
} });
|
|
1514
1537
|
if (result.diagnostics && result.diagnostics.length > 0) return {
|
|
1515
1538
|
content: [{
|
|
@@ -2063,7 +2086,7 @@ async function checkTeamMembership() {
|
|
|
2063
2086
|
|
|
2064
2087
|
//#endregion
|
|
2065
2088
|
//#region package.json
|
|
2066
|
-
var version = "0.0.
|
|
2089
|
+
var version = "0.0.13";
|
|
2067
2090
|
|
|
2068
2091
|
//#endregion
|
|
2069
2092
|
//#region src/index.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@jive-ai/cli",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"axios": "^1.13.2",
|
|
31
31
|
"chalk": "^5.6.2",
|
|
32
32
|
"commander": "^14.0.2",
|
|
33
|
+
"dedent": "^1.7.0",
|
|
33
34
|
"gray-matter": "^4.0.3",
|
|
34
35
|
"ora": "^9.0.0",
|
|
35
36
|
"prompts": "^2.4.2",
|