@contextstream/mcp-server 0.3.5 → 0.3.6

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 +43 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4595,18 +4595,42 @@ var ContextStreamClient = class {
4595
4595
  uuidSchema.parse(projectId);
4596
4596
  return request(this.config, `/projects/${projectId}/index`, { body: {} });
4597
4597
  }
4598
- // Search
4598
+ // Search - each method adds required search_type and filters fields
4599
4599
  searchSemantic(body) {
4600
- return request(this.config, "/search/semantic", { body: this.withDefaults(body) });
4600
+ return request(this.config, "/search/semantic", {
4601
+ body: {
4602
+ ...this.withDefaults(body),
4603
+ search_type: "semantic",
4604
+ filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
4605
+ }
4606
+ });
4601
4607
  }
4602
4608
  searchHybrid(body) {
4603
- return request(this.config, "/search/hybrid", { body: this.withDefaults(body) });
4609
+ return request(this.config, "/search/hybrid", {
4610
+ body: {
4611
+ ...this.withDefaults(body),
4612
+ search_type: "hybrid",
4613
+ filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
4614
+ }
4615
+ });
4604
4616
  }
4605
4617
  searchKeyword(body) {
4606
- return request(this.config, "/search/keyword", { body: this.withDefaults(body) });
4618
+ return request(this.config, "/search/keyword", {
4619
+ body: {
4620
+ ...this.withDefaults(body),
4621
+ search_type: "keyword",
4622
+ filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
4623
+ }
4624
+ });
4607
4625
  }
4608
4626
  searchPattern(body) {
4609
- return request(this.config, "/search/pattern", { body: this.withDefaults(body) });
4627
+ return request(this.config, "/search/pattern", {
4628
+ body: {
4629
+ ...this.withDefaults(body),
4630
+ search_type: "pattern",
4631
+ filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
4632
+ }
4633
+ });
4610
4634
  }
4611
4635
  // Memory / Knowledge
4612
4636
  createMemoryEvent(body) {
@@ -5408,10 +5432,23 @@ function registerTools(server, client, sessionManager) {
5408
5432
  };
5409
5433
  }
5410
5434
  function registerTool(name, config, handler) {
5435
+ const safeHandler = async (input) => {
5436
+ try {
5437
+ return await handler(input);
5438
+ } catch (error) {
5439
+ const errorMessage = error?.message || String(error);
5440
+ const errorDetails = error?.body || error?.details || null;
5441
+ const errorCode = error?.code || error?.status || "UNKNOWN_ERROR";
5442
+ const serializedError = new Error(
5443
+ `[${errorCode}] ${errorMessage}${errorDetails ? `: ${JSON.stringify(errorDetails)}` : ""}`
5444
+ );
5445
+ throw serializedError;
5446
+ }
5447
+ };
5411
5448
  server.registerTool(
5412
5449
  name,
5413
5450
  config,
5414
- wrapWithAutoContext(name, handler)
5451
+ wrapWithAutoContext(name, safeHandler)
5415
5452
  );
5416
5453
  }
5417
5454
  registerTool(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
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",