@basegrid_tech/mcp 0.6.5 → 0.7.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 +101 -9
  2. package/package.json +7 -3
package/dist/index.js CHANGED
@@ -1334,7 +1334,6 @@ var DEFAULTS_KEYS_MAP = {
1334
1334
  layoutMode: true,
1335
1335
  mainViewMode: true,
1336
1336
  activeWorkspace: true,
1337
- updateChannel: true,
1338
1337
  webAccessEnabled: true,
1339
1338
  mobileAccessEnabled: true,
1340
1339
  networkAccessEnabled: true,
@@ -1362,7 +1361,11 @@ var DEFAULTS_KEYS_MAP = {
1362
1361
  navigationHistoryEnabled: true,
1363
1362
  experimentalClaudeStreamRuntime: true,
1364
1363
  costForecastEnabled: true,
1365
- sendAnonymousUsageData: true
1364
+ sendAnonymousUsageData: true,
1365
+ reviewAgent: true,
1366
+ reviewClaudeModel: true,
1367
+ reviewCodexModel: true,
1368
+ reviewCodexEffort: true
1366
1369
  };
1367
1370
  var DEFAULTS_KEYS = Object.keys(DEFAULTS_KEYS_MAP);
1368
1371
  var INTERNAL_DEFAULTS_KEYS = /* @__PURE__ */ new Set([
@@ -2669,18 +2672,19 @@ function readPort() {
2669
2672
  return discoverAndHeal();
2670
2673
  }
2671
2674
  }
2672
- async function rpcCall(method, params) {
2675
+ async function rpcCall(method, params, opts = {}) {
2673
2676
  const result = readPort();
2674
2677
  if (!result.port) {
2675
2678
  throw new Error(result.reason === "invalid" ? PORT_FILE_INVALID_MSG : PORT_FILE_MISSING_MSG);
2676
2679
  }
2680
+ const effectiveTimeout = opts.timeoutMs ?? TIMEOUT_MS;
2677
2681
  return new Promise((resolve, reject) => {
2678
2682
  const ws = new WebSocket(`ws://127.0.0.1:${result.port}/ws`);
2679
2683
  const id = ++rpcId;
2680
- const timer = setTimeout(() => {
2684
+ const timer = effectiveTimeout > 0 ? setTimeout(() => {
2681
2685
  ws.close();
2682
- reject(new Error(`RPC call "${method}" timed out after ${TIMEOUT_MS}ms`));
2683
- }, TIMEOUT_MS);
2686
+ reject(new Error(`RPC call "${method}" timed out after ${effectiveTimeout}ms`));
2687
+ }, effectiveTimeout) : null;
2684
2688
  ws.on("open", () => {
2685
2689
  ws.send(JSON.stringify({ jsonrpc: "2.0", id, method, params }));
2686
2690
  });
@@ -2688,7 +2692,7 @@ async function rpcCall(method, params) {
2688
2692
  try {
2689
2693
  const msg = JSON.parse(raw.toString());
2690
2694
  if (msg.id !== id) return;
2691
- clearTimeout(timer);
2695
+ if (timer) clearTimeout(timer);
2692
2696
  ws.close();
2693
2697
  if (msg.error) {
2694
2698
  reject(new Error(msg.error.message));
@@ -2699,7 +2703,7 @@ async function rpcCall(method, params) {
2699
2703
  }
2700
2704
  });
2701
2705
  ws.on("error", (err) => {
2702
- clearTimeout(timer);
2706
+ if (timer) clearTimeout(timer);
2703
2707
  reject(new Error(`Cannot connect to BaseGrid server: ${err.message}. Is the app running?`));
2704
2708
  });
2705
2709
  });
@@ -3425,6 +3429,93 @@ function registerWorkspaceTools(server) {
3425
3429
  );
3426
3430
  }
3427
3431
 
3432
+ // src/tools/ask-user-question.ts
3433
+ import { z as z7 } from "zod";
3434
+ var ASK_TIMEOUT_MS = 60 * 60 * 1e3;
3435
+ var questionSchema = z7.object({
3436
+ question: z7.string().min(1).max(1e3).describe("The question to ask the user."),
3437
+ header: z7.string().max(40).optional().describe("Very short label/chip shown above the question (max 40 chars)."),
3438
+ multiSelect: z7.boolean().optional().describe("Allow multiple options to be selected. Defaults to single-select."),
3439
+ options: z7.array(z7.string().min(1).max(200)).min(2).max(4).describe(
3440
+ 'Available choices (2\u20134). Do NOT include "Other" yourself \u2014 the UI adds it automatically when supported.'
3441
+ )
3442
+ });
3443
+ function registerAskUserQuestionTool(server) {
3444
+ server.tool(
3445
+ "ask_user_question",
3446
+ [
3447
+ "Ask the user a question during execution. Use to: gather preferences,",
3448
+ "clarify ambiguous instructions, get a decision on an implementation",
3449
+ "choice, or offer the user options about the next direction.",
3450
+ "",
3451
+ "Each question shows 2\u20134 mutually exclusive options. The UI returns the",
3452
+ "selected label(s). If the user dismisses the card, the tool returns",
3453
+ '`status: "skipped"` \u2014 proceed with your best judgement.',
3454
+ "",
3455
+ 'Do NOT add an "Other" option to `options` \u2014 the host UI handles free-',
3456
+ "text input separately when needed."
3457
+ ].join(" "),
3458
+ {
3459
+ questions: z7.array(questionSchema).min(1).max(4).describe("Questions to ask (1\u20134). Each independent and mutually exclusive.")
3460
+ },
3461
+ async (args) => {
3462
+ const terminalId = process.env.BASEGRID_TERMINAL_ID;
3463
+ if (!terminalId) {
3464
+ return {
3465
+ content: [
3466
+ {
3467
+ type: "text",
3468
+ text: "Error: BASEGRID_TERMINAL_ID is not set in the environment. This tool can only be used from a BaseGrid-managed session."
3469
+ }
3470
+ ],
3471
+ isError: true
3472
+ };
3473
+ }
3474
+ const normalized = args.questions.map((q) => ({
3475
+ question: q.question,
3476
+ ...q.header ? { header: q.header } : {},
3477
+ ...typeof q.multiSelect === "boolean" ? { multiSelect: q.multiSelect } : {},
3478
+ options: q.options.map((label) => ({ label }))
3479
+ }));
3480
+ try {
3481
+ const res = await rpcCall(
3482
+ "mcp:askUserQuestion",
3483
+ { terminalId, questions: normalized },
3484
+ { timeoutMs: ASK_TIMEOUT_MS }
3485
+ );
3486
+ if (res.skipped || !res.answers) {
3487
+ return {
3488
+ content: [
3489
+ {
3490
+ type: "text",
3491
+ text: "The user dismissed the question card without answering. Proceed with your best judgement based on prior context."
3492
+ }
3493
+ ]
3494
+ };
3495
+ }
3496
+ const out = {};
3497
+ args.questions.forEach((q, i) => {
3498
+ const value = res.answers?.[String(i)] ?? res.answers?.[q.question];
3499
+ if (value !== void 0) out[q.question] = value;
3500
+ });
3501
+ return {
3502
+ content: [{ type: "text", text: JSON.stringify(out, null, 2) }]
3503
+ };
3504
+ } catch (err) {
3505
+ return {
3506
+ content: [
3507
+ {
3508
+ type: "text",
3509
+ text: `Error asking user: ${err instanceof Error ? err.message : String(err)}`
3510
+ }
3511
+ ],
3512
+ isError: true
3513
+ };
3514
+ }
3515
+ }
3516
+ );
3517
+ }
3518
+
3428
3519
  // src/server.ts
3429
3520
  function createMcpServer(version) {
3430
3521
  const server = new McpServer({ name: "basegrid", version }, { capabilities: { tools: {} } });
@@ -3434,6 +3525,7 @@ function createMcpServer(version) {
3434
3525
  registerSessionTools(server);
3435
3526
  registerWorkflowTools(server);
3436
3527
  registerWorkspaceTools(server);
3528
+ registerAskUserQuestionTool(server);
3437
3529
  return server;
3438
3530
  }
3439
3531
 
@@ -3446,7 +3538,7 @@ console.warn = (...args) => _origError("[mcp:warn]", ...args);
3446
3538
  console.error = (...args) => _origError("[mcp:error]", ...args);
3447
3539
  async function main() {
3448
3540
  configManager.init();
3449
- const version = true ? "0.6.5" : createRequire(import.meta.url)("../package.json").version;
3541
+ const version = true ? "0.7.0" : createRequire(import.meta.url)("../package.json").version;
3450
3542
  const server = createMcpServer(version);
3451
3543
  const transport = new StdioServerTransport();
3452
3544
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basegrid_tech/mcp",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "description": "BaseGrid MCP server — task management, git, and workflow tools for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,6 +26,10 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "registry": "https://registry.npmjs.org/"
32
+ },
29
33
  "scripts": {
30
34
  "build": "tsup",
31
35
  "dev": "tsx src/index.ts"
@@ -38,8 +42,8 @@
38
42
  "zod": "^4.3.6"
39
43
  },
40
44
  "devDependencies": {
41
- "@basegrid/server": "0.6.5",
42
- "@basegrid/shared": "0.6.5",
45
+ "@basegrid/server": "0.7.0",
46
+ "@basegrid/shared": "0.7.0",
43
47
  "tsup": "^8.5.1",
44
48
  "tsx": "^4.21.0",
45
49
  "typescript": "^6.0.3"