@contextstream/mcp-server 0.3.71 → 0.3.72

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 +266 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8282,6 +8282,155 @@ function getRecommendedToolset(clientName, fromEnv) {
8282
8282
  }
8283
8283
  var detectedClientInfo = null;
8284
8284
  var clientDetectedFromEnv = false;
8285
+ var PROGRESSIVE_MODE = process.env.CONTEXTSTREAM_PROGRESSIVE_MODE === "true";
8286
+ var TOOL_BUNDLES = {
8287
+ // Core bundle (~12 tools) - always enabled, essential for any session
8288
+ core: /* @__PURE__ */ new Set([
8289
+ "session_init",
8290
+ "session_tools",
8291
+ "context_smart",
8292
+ "context_feedback",
8293
+ "session_capture",
8294
+ "session_capture_lesson",
8295
+ "session_get_lessons",
8296
+ "session_recall",
8297
+ "session_remember",
8298
+ "session_get_user_context",
8299
+ "tools_enable_bundle",
8300
+ // Meta-tool to enable other bundles
8301
+ "auth_me",
8302
+ "mcp_server_version"
8303
+ ]),
8304
+ // Session bundle (~6 tools) - extended session management
8305
+ session: /* @__PURE__ */ new Set([
8306
+ "session_summary",
8307
+ "session_smart_search",
8308
+ "session_compress",
8309
+ "session_delta",
8310
+ "decision_trace",
8311
+ "generate_editor_rules"
8312
+ ]),
8313
+ // Memory bundle (~12 tools) - full memory CRUD operations
8314
+ memory: /* @__PURE__ */ new Set([
8315
+ "memory_create_event",
8316
+ "memory_update_event",
8317
+ "memory_delete_event",
8318
+ "memory_list_events",
8319
+ "memory_get_event",
8320
+ "memory_search",
8321
+ "memory_decisions",
8322
+ "memory_timeline",
8323
+ "memory_summary",
8324
+ "memory_create_node",
8325
+ "memory_update_node",
8326
+ "memory_delete_node",
8327
+ "memory_list_nodes",
8328
+ "memory_get_node",
8329
+ "memory_supersede_node",
8330
+ "memory_distill_event"
8331
+ ]),
8332
+ // Search bundle (~4 tools) - search capabilities
8333
+ search: /* @__PURE__ */ new Set([
8334
+ "search_semantic",
8335
+ "search_hybrid",
8336
+ "search_keyword"
8337
+ ]),
8338
+ // Graph bundle (~9 tools) - code graph analysis
8339
+ graph: /* @__PURE__ */ new Set([
8340
+ "graph_related",
8341
+ "graph_decisions",
8342
+ "graph_path",
8343
+ "graph_dependencies",
8344
+ "graph_call_path",
8345
+ "graph_impact",
8346
+ "graph_circular_dependencies",
8347
+ "graph_unused_code",
8348
+ "graph_ingest"
8349
+ ]),
8350
+ // Workspace bundle (~4 tools) - workspace management
8351
+ workspace: /* @__PURE__ */ new Set([
8352
+ "workspaces_list",
8353
+ "workspaces_get",
8354
+ "workspace_associate",
8355
+ "workspace_bootstrap"
8356
+ ]),
8357
+ // Project bundle (~10 tools) - project management and indexing
8358
+ project: /* @__PURE__ */ new Set([
8359
+ "projects_create",
8360
+ "projects_update",
8361
+ "projects_list",
8362
+ "projects_get",
8363
+ "projects_overview",
8364
+ "projects_statistics",
8365
+ "projects_index",
8366
+ "projects_index_status",
8367
+ "projects_files",
8368
+ "projects_ingest_local"
8369
+ ]),
8370
+ // Reminders bundle (~6 tools) - reminder management
8371
+ reminders: /* @__PURE__ */ new Set([
8372
+ "reminders_list",
8373
+ "reminders_active",
8374
+ "reminders_create",
8375
+ "reminders_snooze",
8376
+ "reminders_complete",
8377
+ "reminders_dismiss"
8378
+ ]),
8379
+ // Integrations bundle - Slack/GitHub tools (auto-hidden when not connected)
8380
+ integrations: /* @__PURE__ */ new Set([
8381
+ "slack_stats",
8382
+ "slack_channels",
8383
+ "slack_search",
8384
+ "slack_discussions",
8385
+ "slack_activity",
8386
+ "slack_contributors",
8387
+ "slack_knowledge",
8388
+ "slack_summary",
8389
+ "slack_sync_users",
8390
+ "github_stats",
8391
+ "github_repos",
8392
+ "github_search",
8393
+ "github_issues",
8394
+ "github_activity",
8395
+ "github_contributors",
8396
+ "github_knowledge",
8397
+ "github_summary",
8398
+ "integrations_status",
8399
+ "integrations_search",
8400
+ "integrations_summary",
8401
+ "integrations_knowledge"
8402
+ ])
8403
+ };
8404
+ var enabledBundles = /* @__PURE__ */ new Set(["core"]);
8405
+ function isToolInEnabledBundles(toolName) {
8406
+ for (const bundleName of enabledBundles) {
8407
+ const bundle = TOOL_BUNDLES[bundleName];
8408
+ if (bundle?.has(toolName)) {
8409
+ return true;
8410
+ }
8411
+ }
8412
+ return false;
8413
+ }
8414
+ function getBundleInfo() {
8415
+ const descriptions = {
8416
+ core: "Essential session tools (always enabled)",
8417
+ session: "Extended session management and utilities",
8418
+ memory: "Full memory CRUD operations",
8419
+ search: "Semantic, hybrid, and keyword search",
8420
+ graph: "Code graph analysis and dependencies",
8421
+ workspace: "Workspace management",
8422
+ project: "Project management and indexing",
8423
+ reminders: "Reminder management",
8424
+ integrations: "Slack and GitHub integrations"
8425
+ };
8426
+ return Object.entries(TOOL_BUNDLES).map(([name, tools]) => ({
8427
+ name,
8428
+ size: tools.size,
8429
+ enabled: enabledBundles.has(name),
8430
+ description: descriptions[name] || `${name} tools`
8431
+ }));
8432
+ }
8433
+ var deferredTools = /* @__PURE__ */ new Map();
8285
8434
  var TOOLSET_ALIASES = {
8286
8435
  // Light mode - minimal, fastest
8287
8436
  light: LIGHT_TOOLSET,
@@ -8478,6 +8627,12 @@ function registerTools(server, client, sessionManager) {
8478
8627
  } else {
8479
8628
  console.error("[ContextStream] Schema mode: full (set CONTEXTSTREAM_SCHEMA_MODE=compact to reduce token overhead)");
8480
8629
  }
8630
+ if (PROGRESSIVE_MODE) {
8631
+ const coreBundle = TOOL_BUNDLES.core;
8632
+ console.error(`[ContextStream] Progressive mode: ENABLED (starting with ${coreBundle.size} core tools)`);
8633
+ console.error("[ContextStream] Use tools_enable_bundle to unlock additional tool bundles dynamically.");
8634
+ }
8635
+ let serverRef = server;
8481
8636
  const defaultProTools = /* @__PURE__ */ new Set([
8482
8637
  // AI endpoints (typically paid/credit-metered)
8483
8638
  "ai_context",
@@ -8771,13 +8926,7 @@ function registerTools(server, client, sessionManager) {
8771
8926
  });
8772
8927
  };
8773
8928
  }
