@contextstream/mcp-server 0.3.2 → 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 +45 -12
  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];
@@ -6491,13 +6522,15 @@ var SessionManager = class {
6491
6522
  parts.push(` \u2022 [${type}] ${title}`);
6492
6523
  });
6493
6524
  }
6525
+ parts.push("");
6494
6526
  if (context.ide_roots && context.ide_roots.length > 0) {
6495
6527
  const roots = context.ide_roots;
6496
- parts.push("");
6497
6528
  parts.push(`\u{1F5A5}\uFE0F IDE Roots: ${roots.join(", ")}`);
6498
6529
  } else {
6499
- parts.push("");
6500
- parts.push(`\u{1F5A5}\uFE0F IDE Roots: (none detected - used fallback)`);
6530
+ parts.push(`\u{1F5A5}\uFE0F IDE Roots: (none detected)`);
6531
+ }
6532
+ if (this.ideRoots.length > 0) {
6533
+ parts.push(` Detection: ${this.ideRoots[0]}`);
6501
6534
  }
6502
6535
  parts.push("");
6503
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");
@@ -6514,7 +6547,7 @@ async function main() {
6514
6547
  const client = new ContextStreamClient(config);
6515
6548
  const server = new McpServer({
6516
6549
  name: "contextstream-mcp",
6517
- version: "0.3.2"
6550
+ version: "0.3.3"
6518
6551
  });
6519
6552
  const sessionManager = new SessionManager(server, client);
6520
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.2",
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",