@contextstream/mcp-server 0.3.6 → 0.3.7

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 +73 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4634,7 +4634,14 @@ var ContextStreamClient = class {
4634
4634
  }
4635
4635
  // Memory / Knowledge
4636
4636
  createMemoryEvent(body) {
4637
- return request(this.config, "/memory/events", { body: this.withDefaults(body) });
4637
+ const withDefaults = this.withDefaults(body);
4638
+ if (!withDefaults.workspace_id) {
4639
+ throw new Error("workspace_id is required for creating memory events. Set defaultWorkspaceId in config or provide workspace_id.");
4640
+ }
4641
+ if (!body.content || body.content.trim().length === 0) {
4642
+ throw new Error("content is required and cannot be empty");
4643
+ }
4644
+ return request(this.config, "/memory/events", { body: withDefaults });
4638
4645
  }
4639
4646
  bulkIngestEvents(body) {
4640
4647
  return request(this.config, "/memory/events/ingest", { body: this.withDefaults(body) });
@@ -6340,7 +6347,29 @@ Use this to persist decisions, insights, preferences, or important information.`
6340
6347
  })
6341
6348
  },
6342
6349
  async (input) => {
6343
- const result = await client.captureContext(input);
6350
+ let workspaceId = input.workspace_id;
6351
+ let projectId = input.project_id;
6352
+ if (!workspaceId && sessionManager) {
6353
+ const ctx = sessionManager.getContext();
6354
+ if (ctx) {
6355
+ workspaceId = ctx.workspace_id;
6356
+ projectId = projectId || ctx.project_id;
6357
+ }
6358
+ }
6359
+ if (!workspaceId) {
6360
+ return {
6361
+ content: [{
6362
+ type: "text",
6363
+ text: "Error: workspace_id is required. Please call session_init first or provide workspace_id explicitly."
6364
+ }],
6365
+ isError: true
6366
+ };
6367
+ }
6368
+ const result = await client.captureContext({
6369
+ ...input,
6370
+ workspace_id: workspaceId,
6371
+ project_id: projectId
6372
+ });
6344
6373
  return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
6345
6374
  }
6346
6375
  );
@@ -6359,7 +6388,20 @@ Returns memory matches, relevant code, and related decisions in one call.`,
6359
6388
  })
6360
6389
  },
6361
6390
  async (input) => {
6362
- const result = await client.smartSearch(input);
6391
+ let workspaceId = input.workspace_id;
6392
+ let projectId = input.project_id;
6393
+ if (!workspaceId && sessionManager) {
6394
+ const ctx = sessionManager.getContext();
6395
+ if (ctx) {
6396
+ workspaceId = ctx.workspace_id;
6397
+ projectId = projectId || ctx.project_id;
6398
+ }
6399
+ }
6400
+ const result = await client.smartSearch({
6401
+ ...input,
6402
+ workspace_id: workspaceId,
6403
+ project_id: projectId
6404
+ });
6363
6405
  return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
6364
6406
  }
6365
6407
  );
@@ -6377,6 +6419,21 @@ Example: "Remember that I prefer TypeScript strict mode" or "Remember we decided
6377
6419
  })
6378
6420
  },
6379
6421
  async (input) => {
6422
+ let workspaceId = input.workspace_id;
6423
+ let projectId = input.project_id;
6424
+ if (!workspaceId && sessionManager) {
6425
+ const ctx = sessionManager.getContext();
6426
+ if (ctx) {
6427
+ workspaceId = ctx.workspace_id;
6428
+ projectId = projectId || ctx.project_id;
6429
+ }
6430
+ }
6431
+ if (!workspaceId) {
6432
+ return {
6433
+ content: [{ type: "text", text: "Error: workspace_id is required. Please call session_init first." }],
6434
+ isError: true
6435
+ };
6436
+ }
6380
6437
  const lowerContent = input.content.toLowerCase();
6381
6438
  let eventType = "insight";
6382
6439
  if (lowerContent.includes("prefer") || lowerContent.includes("like") || lowerContent.includes("always")) {
@@ -6387,8 +6444,8 @@ Example: "Remember that I prefer TypeScript strict mode" or "Remember we decided
6387
6444
  eventType = "task";
6388
6445
  }
6389
6446
  const result = await client.captureContext({
6390
- workspace_id: input.workspace_id,
6391
- project_id: input.project_id,
6447
+ workspace_id: workspaceId,
6448
+ project_id: projectId,
6392
6449
  event_type: eventType,
6393
6450
  title: input.content.slice(0, 100),
6394
6451
  content: input.content,
@@ -6410,10 +6467,19 @@ Example: "What were the auth decisions?" or "What are my TypeScript preferences?
6410
6467
  })
6411
6468
  },
6412
6469
  async (input) => {
6470
+ let workspaceId = input.workspace_id;
6471
+ let projectId = input.project_id;
6472
+ if (!workspaceId && sessionManager) {
6473
+ const ctx = sessionManager.getContext();
6474
+ if (ctx) {
6475
+ workspaceId = ctx.workspace_id;
6476
+ projectId = projectId || ctx.project_id;
6477
+ }
6478
+ }
6413
6479
  const result = await client.smartSearch({
6414
6480
  query: input.query,
6415
- workspace_id: input.workspace_id,
6416
- project_id: input.project_id,
6481
+ workspace_id: workspaceId,
6482
+ project_id: projectId,
6417
6483
  include_decisions: true
6418
6484
  });
6419
6485
  return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
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",