8774
- function registerTool(name, config, handler) {
8775
- if (toolAllowlist && !toolAllowlist.has(name)) {
8776
- return;
8777
- }
8778
- if (!shouldRegisterIntegrationTool(name)) {
8779
- return;
8780
- }
8929
+ function actuallyRegisterTool(name, config, handler) {
8781
8930
  const accessLabel = getToolAccessLabel(name);
8782
8931
  const showUpgrade = accessLabel !== "Free";
8783
8932
  let finalDescription;
@@ -8834,12 +8983,51 @@ Upgrade: ${upgradeUrl2}` : "";
8834
8983
  };
8835
8984
  }
8836
8985
  };
8837
- server.registerTool(
8986
+ serverRef.registerTool(
8838
8987
  name,
8839
8988
  annotatedConfig,
8840
8989
  wrapWithAutoContext(name, safeHandler)
8841
8990
  );
8842
8991
  }
8992
+ function enableBundle(bundleName) {
8993
+ if (enabledBundles.has(bundleName)) {
8994
+ return { success: true, message: `Bundle '${bundleName}' is already enabled.`, toolsEnabled: 0 };
8995
+ }
8996
+ const bundle = TOOL_BUNDLES[bundleName];
8997
+ if (!bundle) {
8998
+ return { success: false, message: `Unknown bundle '${bundleName}'. Available: ${Object.keys(TOOL_BUNDLES).join(", ")}`, toolsEnabled: 0 };
8999
+ }
9000
+ enabledBundles.add(bundleName);
9001
+ let toolsEnabled = 0;
9002
+ for (const toolName of bundle) {
9003
+ const deferred = deferredTools.get(toolName);
9004
+ if (deferred) {
9005
+ actuallyRegisterTool(deferred.name, deferred.config, deferred.handler);
9006
+ deferredTools.delete(toolName);
9007
+ toolsEnabled++;
9008
+ }
9009
+ }
9010
+ try {
9011
+ const lowLevelServer = serverRef;
9012
+ lowLevelServer.sendToolsListChanged?.();
9013
+ } catch {
9014
+ }
9015
+ console.error(`[ContextStream] Bundle '${bundleName}' enabled with ${toolsEnabled} tools.`);
9016
+ return { success: true, message: `Enabled bundle '${bundleName}' with ${toolsEnabled} tools.`, toolsEnabled };
9017
+ }
9018
+ function registerTool(name, config, handler) {
9019
+ if (toolAllowlist && !toolAllowlist.has(name)) {
9020
+ return;
9021
+ }
9022
+ if (!shouldRegisterIntegrationTool(name)) {
9023
+ return;
9024
+ }
9025
+ if (PROGRESSIVE_MODE && !isToolInEnabledBundles(name)) {
9026
+ deferredTools.set(name, { name, config, handler });
9027
+ return;
9028
+ }
9029
+ actuallyRegisterTool(name, config, handler);
9030
+ }
8843
9031
  function errorResult(text) {
8844
9032
  return {
8845
9033
  content: [{ type: "text", text }],
@@ -8909,6 +9097,56 @@ Upgrade: ${upgradeUrl2}` : "";
8909
9097
  return { content: [{ type: "text", text: formatContent(result) }], structuredContent: toStructured(result) };
8910
9098
  }
8911
9099
  );
