@contextstream/mcp-server 0.3.59 → 0.3.62

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 +179 -11
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -7426,9 +7426,11 @@ If context still feels missing, increase \`max_tokens\` and/or call \`session_re
7426
7426
 
7427
7427
  ### Search, Graphs, and Code Intelligence (ContextStream-first)
7428
7428
 
7429
+ - Default order: \`session_smart_search\` -> \`search_hybrid\`/\`search_keyword\`/\`search_semantic\` -> graph tools -> local repo scans (rg/ls/find) only if ContextStream returns no results.
7429
7430
  - Use \`session_smart_search\` before scanning the repo or grepping.
7430
7431
  - Use \`search_semantic\`/\`search_hybrid\`/\`search_keyword\` for targeted queries.
7431
7432
  - For dependencies/impact/call paths, use \`graph_dependencies\`, \`graph_impact\`, and \`graph_call_path\`.
7433
+ - If the toolset is complete (Elite), prefer \`graph_call_path\` and \`graph_path\` for call relationships instead of manual searches.
7432
7434
  - If the graph is missing or stale, run \`graph_ingest\` (async by default with \`wait: false\`). Tell the user it can take a few minutes; optionally call \`projects_statistics\` to estimate time.
7433
7435
 
7434
7436
  ---
@@ -7508,8 +7510,8 @@ var CONTEXTSTREAM_RULES_MINIMAL = `
7508
7510
  - Every user message: \`context_smart(user_message="<user_message>", format="minified", max_tokens=400)\` BEFORE answering.
7509
7511
  - Use \`max_tokens=200\` for trivial/local edits, \`max_tokens=800\` for deep debugging/architecture.
7510
7512
  - Before risky/non-trivial work: check \`session_get_lessons(query="<topic>")\`; use \`session_get_user_context\` when preferences/style matter.
7511
- - For discovery: use \`session_smart_search\` first; use \`search_semantic\`/\`search_hybrid\`/\`search_keyword\` for targeted lookups.
7512
- - For code intelligence: use \`graph_dependencies\`/\`graph_impact\`/\`graph_call_path\`; run \`graph_ingest\` if the graph is missing (async by default, can take a few minutes).
7513
+ - For discovery: use \`session_smart_search\` first; use \`search_semantic\`/\`search_hybrid\`/\`search_keyword\` for targeted lookups; avoid local scans until ContextStream returns no results.
7514
+ - For code intelligence: use \`graph_dependencies\`/\`graph_impact\`/\`graph_call_path\`; if the toolset is complete (Elite), prefer \`graph_call_path\`/\`graph_path\` for call relationships; run \`graph_ingest\` if the graph is missing (async by default, can take a few minutes).
7513
7515
  - For distillation: use \`session_summary\` for quick context; use \`session_compress\` for long chats; use \`memory_summary\` or \`memory_distill_event\` to condense memory.
7514
7516
  - After meaningful work/decisions/preferences: \`session_capture(event_type=decision|preference|task|insight, title="...", content="...")\`.
7515
7517
  - On frustration/corrections/tool mistakes: \`session_capture_lesson(...)\`.
@@ -11580,6 +11582,136 @@ function globalRulesPathForEditor(editor) {
11580
11582
  return null;
11581
11583
  }
11582
11584
  }
11585
+ async function anyPathExists(paths) {
11586
+ for (const candidate of paths) {
11587
+ if (await fileExists(candidate)) return true;
11588
+ }
11589
+ return false;
11590
+ }
11591
+ async function isCodexInstalled() {
11592
+ const home = homedir3();
11593
+ const envHome = process.env.CODEX_HOME;
11594
+ const candidates = [
11595
+ envHome,
11596
+ path6.join(home, ".codex"),
11597
+ path6.join(home, ".codex", "config.toml"),
11598
+ path6.join(home, ".config", "codex")
11599
+ ].filter((candidate) => Boolean(candidate));
11600
+ return anyPathExists(candidates);
11601
+ }
11602
+ async function isClaudeInstalled() {
11603
+ const home = homedir3();
11604
+ const candidates = [
11605
+ path6.join(home, ".claude"),
11606
+ path6.join(home, ".config", "claude")
11607
+ ];
11608
+ const desktopConfig = claudeDesktopConfigPath();
11609
+ if (desktopConfig) candidates.push(desktopConfig);
11610
+ if (process.platform === "darwin") {
11611
+ candidates.push(path6.join(home, "Library", "Application Support", "Claude"));
11612
+ } else if (process.platform === "win32") {
11613
+ const appData = process.env.APPDATA;
11614
+ if (appData) candidates.push(path6.join(appData, "Claude"));
11615
+ }
11616
+ return anyPathExists(candidates);
11617
+ }
11618
+ async function isWindsurfInstalled() {
11619
+ const home = homedir3();
11620
+ const candidates = [
11621
+ path6.join(home, ".codeium"),
11622
+ path6.join(home, ".codeium", "windsurf"),
11623
+ path6.join(home, ".config", "codeium")
11624
+ ];
11625
+ if (process.platform === "darwin") {
11626
+ candidates.push(path6.join(home, "Library", "Application Support", "Windsurf"));
11627
+ candidates.push(path6.join(home, "Library", "Application Support", "Codeium"));
11628
+ } else if (process.platform === "win32") {
11629
+ const appData = process.env.APPDATA;
11630
+ if (appData) {
11631
+ candidates.push(path6.join(appData, "Windsurf"));
11632
+ candidates.push(path6.join(appData, "Codeium"));
11633
+ }
11634
+ }
11635
+ return anyPathExists(candidates);
11636
+ }
11637
+ async function isClineInstalled() {
11638
+ const home = homedir3();
11639
+ const candidates = [
11640
+ path6.join(home, "Documents", "Cline"),
11641
+ path6.join(home, ".cline"),
11642
+ path6.join(home, ".config", "cline")
11643
+ ];
11644
+ return anyPathExists(candidates);
11645
+ }
11646
+ async function isKiloInstalled() {
11647
+ const home = homedir3();
11648
+ const candidates = [
11649
+ path6.join(home, ".kilocode"),
11650
+ path6.join(home, ".config", "kilocode")
11651
+ ];
11652
+ return anyPathExists(candidates);
11653
+ }
11654
+ async function isRooInstalled() {
11655
+ const home = homedir3();
11656
+ const candidates = [
11657
+ path6.join(home, ".roo"),
11658
+ path6.join(home, ".config", "roo")
11659
+ ];
11660
+ return anyPathExists(candidates);
11661
+ }
11662
+ async function isAiderInstalled() {
11663
+ const home = homedir3();
11664
+ const candidates = [
11665
+ path6.join(home, ".aider.conf.yml"),
11666
+ path6.join(home, ".config", "aider")
11667
+ ];
11668
+ return anyPathExists(candidates);
11669
+ }
11670
+ async function isCursorInstalled() {
11671
+ const home = homedir3();
11672
+ const candidates = [path6.join(home, ".cursor")];
11673
+ if (process.platform === "darwin") {
11674
+ candidates.push("/Applications/Cursor.app");
11675
+ candidates.push(path6.join(home, "Applications", "Cursor.app"));
11676
+ candidates.push(path6.join(home, "Library", "Application Support", "Cursor"));
11677
+ } else if (process.platform === "win32") {
11678
+ const localApp = process.env.LOCALAPPDATA;
11679
+ const programFiles = process.env.ProgramFiles;
11680
+ const programFilesX86 = process.env["ProgramFiles(x86)"];
11681
+ if (localApp) candidates.push(path6.join(localApp, "Programs", "Cursor", "Cursor.exe"));
11682
+ if (localApp) candidates.push(path6.join(localApp, "Cursor", "Cursor.exe"));
11683
+ if (programFiles) candidates.push(path6.join(programFiles, "Cursor", "Cursor.exe"));
11684
+ if (programFilesX86) candidates.push(path6.join(programFilesX86, "Cursor", "Cursor.exe"));
11685
+ } else {
11686
+ candidates.push("/usr/bin/cursor");
11687
+ candidates.push("/usr/local/bin/cursor");
11688
+ candidates.push("/opt/Cursor");
11689
+ candidates.push("/opt/cursor");
11690
+ }
11691
+ return anyPathExists(candidates);
11692
+ }
11693
+ async function isEditorInstalled(editor) {
11694
+ switch (editor) {
11695
+ case "codex":
11696
+ return isCodexInstalled();
11697
+ case "claude":
11698
+ return isClaudeInstalled();
11699
+ case "cursor":
11700
+ return isCursorInstalled();
11701
+ case "windsurf":
11702
+ return isWindsurfInstalled();
11703
+ case "cline":
11704
+ return isClineInstalled();
11705
+ case "kilo":
11706
+ return isKiloInstalled();
11707
+ case "roo":
11708
+ return isRooInstalled();
11709
+ case "aider":
11710
+ return isAiderInstalled();
11711
+ default:
11712
+ return false;
11713
+ }
11714
+ }
11583
11715
  function buildContextStreamMcpServer(params) {
11584
11716
  const env = {
11585
11717
  CONTEXTSTREAM_API_URL: params.apiUrl,
@@ -11965,16 +12097,24 @@ Created API key: ${maskedNewKey}
11965
12097
  console.log(" 2) Enhanced \u2014 more guidance + examples (higher token overhead)");
11966
12098
  const modeChoice = normalizeInput(await rl.question("Choose [1/2] (default 1): ")) || "1";
11967
12099
  const mode = modeChoice === "2" ? "full" : "minimal";
12100
+ const detectedPlanName = await client.getPlanName();
12101
+ const detectedGraphTier = await client.getGraphTier();
12102
+ const graphTierLabel = detectedGraphTier === "full" ? "full graph" : detectedGraphTier === "lite" ? "graph-lite" : "none";
12103
+ const planLabel = detectedPlanName ?? "unknown";
12104
+ console.log(`
12105
+ Detected plan: ${planLabel} (graph: ${graphTierLabel})`);
11968
12106
  console.log("\nMCP toolset (which tools to expose to the AI):");
11969
12107
  console.log(" 1) Light \u2014 core session, project, and basic memory/graph tools (~30 tools)");
11970
12108
  console.log(" Best for: faster responses, simpler workflows, resource-constrained environments");
11971
12109
  console.log(" 2) Standard (recommended) \u2014 adds workspace, memory CRUD, graph analysis, search (~50 tools)");
11972
- console.log(" Best for: most users, full development workflow with memory and code analysis");
11973
- console.log(" 3) Complete \u2014 all tools including AI, GitHub, Slack integrations (~86 tools)");
11974
- console.log(" Best for: power users needing integrations and advanced features");
12110
+ console.log(" Best for: most users, full development workflow with memory + code analysis");
12111
+ console.log(" 3) Complete \u2014 all tools including full graph + AI, GitHub, Slack integrations (~86 tools)");
12112
+ console.log(" Best for: Elite users or power users needing full graph + integrations");
11975
12113
  console.log("");
12114
+ console.log(" Tip: Elite users should choose Complete to unlock full graph tools (call path, path, circular, unused).");
11976
12115
  console.log(" Tip: Change later by setting CONTEXTSTREAM_TOOLSET=light|standard|complete");
11977
- const toolsetChoice = normalizeInput(await rl.question("Choose [1/2/3] (default 2): ")) || "2";
12116
+ const toolsetDefault = detectedGraphTier === "full" ? "3" : "2";
12117
+ const toolsetChoice = normalizeInput(await rl.question(`Choose [1/2/3] (default ${toolsetDefault}): `)) || toolsetDefault;
11978
12118
  const toolset = toolsetChoice === "1" ? "light" : toolsetChoice === "3" ? "complete" : "standard";
11979
12119
  const editors = ["codex", "claude", "cursor", "windsurf", "cline", "kilo", "roo", "aider"];
11980
12120
  console.log('\nSelect editors to configure (comma-separated numbers, or "all"):');
@@ -11982,8 +12122,34 @@ Created API key: ${maskedNewKey}
11982
12122
  const selectedRaw = normalizeInput(await rl.question("Editors [all]: ")) || "all";
11983
12123
  const selectedNums = parseNumberList(selectedRaw, editors.length);
11984
12124
  const selectedEditors = selectedNums.length ? selectedNums.map((n) => editors[n - 1]) : editors;
11985
- const hasCodex = selectedEditors.includes("codex");
11986
- const hasProjectMcpEditors = selectedEditors.some((e) => supportsProjectMcpConfig(e));
12125
+ const editorDetected = /* @__PURE__ */ new Map();
12126
+ for (const editor of selectedEditors) {
12127
+ editorDetected.set(editor, await isEditorInstalled(editor));
12128
+ }
12129
+ if (process.env.CODEX_CLI || process.env.CODEX_HOME) {
12130
+ editorDetected.set("codex", true);
12131
+ }
12132
+ const undetectedEditors = selectedEditors.filter((editor) => !editorDetected.get(editor));
12133
+ let allowUndetectedEditors = false;
12134
+ if (undetectedEditors.length) {
12135
+ console.log("\nEditors not detected on this system:");
12136
+ undetectedEditors.forEach((editor) => console.log(`- ${EDITOR_LABELS[editor]}`));
12137
+ console.log('If your editor is installed but not detected, choose "yes" to force config.');
12138
+ const confirm = normalizeInput(await rl.question("Configure these anyway? [y/N]: ")).toLowerCase();
12139
+ allowUndetectedEditors = confirm === "y" || confirm === "yes";
12140
+ }
12141
+ const configuredEditors = allowUndetectedEditors ? selectedEditors : selectedEditors.filter((editor) => editorDetected.get(editor));
12142
+ const skippedEditors = selectedEditors.filter((editor) => !configuredEditors.includes(editor));
12143
+ if (skippedEditors.length) {
12144
+ console.log("\nSkipping editor setup:");
12145
+ skippedEditors.forEach((editor) => console.log(`- ${EDITOR_LABELS[editor]}`));
12146
+ }
12147
+ if (configuredEditors.length) {
12148
+ console.log("\nConfiguring editors:");
12149
+ configuredEditors.forEach((editor) => console.log(`- ${EDITOR_LABELS[editor]}`));
12150
+ }
12151
+ const hasCodex = configuredEditors.includes("codex");
12152
+ const hasProjectMcpEditors = configuredEditors.some((e) => supportsProjectMcpConfig(e));
11987
12153
  console.log("\nInstall rules as:");
11988
12154
  console.log(" 1) Global");
11989
12155
  console.log(" 2) Project");
@@ -12012,7 +12178,7 @@ Created API key: ${maskedNewKey}
12012
12178
  const needsGlobalMcpConfig = mcpScope === "global" || mcpScope === "both" || mcpScope === "project" && hasCodex;
12013
12179
  if (needsGlobalMcpConfig) {
12014
12180
  console.log("\nInstalling global MCP config...");
12015
- for (const editor of selectedEditors) {
12181
+ for (const editor of configuredEditors) {
12016
12182
  if (mcpScope === "project" && editor !== "codex") continue;
12017
12183
  try {
12018
12184
  if (editor === "codex") {
@@ -12092,7 +12258,7 @@ Created API key: ${maskedNewKey}
12092
12258
  }
12093
12259
  if (scope === "global" || scope === "both") {
12094
12260
  console.log("\nInstalling global rules...");
12095
- for (const editor of selectedEditors) {
12261
+ for (const editor of configuredEditors) {
12096
12262
  const filePath = globalRulesPathForEditor(editor);
12097
12263
  if (!filePath) {
12098
12264
  console.log(`- ${EDITOR_LABELS[editor]}: global rules need manual setup (project rules supported).`);
@@ -12176,7 +12342,7 @@ Applying to ${projects.length} project(s)...`);
12176
12342
  writeActions.push({ kind: "workspace-config", target: path6.join(projectPath, ".contextstream", "config.json"), status: "dry-run" });
