@contextstream/mcp-server 0.3.1 → 0.3.3

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 +50 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6379,16 +6379,47 @@ var SessionManager = class {
6379
6379
  return null;
6380
6380
  }
6381
6381
  try {
6382
- const rootsResponse = await this.server.server.listRoots();
6383
- console.error("[ContextStream] listRoots response:", JSON.stringify(rootsResponse));
6384
- if (rootsResponse?.roots) {
6385
- this.ideRoots = rootsResponse.roots.map(
6386
- (r) => r.uri.replace("file://", "")
6387
- );
6388
- console.error("[ContextStream] IDE roots detected:", this.ideRoots);
6382
+ const capabilities = this.server.server.getClientCapabilities();
6383
+ console.error("[ContextStream] Client capabilities:", JSON.stringify(capabilities));
6384
+ if (capabilities?.roots) {
6385
+ const rootsResponse = await this.server.server.listRoots();
6386
+ console.error("[ContextStream] listRoots response:", JSON.stringify(rootsResponse));
6387
+ if (rootsResponse?.roots) {
6388
+ this.ideRoots = rootsResponse.roots.map(
6389
+ (r) => r.uri.replace("file://", "")
6390
+ );
6391
+ console.error("[ContextStream] IDE roots detected via listRoots:", this.ideRoots);
6392
+ }
6393
+ } else {
6394
+ console.error("[ContextStream] Client does not support roots capability");
6389
6395
  }
6390
6396
  } catch (e) {
6391
- console.error("[ContextStream] listRoots not available:", e?.message || e);
6397
+ console.error("[ContextStream] listRoots failed:", e?.message || e);
6398
+ }
6399
+ if (this.ideRoots.length === 0) {
6400
+ const envWorkspace = process.env.WORKSPACE_FOLDER || process.env.VSCODE_WORKSPACE_FOLDER || process.env.PROJECT_DIR || process.env.PWD;
6401
+ if (envWorkspace && envWorkspace !== process.env.HOME) {
6402
+ console.error("[ContextStream] Using workspace from env:", envWorkspace);
6403
+ this.ideRoots = [envWorkspace];
6404
+ }
6405
+ }
6406
+ if (this.ideRoots.length === 0) {
6407
+ const cwd = process.cwd();
6408
+ const fs3 = await import("fs");
6409
+ const projectIndicators = [".git", "package.json", "Cargo.toml", "pyproject.toml", ".contextstream"];
6410
+ const hasProjectIndicator = projectIndicators.some((f) => {
6411
+ try {
6412
+ return fs3.existsSync(`${cwd}/${f}`);
6413
+ } catch {
6414
+ return false;
6415
+ }
6416
+ });
6417
+ if (hasProjectIndicator) {
6418
+ console.error("[ContextStream] Using cwd as workspace:", cwd);
6419
+ this.ideRoots = [cwd];
6420
+ } else {
6421
+ console.error("[ContextStream] cwd does not look like a project:", cwd);
6422
+ }
6392
6423
  }
6393
6424
  if (this.ideRoots.length === 0 && this.folderPath) {
6394
6425
  this.ideRoots = [this.folderPath];
@@ -6455,6 +6486,9 @@ var SessionManager = class {
6455
6486
  }
6456
6487
  if (context.workspace_name) {
6457
6488
  parts.push(`\u{1F4C1} Workspace: ${context.workspace_name}`);
6489
+ if (context.workspace_source) {
6490
+ parts.push(` (resolved via: ${context.workspace_source})`);
6491
+ }
6458
6492
  if (context.workspace_created) {
6459
6493
  parts.push(" (auto-created for this folder)");
6460
6494
  }
@@ -6488,10 +6522,15 @@ var SessionManager = class {
6488
6522
  parts.push(` \u2022 [${type}] ${title}`);
6489
6523
  });
6490
6524
  }
6525
+ parts.push("");
6491
6526
  if (context.ide_roots && context.ide_roots.length > 0) {
6492
6527
  const roots = context.ide_roots;
6493
- parts.push("");
6494
- parts.push(`\u{1F5A5}\uFE0F IDE Roots: ${roots.map((r) => r.split("/").pop()).join(", ")}`);
6528
+ parts.push(`\u{1F5A5}\uFE0F IDE Roots: ${roots.join(", ")}`);
6529
+ } else {
6530
+ parts.push(`\u{1F5A5}\uFE0F IDE Roots: (none detected)`);
6531
+ }
6532
+ if (this.ideRoots.length > 0) {
6533
+ parts.push(` Detection: ${this.ideRoots[0]}`);
6495
6534
  }
6496
6535
  parts.push("");
6497
6536
  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");
@@ -6508,7 +6547,7 @@ async function main() {
6508
6547
  const client = new ContextStreamClient(config);
6509
6548
  const server = new McpServer({
6510
6549
  name: "contextstream-mcp",
6511
- version: "0.3.1"
6550
+ version: "0.3.3"
6512
6551
  });
6513
6552
  const sessionManager = new SessionManager(server, client);
6514
6553
  registerTools(server, client, sessionManager);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "MCP server exposing ContextStream public API - code context, memory, search, and AI tools for developers",
5
5
  "type": "module",
6
6
  "license": "MIT",