@contextstream/mcp-server 0.4.25 → 0.4.27

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 +91 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5141,6 +5141,7 @@ var ContextStreamClient = class {
5141
5141
  body: {
5142
5142
  ...this.withDefaults(body),
5143
5143
  search_type: "semantic",
5144
+ output_format: body.output_format,
5144
5145
  filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
5145
5146
  }
5146
5147
  });
@@ -5150,6 +5151,7 @@ var ContextStreamClient = class {
5150
5151
  body: {
5151
5152
  ...this.withDefaults(body),
5152
5153
  search_type: "hybrid",
5154
+ output_format: body.output_format,
5153
5155
  filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
5154
5156
  }
5155
5157
  });
@@ -5159,6 +5161,7 @@ var ContextStreamClient = class {
5159
5161
  body: {
5160
5162
  ...this.withDefaults(body),
5161
5163
  search_type: "keyword",
5164
+ output_format: body.output_format,
5162
5165
  filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
5163
5166
  }
5164
5167
  });
@@ -5168,6 +5171,7 @@ var ContextStreamClient = class {
5168
5171
  body: {
5169
5172
  ...this.withDefaults(body),
5170
5173
  search_type: "pattern",
5174
+ output_format: body.output_format,
5171
5175
  filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
5172
5176
  }
5173
5177
  });