12177
12343
  }
12178
12344
  if (mcpScope === "project" || mcpScope === "both") {
12179
- for (const editor of selectedEditors) {
12345
+ for (const editor of configuredEditors) {
12180
12346
  try {
12181
12347
  if (editor === "cursor") {
12182
12348
  const cursorPath = path6.join(projectPath, ".cursor", "mcp.json");
@@ -12230,6 +12396,7 @@ Applying to ${projects.length} project(s)...`);
12230
12396
  }
12231
12397
  for (const editor of selectedEditors) {
12232
12398
  if (scope !== "project" && scope !== "both") continue;
12399
+ if (!configuredEditors.includes(editor)) continue;
12233
12400
  const rule = generateRuleContent(editor, {
12234
12401
  workspaceName,
12235
12402
  workspaceId: workspaceId && workspaceId !== "dry-run" ? workspaceId : void 0,
@@ -12267,6 +12434,7 @@ Applying to ${projects.length} project(s)...`);
12267
12434
  console.log("- Prefer ContextStream search first: use session_smart_search (or mcp__contextstream__session_smart_search) before raw repo scans (rg/ls/find).");
12268
12435
  console.log("- If any tools require UI-based MCP setup (e.g. Cline/Kilo/Roo global), follow https://contextstream.io/docs/mcp.");
12269
12436
  if (toolset === "complete") {
12437
+ console.log("- For full graph tools, run graph_ingest once per project (async; can take a few minutes).");
12270
12438
  console.log("- Note: Claude Code/Desktop may warn about large tool contexts. This is expected with the complete toolset.");
12271
12439
  }
12272
12440
  } finally {
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
- "version": "0.3.59",
3
+ "mcpName": "io.github.contextstreamio/mcp-server",
4
+ "version": "0.3.62",
4
5
  "description": "MCP server exposing ContextStream public API - code context, memory, search, and AI tools for developers",
5
6
  "type": "module",
6
7
  "license": "MIT",