@contextstream/mcp-server 0.3.46 → 0.3.47

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 +28 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4775,10 +4775,12 @@ var ContextStreamClient = class {
4775
4775
  }
4776
4776
  withDefaults(input) {
4777
4777
  const { defaultWorkspaceId, defaultProjectId } = this.config;
4778
+ const workspaceId = input.workspace_id || defaultWorkspaceId;
4779
+ const useDefaultProject = !input.project_id && (!input.workspace_id || input.workspace_id === defaultWorkspaceId);
4778
4780
  return {
4779
4781
  ...input,
4780
- workspace_id: input.workspace_id || defaultWorkspaceId,
4781
- project_id: input.project_id || defaultProjectId
4782
+ workspace_id: workspaceId,
4783
+ project_id: input.project_id || (useDefaultProject ? defaultProjectId : void 0)
4782
4784
  };
4783
4785
  }
4784
4786
  coerceUuid(value) {
@@ -5626,6 +5628,29 @@ var ContextStreamClient = class {
5626
5628
  });
5627
5629
  if (batchedContext.workspace) {
5628
5630
  context.workspace = batchedContext.workspace;
5631
+ if (batchedContext.workspace.id && batchedContext.workspace.id !== workspaceId) {
5632
+ console.error(`[ContextStream] Workspace mismatch: config=${workspaceId}, API returned=${batchedContext.workspace.id}. Using API workspace.`);
5633
+ const oldWorkspaceId = workspaceId;
5634
+ workspaceId = batchedContext.workspace.id;
5635
+ workspaceName = batchedContext.workspace.name;
5636
+ context.workspace_id = workspaceId;
5637
+ context.workspace_name = workspaceName;
5638
+ context.workspace_source = "api_fallback";
5639
+ context.workspace_mismatch_warning = `Config had workspace ${oldWorkspaceId} but you don't have access. Using ${workspaceId} instead.`;
5640
+ projectId = batchedContext.project?.id;
5641
+ context.project_id = projectId;
5642
+ this.config.defaultProjectId = projectId;
5643
+ if (rootPath) {
5644
+ writeLocalConfig(rootPath, {
5645
+ workspace_id: workspaceId,
5646
+ workspace_name: workspaceName,
5647
+ project_id: projectId,
5648
+ // Use API-returned project or undefined
5649
+ associated_at: (/* @__PURE__ */ new Date()).toISOString()
5650
+ });
5651
+ console.error(`[ContextStream] Updated local config with accessible workspace: ${workspaceId}`);
5652
+ }
5653
+ }
5629
5654
  }
5630
5655
  if (batchedContext.project) {
5631
5656
  context.project = batchedContext.project;
@@ -8008,7 +8033,7 @@ Access: Free`,
8008
8033
  }
8009
8034
  }
8010
8035
  const response = {
8011
- ...result,
8036
+ ...result && typeof result === "object" ? result : {},
8012
8037
  folder_path: input.folder_path,
8013
8038
  config_written: input.folder_path ? true : void 0,
8014
8039
  editor_rules_generated: rulesGenerated.length > 0 ? rulesGenerated : void 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
- "version": "0.3.46",
3
+ "version": "0.3.47",
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",