@@ -5182,6 +5186,22 @@ var ContextStreamClient = class {
5182
5186
  body: {
5183
5187
  ...this.withDefaults(body),
5184
5188
  search_type: "exhaustive",
5189
+ output_format: body.output_format,
5190
+ filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
5191
+ }
5192
+ });
5193
+ }
5194
+ /**
5195
+ * Refactor search optimized for find-replace operations.
5196
+ * Uses word-boundary matching for precise symbol renaming.
5197
+ * Returns matches grouped by file with line/col positions.
5198
+ */
5199
+ searchRefactor(body) {
5200
+ return request(this.config, "/search/refactor", {
5201
+ body: {
5202
+ ...this.withDefaults(body),
5203
+ search_type: "refactor",
5204
+ output_format: body.output_format,
5185
5205
  filters: body.workspace_id ? {} : { file_types: [], languages: [], file_paths: [], exclude_paths: [], content_types: [], tags: [] }
5186
5206
  }
5187
5207
  });
@@ -7888,6 +7908,18 @@ Only after this preflight, proceed with search/analysis below.
7888
7908
 
7889
7909
  \u26A0\uFE0F **STOP: Before using Search/Glob/Grep/Read/Explore** \u2192 Call \`search(mode="hybrid")\` FIRST. Use local tools ONLY if ContextStream returns 0 results.
7890
7910
 
7911
+ **\u274C WRONG workflow (wastes tokens, slow):**
7912
+ \`\`\`
7913
+ Grep "function" \u2192 Read file1.ts \u2192 Read file2.ts \u2192 Read file3.ts \u2192 finally understand
7914
+ \`\`\`
7915
+
7916
+ **\u2705 CORRECT workflow (fast, complete):**
7917
+ \`\`\`
7918
+ search(mode="hybrid", query="function implementation") \u2192 done (results include context)
7919
+ \`\`\`
7920
+
7921
+ **Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.
7922
+
7891
7923
  **Search order:**
7892
7924
  1. \`session(action="smart_search", query="...")\` - context-enriched
7893
7925
  2. \`search(mode="hybrid", query="...", limit=3)\` or \`search(mode="keyword", query="<filename>", limit=3)\`
@@ -7895,6 +7927,23 @@ Only after this preflight, proceed with search/analysis below.
7895
7927
  4. \`graph(action="dependencies", ...)\` - code structure
7896
7928
  5. Local repo scans (rg/ls/find) - ONLY if ContextStream returns no results, errors, or the user explicitly asks
7897
7929
 
7930
+ **Search Mode Selection:**
7931
+
7932
+ | Need | Mode | Example |
7933
+ |------|------|---------|
7934
+ | Find code by meaning | \`hybrid\` | "authentication logic", "error handling" |
7935
+ | Exact string/symbol | \`keyword\` | "UserAuthService", "API_KEY" |
7936
+ | File patterns | \`pattern\` | "*.sql", "test_*.py" |
7937
+ | ALL matches (grep-like) | \`exhaustive\` | "TODO", "FIXME" (find all occurrences) |
7938
+ | Symbol renaming | \`refactor\` | "oldFunctionName" (word-boundary matching) |
7939
+ | Conceptual search | \`semantic\` | "how does caching work" |
7940
+
7941
+ **Token Efficiency:** Use \`output_format\` to reduce response size:
7942
+ - \`full\` (default): Full content for understanding code
7943
+ - \`paths\`: File paths only (80% token savings) - use for file listings
7944
+ - \`minimal\`: Compact format (60% savings) - use for refactoring
7945
+ - \`count\`: Match counts only (90% savings) - use for quick checks
7946
+
7898
7947
  **Search defaults:** \`search\` returns the top 3 results with compact snippets. Use \`limit\` + \`offset\` for pagination, and \`content_max_chars\` to expand snippets when needed.
7899
7948
 
7900
7949
  If ContextStream returns results, stop and use them. NEVER use local Search/Explore/Read unless you need exact code edits or ContextStream returned 0 results.
@@ -8010,6 +8059,18 @@ Rules Version: ${RULES_VERSION}
8010
8059
 
8011
8060
  \u26A0\uFE0F **STOP: Before using Search/Glob/Grep/Read/Explore** \u2192 Call \`search(mode="hybrid")\` FIRST. Use local tools ONLY if ContextStream returns 0 results.
8012
8061
 
8062
+ **\u274C WRONG workflow (wastes tokens, slow):**
8063
+ \`\`\`
8064
+ Grep "function" \u2192 Read file1.ts \u2192 Read file2.ts \u2192 Read file3.ts \u2192 finally understand
8065
+ \`\`\`
8066
+
8067
+ **\u2705 CORRECT workflow (fast, complete):**
8068
+ \`\`\`
8069
+ search(mode="hybrid", query="function implementation") \u2192 done (results include context)
8070
+ \`\`\`
8071
+
8072
+ **Why?** ContextStream search returns semantic matches + context + file locations in ONE call. Local tools require multiple round-trips.
8073
+
8013
8074
  - **First message**: Call \`session_init\` with context_hint, then call \`context_smart\` before any other tool or response
8014
8075
  - **On [INGEST_RECOMMENDED]**: Ask the user if they want to enable semantic code search. Explain: "Indexing your codebase enables AI-powered code search, dependency analysis, and better context. This takes a few minutes." If user agrees, run the provided \`project(action="ingest_local")\` command.
8015
8076
  - **Every message after**: Always call \`context_smart\` BEFORE responding (semantic search for relevant context)
@@ -8022,6 +8083,25 @@ Rules Version: ${RULES_VERSION}
8022
8083
  - **After completing work**: Always capture decisions/insights with \`session(action="capture")\`
8023
8084
  - **On mistakes/corrections**: Immediately capture lessons with \`session(action="capture_lesson")\`
8024
8085
 
8086
+ ### Search Mode Selection
8087
+
8088
+ | Need | Mode | Example |
8089
+ |------|------|---------|
8090
+ | Find code by meaning | \`hybrid\` | "authentication logic", "error handling" |
8091
+ | Exact string/symbol | \`keyword\` | "UserAuthService", "API_KEY" |
8092
+ | File patterns | \`pattern\` | "*.sql", "test_*.py" |
8093
+ | ALL matches (grep-like) | \`exhaustive\` | "TODO", "FIXME" (find all occurrences) |
8094
+ | Symbol renaming | \`refactor\` | "oldFunctionName" (word-boundary matching) |
8095
+ | Conceptual search | \`semantic\` | "how does caching work" |
8096
+
8097
+ ### Token Efficiency
8098
+
8099
+ Use \`output_format\` to reduce response size:
8100
+ - \`full\` (default): Full content for understanding code
8101
+ - \`paths\`: File paths only (80% token savings) - use for file listings
8102
+ - \`minimal\`: Compact format (60% savings) - use for refactoring
8103
+ - \`count\`: Match counts only (90% savings) - use for quick checks
8104
+
8025
8105
  ### Plans & Tasks
8026
8106
 
8027
8107
  When user asks to create a plan or implementation roadmap:
@@ -10604,7 +10684,8 @@ Access: Free`,
10604
10684
  offset,
10605
10685
  content_max_chars: contentMax,
10606
10686
  context_lines: contextLines,
10607
- exact_match_boost: exactMatchBoost
10687
+ exact_match_boost: exactMatchBoost,
10688
+ output_format: input.output_format
10608
10689
  };