9100
+ registerTool(
9101
+ "tools_enable_bundle",
9102
+ {
9103
+ title: "Enable tool bundle",
9104
+ description: `Enable a bundle of related tools dynamically. Only available when CONTEXTSTREAM_PROGRESSIVE_MODE=true.
9105
+
9106
+ Available bundles:
9107
+ - session: Extended session management (~6 tools)
9108
+ - memory: Full memory CRUD operations (~16 tools)
9109
+ - search: Semantic, hybrid, and keyword search (~3 tools)
9110
+ - graph: Code graph analysis and dependencies (~9 tools)
9111
+ - workspace: Workspace management (~4 tools)
9112
+ - project: Project management and indexing (~10 tools)
9113
+ - reminders: Reminder management (~6 tools)
9114
+ - integrations: Slack and GitHub integrations (~21 tools)
9115
+
9116
+ Example: Enable memory tools before using memory_create_event.`,
9117
+ inputSchema: external_exports.object({
9118
+ bundle: external_exports.enum(["session", "memory", "search", "graph", "workspace", "project", "reminders", "integrations"]).describe("Name of the bundle to enable"),
9119
+ list_bundles: external_exports.boolean().optional().describe("If true, list all available bundles and their status")
9120
+ })
9121
+ },
9122
+ async (input) => {
9123
+ if (input.list_bundles) {
9124
+ const bundles = getBundleInfo();
9125
+ const result2 = {
9126
+ progressive_mode: PROGRESSIVE_MODE,
9127
+ bundles,
9128
+ hint: PROGRESSIVE_MODE ? "Call tools_enable_bundle with a bundle name to enable additional tools." : "Progressive mode is disabled. All tools from your toolset are already available."
9129
+ };
9130
+ return { content: [{ type: "text", text: formatContent(result2) }], structuredContent: toStructured(result2) };
9131
+ }
9132
+ if (!PROGRESSIVE_MODE) {
9133
+ const result2 = {
9134
+ success: true,
9135
+ message: `Progressive mode is disabled. All tools from your toolset are already available. Bundle '${input.bundle}' tools are accessible.`,
9136
+ progressive_mode: false
9137
+ };
9138
+ return { content: [{ type: "text", text: formatContent(result2) }], structuredContent: toStructured(result2) };
9139
+ }
9140
+ const result = enableBundle(input.bundle);
9141
+ const response = {
9142
+ ...result,
9143
+ progressive_mode: true,
9144
+ enabled_bundles: Array.from(enabledBundles),
9145
+ hint: result.success && result.toolsEnabled > 0 ? "New tools are now available. The client should refresh its tool list." : void 0
9146
+ };
9147
+ return { content: [{ type: "text", text: formatContent(response) }], structuredContent: toStructured(response) };
9148
+ }
9149
+ );
8912
9150
  registerTool(
8913
9151
  "workspaces_list",
8914
9152
  {
@@ -10110,9 +10348,26 @@ Memory: events(crud) nodes(knowledge) search(find) decisions(choices)`,
10110
10348
  async (input) => {
10111
10349
  const format = input.format || "grouped";
10112
10350
  const catalog = generateToolCatalog(format, input.category);
10351
+ let bundleInfo = "";
10352
+ if (PROGRESSIVE_MODE) {
10353
+ const bundles = getBundleInfo();
10354
+ const enabledList = bundles.filter((b) => b.enabled).map((b) => b.name).join(", ");
10355
+ const availableList = bundles.filter((b) => !b.enabled).map((b) => `${b.name}(${b.size})`).join(", ");
10356
+ bundleInfo = `
10357
+
10358
+ [Progressive Mode]
10359
+ Enabled: ${enabledList}
10360
+ Available: ${availableList}
10361
+ Use tools_enable_bundle to unlock more tools.`;
10362
+ }
10113
10363
  return {
10114
- content: [{ type: "text", text: catalog }],
10115
- structuredContent: { format, catalog }
10364
+ content: [{ type: "text", text: catalog + bundleInfo }],
10365
+ structuredContent: {
10366
+ format,
10367
+ catalog,
10368
+ progressive_mode: PROGRESSIVE_MODE,
10369
+ bundles: PROGRESSIVE_MODE ? getBundleInfo() : void 0
10370
+ }
10116
10371
  };
10117
10372
  }
10118
10373
  );
@@ -14278,6 +14533,7 @@ Environment variables:
14278
14533
  CONTEXTSTREAM_AUTO_TOOLSET Auto-detect client and adjust toolset (default: false)
14279
14534
  CONTEXTSTREAM_AUTO_HIDE_INTEGRATIONS Auto-hide Slack/GitHub tools when not connected (default: true)
14280
14535
  CONTEXTSTREAM_SCHEMA_MODE Schema verbosity: compact|full (default: full, compact reduces tokens)
14536
+ CONTEXTSTREAM_PROGRESSIVE_MODE Progressive disclosure: true|false (default: false, starts with ~13 core tools)
14281
14537
  CONTEXTSTREAM_PRO_TOOLS Optional comma-separated PRO tool names (default: AI tools)
14282
14538
  CONTEXTSTREAM_UPGRADE_URL Optional upgrade URL shown for PRO tools on Free plan
14283
14539
  CONTEXTSTREAM_ENABLE_PROMPTS Enable MCP prompts list (default: true)
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.3.71",
4
+ "version": "0.3.72",
5
5
  "description": "MCP server exposing ContextStream public API - code context, memory, search, and AI tools for developers",
6
6
  "type": "module",
7
7
  "license": "MIT",