@contextstream/mcp-server 0.3.23 → 0.3.25
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.js +94 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5112,6 +5112,38 @@ var ContextStreamClient = class {
|
|
|
5112
5112
|
context.workspace_error = String(e);
|
|
5113
5113
|
}
|
|
5114
5114
|
}
|
|
5115
|
+
if (!workspaceId && !params.allow_no_workspace) {
|
|
5116
|
+
const folderDisplayName = rootPath?.split("/").pop() || "this folder";
|
|
5117
|
+
context.ide_roots = ideRoots;
|
|
5118
|
+
context.folder_name = folderDisplayName;
|
|
5119
|
+
if (rootPath) {
|
|
5120
|
+
context.folder_path = rootPath;
|
|
5121
|
+
}
|
|
5122
|
+
context.suggested_project_name = folderDisplayName;
|
|
5123
|
+
try {
|
|
5124
|
+
const workspaces = await this.listWorkspaces({ page_size: 50 });
|
|
5125
|
+
const items = Array.isArray(workspaces.items) ? workspaces.items : [];
|
|
5126
|
+
if (items.length > 0) {
|
|
5127
|
+
context.status = "requires_workspace_selection";
|
|
5128
|
+
context.workspace_candidates = items.map((w) => ({
|
|
5129
|
+
id: w.id,
|
|
5130
|
+
name: w.name,
|
|
5131
|
+
description: w.description
|
|
5132
|
+
}));
|
|
5133
|
+
context.message = `This folder is not associated with a workspace yet. Please select which workspace to use, or create a new one.`;
|
|
5134
|
+
return context;
|
|
5135
|
+
}
|
|
5136
|
+
context.status = "requires_workspace_name";
|
|
5137
|
+
context.workspace_source = "none_found";
|
|
5138
|
+
context.message = `No workspaces found for this account. Ask the user for a name for a new workspace, then create a project for "${folderDisplayName}".`;
|
|
5139
|
+
return context;
|
|
5140
|
+
} catch (e) {
|
|
5141
|
+
context.status = "requires_workspace_selection";
|
|
5142
|
+
context.workspace_error = String(e);
|
|
5143
|
+
context.message = `Unable to resolve a workspace automatically (${String(e)}). Please provide workspace_id, or create one with workspace_bootstrap.`;
|
|
5144
|
+
return context;
|
|
5145
|
+
}
|
|
5146
|
+
}
|
|
5115
5147
|
if (!projectId && workspaceId && rootPath && params.auto_index !== false) {
|
|
5116
5148
|
const projectName = rootPath.split("/").pop() || "My Project";
|
|
5117
5149
|
try {
|
|
@@ -5181,6 +5213,9 @@ var ContextStreamClient = class {
|
|
|
5181
5213
|
context.workspace_name = workspaceName;
|
|
5182
5214
|
context.project_id = projectId;
|
|
5183
5215
|
context.ide_roots = ideRoots;
|
|
5216
|
+
if (!workspaceId) {
|
|
5217
|
+
context.workspace_warning = "No workspace was resolved for this session. Workspace-level tools (memory/search/graph) may not work until you associate this folder with a workspace.";
|
|
5218
|
+
}
|
|
5184
5219
|
if (workspaceId) {
|
|
5185
5220
|
try {
|
|
5186
5221
|
const batchedContext = await this._fetchSessionContextBatched({
|
|
@@ -7495,7 +7530,8 @@ This does semantic search on the first message. You only need context_smart on s
|
|
|
7495
7530
|
context_hint: external_exports.string().optional().describe("RECOMMENDED: Pass the user's first message here for semantic search. This finds relevant context from ANY time, not just recent items."),
|
|
7496
7531
|
include_recent_memory: external_exports.boolean().optional().describe("Include recent memory events (default: true)"),
|
|
7497
7532
|
include_decisions: external_exports.boolean().optional().describe("Include recent decisions (default: true)"),
|
|
7498
|
-
auto_index: external_exports.boolean().optional().describe("Automatically create and index project from IDE workspace (default: true)")
|
|
7533
|
+
auto_index: external_exports.boolean().optional().describe("Automatically create and index project from IDE workspace (default: true)"),
|
|
7534
|
+
allow_no_workspace: external_exports.boolean().optional().describe("If true, allow session_init to return connected even if no workspace is resolved (workspace-level tools may not work).")
|
|
7499
7535
|
})
|
|
7500
7536
|
},
|
|
7501
7537
|
async (input) => {
|
|
@@ -7514,7 +7550,56 @@ This does semantic search on the first message. You only need context_smart on s
|
|
|
7514
7550
|
if (sessionManager) {
|
|
7515
7551
|
sessionManager.markInitialized(result);
|
|
7516
7552
|
}
|
|
7517
|
-
|
|
7553
|
+
const status = typeof result.status === "string" ? result.status : "";
|
|
7554
|
+
const workspaceWarning = typeof result.workspace_warning === "string" ? result.workspace_warning : "";
|
|
7555
|
+
let text = formatContent(result);
|
|
7556
|
+
if (status === "requires_workspace_name") {
|
|
7557
|
+
const folderPath = typeof result.folder_path === "string" ? result.folder_path : typeof input.folder_path === "string" ? input.folder_path : "";
|
|
7558
|
+
text = [
|
|
7559
|
+
"Action required: no workspaces found for this account.",
|
|
7560
|
+
"Ask the user for a name for the new workspace (recommended), then run `workspace_bootstrap`.",
|
|
7561
|
+
folderPath ? `Recommended: workspace_bootstrap(workspace_name: "<name>", folder_path: "${folderPath}")` : 'Recommended: workspace_bootstrap(workspace_name: "<name>", folder_path: "<your repo folder>")',
|
|
7562
|
+
"",
|
|
7563
|
+
"If you want to continue without a workspace for now, re-run:",
|
|
7564
|
+
folderPath ? ` session_init(folder_path: "${folderPath}", allow_no_workspace: true)` : ' session_init(folder_path: "<your repo folder>", allow_no_workspace: true)',
|
|
7565
|
+
"",
|
|
7566
|
+
"--- Raw Response ---",
|
|
7567
|
+
"",
|
|
7568
|
+
formatContent(result)
|
|
7569
|
+
].join("\n");
|
|
7570
|
+
} else if (status === "requires_workspace_selection") {
|
|
7571
|
+
const folderName = typeof result.folder_name === "string" ? result.folder_name : typeof input.folder_path === "string" ? input.folder_path.split("/").pop() || "this folder" : "this folder";
|
|
7572
|
+
const candidates = Array.isArray(result.workspace_candidates) ? result.workspace_candidates : [];
|
|
7573
|
+
const lines = [];
|
|
7574
|
+
lines.push(`Action required: select a workspace for "${folderName}" (or create a new one).`);
|
|
7575
|
+
if (candidates.length > 0) {
|
|
7576
|
+
lines.push("");
|
|
7577
|
+
lines.push("Available workspaces:");
|
|
7578
|
+
candidates.slice(0, 25).forEach((w, i) => {
|
|
7579
|
+
const name = w.name || "Untitled";
|
|
7580
|
+
const id = w.id ? ` (${w.id})` : "";
|
|
7581
|
+
const desc = w.description ? ` - ${w.description}` : "";
|
|
7582
|
+
lines.push(` ${i + 1}. ${name}${id}${desc}`);
|
|
7583
|
+
});
|
|
7584
|
+
}
|
|
7585
|
+
lines.push("");
|
|
7586
|
+
lines.push("Then run `workspace_associate` with the selected workspace_id and your folder_path.");
|
|
7587
|
+
lines.push("");
|
|
7588
|
+
lines.push("If you want to continue without a workspace for now, re-run:");
|
|
7589
|
+
if (typeof input.folder_path === "string" && input.folder_path) {
|
|
7590
|
+
lines.push(` session_init(folder_path: "${input.folder_path}", allow_no_workspace: true)`);
|
|
7591
|
+
} else {
|
|
7592
|
+
lines.push(' session_init(folder_path: "<your repo folder>", allow_no_workspace: true)');
|
|
7593
|
+
}
|
|
7594
|
+
lines.push("");
|
|
7595
|
+
lines.push("--- Raw Response ---");
|
|
7596
|
+
lines.push("");
|
|
7597
|
+
lines.push(formatContent(result));
|
|
7598
|
+
text = lines.join("\n");
|
|
7599
|
+
} else if (workspaceWarning) {
|
|
7600
|
+
text = [`Warning: ${workspaceWarning}`, "", formatContent(result)].join("\n");
|
|
7601
|
+
}
|
|
7602
|
+
return { content: [{ type: "text", text }], structuredContent: toStructured(result) };
|
|
7518
7603
|
}
|
|
7519
7604
|
);
|
|
7520
7605
|
registerTool(
|
|
@@ -9338,7 +9423,7 @@ var SessionManager = class {
|
|
|
9338
9423
|
parts.push("\u26A0\uFE0F NO WORKSPACE FOUND");
|
|
9339
9424
|
parts.push(`Folder: ${context.folder_name || "unknown"}`);
|
|
9340
9425
|
parts.push("");
|
|
9341
|
-
parts.push("Please ask the user for a name for the new workspace.");
|
|
9426
|
+
parts.push("Please ask the user for a name for the new workspace (recommended).");
|
|
9342
9427
|
parts.push("Then create a project for this folder.");
|
|
9343
9428
|
parts.push("");
|
|
9344
9429
|
parts.push("Recommended: call `workspace_bootstrap` with:");
|
|
@@ -9349,6 +9434,9 @@ var SessionManager = class {
|
|
|
9349
9434
|
}
|
|
9350
9435
|
parts.push(' - workspace_name: "<user-provided name>"');
|
|
9351
9436
|
parts.push("");
|
|
9437
|
+
parts.push("To continue without a workspace for now:");
|
|
9438
|
+
parts.push(" - call `session_init` again with `allow_no_workspace: true`");
|
|
9439
|
+
parts.push("");
|
|
9352
9440
|
parts.push("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
9353
9441
|
return parts.join("\n");
|
|
9354
9442
|
}
|
|
@@ -9367,6 +9455,9 @@ var SessionManager = class {
|
|
|
9367
9455
|
parts.push(" \u2022 Or create a new workspace");
|
|
9368
9456
|
parts.push("");
|
|
9369
9457
|
parts.push("Use workspace_associate tool after user selects.");
|
|
9458
|
+
parts.push("");
|
|
9459
|
+
parts.push("To continue without a workspace for now:");
|
|
9460
|
+
parts.push(" - call `session_init` again with `allow_no_workspace: true`");
|
|
9370
9461
|
parts.push("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
9371
9462
|
return parts.join("\n");
|
|
9372
9463
|
}
|
package/package.json
CHANGED