10609
10690
  }
10610
10691
  registerTool(
@@ -13432,9 +13513,11 @@ Use this to remove a reminder that is no longer relevant.`,
13432
13513
  "search",
13433
13514
  {
13434
13515
  title: "Search",
13435
- description: `Search workspace memory and knowledge. Modes: semantic (meaning-based), hybrid (semantic + keyword), keyword (exact match), pattern (regex), exhaustive (all matches like grep).`,
13516
+ description: `Search workspace memory and knowledge. Modes: semantic (meaning-based), hybrid (semantic + keyword), keyword (exact match), pattern (regex), exhaustive (all matches like grep), refactor (word-boundary matching for symbol renaming).
13517
+
13518
+ Output formats: full (default, includes content), paths (file paths only - 80% token savings), minimal (compact - 60% savings), count (match counts only - 90% savings).`,
13436
13519
  inputSchema: external_exports.object({
13437
- mode: external_exports.enum(["semantic", "hybrid", "keyword", "pattern", "exhaustive"]).describe("Search mode"),
13520
+ mode: external_exports.enum(["semantic", "hybrid", "keyword", "pattern", "exhaustive", "refactor"]).describe("Search mode"),
13438
13521
  query: external_exports.string().describe("Search query"),
13439
13522
  workspace_id: external_exports.string().uuid().optional(),
13440
13523
  project_id: external_exports.string().uuid().optional(),
@@ -13442,7 +13525,8 @@ Use this to remove a reminder that is no longer relevant.`,
13442
13525
  offset: external_exports.number().optional().describe("Offset for pagination"),
13443
13526
  content_max_chars: external_exports.number().optional().describe("Max chars per result content (default: 400)"),
13444
13527
  context_lines: external_exports.number().min(0).max(10).optional().describe("Lines of context around matches (like grep -C)"),
13445
- exact_match_boost: external_exports.number().min(1).max(10).optional().describe("Boost factor for exact matches (default: 2.0)")
13528
+ exact_match_boost: external_exports.number().min(1).max(10).optional().describe("Boost factor for exact matches (default: 2.0)"),
13529
+ output_format: external_exports.enum(["full", "paths", "minimal", "count"]).optional().describe("Response format: full (default), paths (80% savings), minimal (60% savings), count (90% savings)")
13446
13530
  })
13447
13531
  },
13448
13532
  async (input) => {
@@ -13464,6 +13548,9 @@ Use this to remove a reminder that is no longer relevant.`,
13464
13548
  case "exhaustive":
13465
13549
  result = await client.searchExhaustive(params);
13466
13550
  break;
13551
+ case "refactor":
13552
+ result = await client.searchRefactor(params);
13553
+ break;
13467
13554
  }
13468
13555
  return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
13469
13556
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
3
  "mcpName": "io.github.contextstreamio/mcp-server",
4
- "version": "0.4.25",
4
+ "version": "0.4.27",
5
5
  "description": "ContextStream MCP server - v0.4.x with consolidated domain tools (~11 tools, ~75% token reduction). Code context, memory, search, and AI tools.",
6
6
  "type": "module",
7
7
  "license": "MIT",