@contextstream/mcp-server 0.4.1 → 0.4.3
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.
- package/dist/index.js +159 -227
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7289,116 +7289,29 @@ import * as path4 from "node:path";
|
|
|
7289
7289
|
// src/rules-templates.ts
|
|
7290
7290
|
var DEFAULT_CLAUDE_MCP_SERVER_NAME = "contextstream";
|
|
7291
7291
|
var CONTEXTSTREAM_TOOL_NAMES = [
|
|
7292
|
-
//
|
|
7292
|
+
// Standalone tools (always present)
|
|
7293
7293
|
"session_init",
|
|
7294
7294
|
"context_smart",
|
|
7295
7295
|
"context_feedback",
|
|
7296
|
-
|
|
7297
|
-
"
|
|
7298
|
-
|
|
7299
|
-
"
|
|
7300
|
-
|
|
7301
|
-
"
|
|
7302
|
-
|
|
7303
|
-
"
|
|
7304
|
-
|
|
7305
|
-
"
|
|
7306
|
-
//
|
|
7307
|
-
"
|
|
7308
|
-
//
|
|
7309
|
-
"
|
|
7310
|
-
|
|
7311
|
-
"
|
|
7312
|
-
|
|
7313
|
-
"
|
|
7314
|
-
|
|
7315
|
-
"workspaces_get",
|
|
7316
|
-
"workspaces_overview",
|
|
7317
|
-
"workspaces_analytics",
|
|
7318
|
-
"workspaces_content",
|
|
7319
|
-
// Projects
|
|
7320
|
-
"projects_list",
|
|
7321
|
-
"projects_create",
|
|
7322
|
-
"projects_update",
|
|
7323
|
-
"projects_delete",
|
|
7324
|
-
"projects_get",
|
|
7325
|
-
"projects_overview",
|
|
7326
|
-
"projects_statistics",
|
|
7327
|
-
"projects_files",
|
|
7328
|
-
"projects_index",
|
|
7329
|
-
"projects_index_status",
|
|
7330
|
-
"projects_ingest_local",
|
|
7331
|
-
// Search
|
|
7332
|
-
"search_semantic",
|
|
7333
|
-
"search_hybrid",
|
|
7334
|
-
"search_keyword",
|
|
7335
|
-
"search_pattern",
|
|
7336
|
-
"search_suggestions",
|
|
7337
|
-
// Memory
|
|
7338
|
-
"memory_create_event",
|
|
7339
|
-
"memory_bulk_ingest",
|
|
7340
|
-
"memory_list_events",
|
|
7341
|
-
"memory_create_node",
|
|
7342
|
-
"memory_list_nodes",
|
|
7343
|
-
"memory_search",
|
|
7344
|
-
"memory_decisions",
|
|
7345
|
-
"decision_trace",
|
|
7346
|
-
"memory_get_event",
|
|
7347
|
-
"memory_update_event",
|
|
7348
|
-
"memory_delete_event",
|
|
7349
|
-
"memory_distill_event",
|
|
7350
|
-
"memory_get_node",
|
|
7351
|
-
"memory_update_node",
|
|
7352
|
-
"memory_delete_node",
|
|
7353
|
-
"memory_supersede_node",
|
|
7354
|
-
"memory_timeline",
|
|
7355
|
-
"memory_summary",
|
|
7356
|
-
// Graph
|
|
7357
|
-
"graph_related",
|
|
7358
|
-
"graph_path",
|
|
7359
|
-
"graph_decisions",
|
|
7360
|
-
"graph_dependencies",
|
|
7361
|
-
"graph_call_path",
|
|
7362
|
-
"graph_impact",
|
|
7363
|
-
"graph_circular_dependencies",
|
|
7364
|
-
"graph_unused_code",
|
|
7365
|
-
"graph_ingest",
|
|
7366
|
-
"graph_contradictions",
|
|
7367
|
-
// AI (PRO)
|
|
7368
|
-
"ai_context",
|
|
7369
|
-
"ai_enhanced_context",
|
|
7370
|
-
"ai_context_budget",
|
|
7371
|
-
"ai_embeddings",
|
|
7372
|
-
"ai_plan",
|
|
7373
|
-
"ai_tasks",
|
|
7374
|
-
// GitHub Integration (PRO)
|
|
7375
|
-
"github_stats",
|
|
7376
|
-
"github_repos",
|
|
7377
|
-
"github_contributors",
|
|
7378
|
-
"github_activity",
|
|
7379
|
-
"github_issues",
|
|
7380
|
-
"github_search",
|
|
7381
|
-
// Slack Integration (PRO)
|
|
7382
|
-
"slack_stats",
|
|
7383
|
-
"slack_channels",
|
|
7384
|
-
"slack_contributors",
|
|
7385
|
-
"slack_activity",
|
|
7386
|
-
"slack_discussions",
|
|
7387
|
-
"slack_search",
|
|
7388
|
-
"slack_sync_users",
|
|
7389
|
-
"slack_knowledge",
|
|
7390
|
-
"slack_summary",
|
|
7391
|
-
// GitHub additional
|
|
7392
|
-
"github_knowledge",
|
|
7393
|
-
"github_summary",
|
|
7394
|
-
// Cross-source integrations
|
|
7395
|
-
"integrations_status",
|
|
7396
|
-
"integrations_search",
|
|
7397
|
-
"integrations_summary",
|
|
7398
|
-
"integrations_knowledge",
|
|
7399
|
-
// Auth/Meta
|
|
7400
|
-
"auth_me",
|
|
7401
|
-
"mcp_server_version"
|
|
7296
|
+
// Consolidated domain tools (v0.4.x default)
|
|
7297
|
+
"search",
|
|
7298
|
+
// Modes: semantic, hybrid, keyword, pattern
|
|
7299
|
+
"session",
|
|
7300
|
+
// Actions: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace
|
|
7301
|
+
"memory",
|
|
7302
|
+
// Actions: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary
|
|
7303
|
+
"graph",
|
|
7304
|
+
// Actions: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions
|
|
7305
|
+
"project",
|
|
7306
|
+
// Actions: list, get, create, update, index, overview, statistics, files, index_status, ingest_local
|
|
7307
|
+
"workspace",
|
|
7308
|
+
// Actions: list, get, associate, bootstrap
|
|
7309
|
+
"reminder",
|
|
7310
|
+
// Actions: list, active, create, snooze, complete, dismiss
|
|
7311
|
+
"integration",
|
|
7312
|
+
// Provider: slack, github, all; Actions: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues
|
|
7313
|
+
"help"
|
|
7314
|
+
// Actions: tools, auth, version, editor_rules, enable_bundle
|
|
7402
7315
|
];
|
|
7403
7316
|
function applyMcpToolPrefix(markdown, toolPrefix) {
|
|
7404
7317
|
const toolPattern = CONTEXTSTREAM_TOOL_NAMES.join("|");
|
|
@@ -7406,9 +7319,10 @@ function applyMcpToolPrefix(markdown, toolPrefix) {
|
|
|
7406
7319
|
return markdown.replace(toolRegex, `${toolPrefix}$1`);
|
|
7407
7320
|
}
|
|
7408
7321
|
var CONTEXTSTREAM_RULES_FULL = `
|
|
7409
|
-
## ContextStream Integration (Enhanced)
|
|
7322
|
+
## ContextStream v0.4.x Integration (Enhanced)
|
|
7410
7323
|
|
|
7411
7324
|
You have access to ContextStream MCP tools for persistent memory and context.
|
|
7325
|
+
v0.4.x uses **~11 consolidated domain tools** for ~75% token reduction vs previous versions.
|
|
7412
7326
|
|
|
7413
7327
|
## TL;DR - REQUIRED EVERY MESSAGE
|
|
7414
7328
|
|
|
@@ -7416,15 +7330,39 @@ You have access to ContextStream MCP tools for persistent memory and context.
|
|
|
7416
7330
|
|---------|--------------|
|
|
7417
7331
|
| **1st message** | \`session_init(folder_path="...", context_hint="<user's message>")\` |
|
|
7418
7332
|
| **2nd+ messages** | \`context_smart(user_message="<user's message>", format="minified", max_tokens=400)\` |
|
|
7419
|
-
| **Before risky/non-trivial work** | \`
|
|
7420
|
-
| **After completing task** | \`
|
|
7421
|
-
| **User frustration/correction** | \`
|
|
7422
|
-
| **Command/tool error + fix** | \`
|
|
7333
|
+
| **Before risky/non-trivial work** | \`session(action="get_lessons", query="<topic>")\` |
|
|
7334
|
+
| **After completing task** | \`session(action="capture", event_type="decision", ...)\` - MUST capture |
|
|
7335
|
+
| **User frustration/correction** | \`session(action="capture_lesson", ...)\` - MUST capture lessons |
|
|
7336
|
+
| **Command/tool error + fix** | \`session(action="capture_lesson", ...)\` - MUST capture lessons |
|
|
7423
7337
|
|
|
7424
7338
|
**NO EXCEPTIONS.** Do not skip even if you think you have enough context.
|
|
7425
7339
|
|
|
7426
7340
|
---
|
|
7427
7341
|
|
|
7342
|
+
## Consolidated Domain Tools Architecture
|
|
7343
|
+
|
|
7344
|
+
v0.4.x consolidates ~58 individual tools into ~11 domain tools with action/mode dispatch:
|
|
7345
|
+
|
|
7346
|
+
### Standalone Tools (Always Call)
|
|
7347
|
+
- **\`session_init\`** - Initialize session with workspace detection + context
|
|
7348
|
+
- **\`context_smart\`** - Semantic search for relevant context (CALL EVERY MESSAGE)
|
|
7349
|
+
|
|
7350
|
+
### Domain Tools (Use action/mode parameter)
|
|
7351
|
+
|
|
7352
|
+
| Domain | Actions/Modes | Example |
|
|
7353
|
+
|--------|---------------|---------|
|
|
7354
|
+
| **\`search\`** | mode: semantic, hybrid, keyword, pattern | \`search(mode="hybrid", query="auth implementation")\` |
|
|
7355
|
+
| **\`session\`** | action: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace | \`session(action="capture", event_type="decision", title="Use JWT", content="...")\` |
|
|
7356
|
+
| **\`memory\`** | action: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary | \`memory(action="list_events", limit=10)\` |
|
|
7357
|
+
| **\`graph\`** | action: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions | \`graph(action="impact", symbol_name="AuthService")\` |
|
|
7358
|
+
| **\`project\`** | action: list, get, create, update, index, overview, statistics, files, index_status, ingest_local | \`project(action="statistics")\` |
|
|
7359
|
+
| **\`workspace\`** | action: list, get, associate, bootstrap | \`workspace(action="list")\` |
|
|
7360
|
+
| **\`reminder\`** | action: list, active, create, snooze, complete, dismiss | \`reminder(action="active")\` |
|
|
7361
|
+
| **\`integration\`** | provider: slack/github/all; action: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues | \`integration(provider="github", action="search", query="...")\` |
|
|
7362
|
+
| **\`help\`** | action: tools, auth, version, editor_rules, enable_bundle | \`help(action="tools")\` |
|
|
7363
|
+
|
|
7364
|
+
---
|
|
7365
|
+
|
|
7428
7366
|
### Why context_smart is Required (Even After session_init)
|
|
7429
7367
|
|
|
7430
7368
|
**Common mistake:** "session_init already gave me context, I don't need context_smart"
|
|
@@ -7447,126 +7385,124 @@ You have access to ContextStream MCP tools for persistent memory and context.
|
|
|
7447
7385
|
|
|
7448
7386
|
- For trivial/local edits: \`context_smart(..., max_tokens=200)\`
|
|
7449
7387
|
- Default: \`context_smart(..., max_tokens=400)\`
|
|
7450
|
-
- Deep debugging/architecture
|
|
7451
|
-
- Keep \`format="minified"\` (default) unless
|
|
7388
|
+
- Deep debugging/architecture: \`context_smart(..., max_tokens=800)\`
|
|
7389
|
+
- Keep \`format="minified"\` (default) unless debugging
|
|
7452
7390
|
|
|
7453
|
-
If context still feels missing,
|
|
7391
|
+
If context still feels missing, use \`session(action="recall", query="...")\` for focused deep lookup.
|
|
7454
7392
|
|
|
7455
7393
|
---
|
|
7456
7394
|
|
|
7457
7395
|
### Preferences & Lessons (Use Early)
|
|
7458
7396
|
|
|
7459
|
-
- If preferences
|
|
7460
|
-
- Before risky changes
|
|
7461
|
-
-
|
|
7397
|
+
- If preferences/style matter: \`session(action="user_context")\`
|
|
7398
|
+
- Before risky changes: \`session(action="get_lessons", query="<topic>")\`
|
|
7399
|
+
- On frustration/corrections: \`session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")\`
|
|
7462
7400
|
|
|
7463
7401
|
---
|
|
7464
7402
|
|
|
7465
|
-
### Search
|
|
7403
|
+
### Search & Code Intelligence (ContextStream-first)
|
|
7404
|
+
|
|
7405
|
+
**Search order:**
|
|
7406
|
+
1. \`session(action="smart_search", query="...")\` - context-enriched
|
|
7407
|
+
2. \`search(mode="hybrid", query="...")\` - semantic + keyword
|
|
7408
|
+
3. \`graph(action="dependencies", ...)\` - code structure
|
|
7409
|
+
4. Local repo scans (rg/ls/find) - only if ContextStream returns no results
|
|
7466
7410
|
|
|
7467
|
-
|
|
7468
|
-
-
|
|
7469
|
-
-
|
|
7470
|
-
-
|
|
7471
|
-
-
|
|
7472
|
-
- 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.
|
|
7411
|
+
**Code Analysis:**
|
|
7412
|
+
- Dependencies: \`graph(action="dependencies", file_path="...")\`
|
|
7413
|
+
- Change impact: \`graph(action="impact", symbol_name="...")\`
|
|
7414
|
+
- Call path: \`graph(action="call_path", from_symbol="...", to_symbol="...")\`
|
|
7415
|
+
- Build graph: \`graph(action="ingest")\` - async, can take a few minutes
|
|
7473
7416
|
|
|
7474
7417
|
---
|
|
7475
7418
|
|
|
7476
7419
|
### Distillation & Memory Hygiene
|
|
7477
7420
|
|
|
7478
|
-
-
|
|
7479
|
-
-
|
|
7480
|
-
-
|
|
7421
|
+
- Quick context: \`session(action="summary")\`
|
|
7422
|
+
- Long chat: \`session(action="compress", content="...")\`
|
|
7423
|
+
- Memory summary: \`memory(action="summary")\`
|
|
7424
|
+
- Condense noisy entries: \`memory(action="distill_event", event_id="...")\`
|
|
7481
7425
|
|
|
7482
7426
|
---
|
|
7483
7427
|
|
|
7484
7428
|
### When to Capture (MANDATORY)
|
|
7485
7429
|
|
|
7486
|
-
| When |
|
|
7430
|
+
| When | Call | Example |
|
|
7487
7431
|
|------|------|---------|
|
|
7488
|
-
| User makes
|
|
7489
|
-
| User states preference | \`
|
|
7490
|
-
| You complete a task | \`
|
|
7491
|
-
| Need past context | \`
|
|
7432
|
+
| User makes decision | \`session(action="capture", event_type="decision", ...)\` | "Let's use PostgreSQL" |
|
|
7433
|
+
| User states preference | \`session(action="capture", event_type="preference", ...)\` | "I prefer TypeScript" |
|
|
7434
|
+
| You complete a task | \`session(action="capture", event_type="task", ...)\` | Capture what was done |
|
|
7435
|
+
| Need past context | \`session(action="recall", query="...")\` | "What did we decide about X?" |
|
|
7492
7436
|
|
|
7493
7437
|
**You MUST capture after completing any significant task.** This ensures future sessions have context.
|
|
7494
7438
|
|
|
7495
7439
|
---
|
|
7496
7440
|
|
|
7497
|
-
###
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
**
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
**Search**:
|
|
7522
|
-
\`search_semantic\`, \`search_hybrid\`, \`search_keyword\`, \`search_pattern\`, \`search_suggestions\`
|
|
7523
|
-
|
|
7524
|
-
**Memory**:
|
|
7525
|
-
\`memory_create_event\`, \`memory_bulk_ingest\`, \`memory_list_events\`, \`memory_create_node\`, \`memory_list_nodes\`, \`memory_search\`, \`memory_decisions\`, \`decision_trace\`, \`memory_get_event\`, \`memory_update_event\`, \`memory_delete_event\`, \`memory_distill_event\`, \`memory_get_node\`, \`memory_update_node\`, \`memory_delete_node\`, \`memory_supersede_node\`, \`memory_timeline\`, \`memory_summary\`
|
|
7526
|
-
|
|
7527
|
-
**Graph** (code analysis):
|
|
7528
|
-
\`graph_related\`, \`graph_path\`, \`graph_decisions\`, \`graph_dependencies\`, \`graph_call_path\`, \`graph_impact\`, \`graph_circular_dependencies\`, \`graph_unused_code\`, \`graph_ingest\`, \`graph_contradictions\`
|
|
7529
|
-
|
|
7530
|
-
**AI** (PRO):
|
|
7531
|
-
\`ai_context\`, \`ai_enhanced_context\`, \`ai_context_budget\`, \`ai_embeddings\`, \`ai_plan\`, \`ai_tasks\`
|
|
7532
|
-
|
|
7533
|
-
**GitHub Integration** (PRO):
|
|
7534
|
-
\`github_stats\`, \`github_repos\`, \`github_contributors\`, \`github_activity\`, \`github_issues\`, \`github_search\`, \`github_knowledge\`, \`github_summary\`
|
|
7535
|
-
|
|
7536
|
-
**Slack Integration** (PRO):
|
|
7537
|
-
\`slack_stats\`, \`slack_channels\`, \`slack_contributors\`, \`slack_activity\`, \`slack_discussions\`, \`slack_search\`, \`slack_sync_users\`, \`slack_knowledge\`, \`slack_summary\`
|
|
7538
|
-
|
|
7539
|
-
**Cross-Source Integrations** (PRO):
|
|
7540
|
-
\`integrations_status\`, \`integrations_search\`, \`integrations_summary\`, \`integrations_knowledge\`
|
|
7441
|
+
### Complete Action Reference
|
|
7442
|
+
|
|
7443
|
+
**session actions:**
|
|
7444
|
+
- \`capture\` - Save decision/insight/task (requires: event_type, title, content)
|
|
7445
|
+
- \`capture_lesson\` - Save lesson from mistake (requires: title, category, trigger, impact, prevention)
|
|
7446
|
+
- \`get_lessons\` - Retrieve relevant lessons (optional: query, category, severity)
|
|
7447
|
+
- \`recall\` - Natural language memory recall (requires: query)
|
|
7448
|
+
- \`remember\` - Quick save to memory (requires: content)
|
|
7449
|
+
- \`user_context\` - Get user preferences/style
|
|
7450
|
+
- \`summary\` - Workspace summary
|
|
7451
|
+
- \`compress\` - Compress long conversation
|
|
7452
|
+
- \`delta\` - Changes since timestamp
|
|
7453
|
+
- \`smart_search\` - Context-enriched search
|
|
7454
|
+
- \`decision_trace\` - Trace decision provenance
|
|
7455
|
+
|
|
7456
|
+
**memory actions:**
|
|
7457
|
+
- Event CRUD: \`create_event\`, \`get_event\`, \`update_event\`, \`delete_event\`, \`list_events\`, \`distill_event\`
|
|
7458
|
+
- Node CRUD: \`create_node\`, \`get_node\`, \`update_node\`, \`delete_node\`, \`list_nodes\`, \`supersede_node\`
|
|
7459
|
+
- Query: \`search\`, \`decisions\`, \`timeline\`, \`summary\`
|
|
7460
|
+
|
|
7461
|
+
**graph actions:**
|
|
7462
|
+
- Analysis: \`dependencies\`, \`impact\`, \`call_path\`, \`related\`, \`path\`
|
|
7463
|
+
- Quality: \`circular_dependencies\`, \`unused_code\`, \`contradictions\`
|
|
7464
|
+
- Management: \`ingest\`, \`decisions\`
|
|
7541
7465
|
|
|
7542
7466
|
See full documentation: https://contextstream.io/docs/mcp/tools
|
|
7543
7467
|
`.trim();
|
|
7544
7468
|
var CONTEXTSTREAM_RULES_MINIMAL = `
|
|
7545
|
-
## ContextStream (
|
|
7546
|
-
|
|
7547
|
-
- First user message: \`session_init(folder_path="<cwd>", context_hint="<user_message>")\`, then answer.
|
|
7548
|
-
- Every user message: \`context_smart(user_message="<user_message>", format="minified", max_tokens=400)\` BEFORE answering.
|
|
7549
|
-
- Use \`max_tokens=200\` for trivial/local edits, \`max_tokens=800\` for deep debugging/architecture.
|
|
7550
|
-
- Before risky/non-trivial work: check \`session_get_lessons(query="<topic>")\`; use \`session_get_user_context\` when preferences/style matter.
|
|
7551
|
-
- 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.
|
|
7552
|
-
- 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).
|
|
7553
|
-
- For distillation: use \`session_summary\` for quick context; use \`session_compress\` for long chats; use \`memory_summary\` or \`memory_distill_event\` to condense memory.
|
|
7554
|
-
- After meaningful work/decisions/preferences: \`session_capture(event_type=decision|preference|task|insight, title="...", content="...")\`.
|
|
7555
|
-
- On frustration/corrections/tool mistakes: \`session_capture_lesson(...)\`.
|
|
7469
|
+
## ContextStream v0.4.x (Consolidated Domain Tools)
|
|
7556
7470
|
|
|
7557
|
-
|
|
7471
|
+
v0.4.x uses ~11 consolidated domain tools for ~75% token reduction vs previous versions.
|
|
7558
7472
|
|
|
7559
|
-
|
|
7473
|
+
### Required Every Message
|
|
7560
7474
|
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7475
|
+
| Message | What to Call |
|
|
7476
|
+
|---------|--------------|
|
|
7477
|
+
| **1st message** | \`session_init(folder_path="<cwd>", context_hint="<user_message>")\` |
|
|
7478
|
+
| **2nd+ messages** | \`context_smart(user_message="<user_message>", format="minified", max_tokens=400)\` |
|
|
7479
|
+
| **Capture decisions** | \`session(action="capture", event_type="decision", title="...", content="...")\` |
|
|
7480
|
+
| **Before risky work** | \`session(action="get_lessons", query="<topic>")\` |
|
|
7481
|
+
| **On user frustration** | \`session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...")\` |
|
|
7482
|
+
|
|
7483
|
+
### Quick Reference: Domain Tools
|
|
7484
|
+
|
|
7485
|
+
| Tool | Common Usage |
|
|
7486
|
+
|------|--------------|
|
|
7487
|
+
| \`search\` | \`search(mode="semantic", query="...")\` \u2014 modes: semantic, hybrid, keyword, pattern |
|
|
7488
|
+
| \`session\` | \`session(action="capture", ...)\` \u2014 actions: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search |
|
|
7489
|
+
| \`memory\` | \`memory(action="list_events", ...)\` \u2014 CRUD for events/nodes, search, decisions, timeline, summary |
|
|
7490
|
+
| \`graph\` | \`graph(action="dependencies", ...)\` \u2014 dependencies, impact, call_path, related, ingest |
|
|
7491
|
+
| \`project\` | \`project(action="list", ...)\` \u2014 list, get, create, update, index, statistics |
|
|
7492
|
+
| \`workspace\` | \`workspace(action="list", ...)\` \u2014 list, get, associate, bootstrap |
|
|
7493
|
+
| \`integration\` | \`integration(provider="github", action="search", ...)\` \u2014 GitHub/Slack integration |
|
|
7494
|
+
| \`help\` | \`help(action="tools")\` \u2014 tools, auth, version, editor_rules |
|
|
7495
|
+
|
|
7496
|
+
### Behavior Rules
|
|
7497
|
+
|
|
7498
|
+
- **First message**: Always call \`session_init\` with context_hint
|
|
7499
|
+
- **Every message after**: Always call \`context_smart\` BEFORE responding (semantic search for relevant context)
|
|
7500
|
+
- **For discovery**: Use \`session(action="smart_search")\` or \`search(mode="hybrid")\` before local repo scans
|
|
7501
|
+
- **For code analysis**: Use \`graph(action="dependencies")\` or \`graph(action="impact")\` for call/dependency analysis
|
|
7502
|
+
- **After completing work**: Always capture decisions/insights with \`session(action="capture")\`
|
|
7503
|
+
- **On mistakes/corrections**: Immediately capture lessons with \`session(action="capture_lesson")\`
|
|
7504
|
+
|
|
7505
|
+
Full docs: https://contextstream.io/docs/mcp/tools
|
|
7570
7506
|
`.trim();
|
|
7571
7507
|
var TEMPLATES = {
|
|
7572
7508
|
codex: {
|
|
@@ -15215,8 +15151,8 @@ function buildContextStreamMcpServer(params) {
|
|
|
15215
15151
|
CONTEXTSTREAM_API_URL: params.apiUrl,
|
|
15216
15152
|
CONTEXTSTREAM_API_KEY: params.apiKey
|
|
15217
15153
|
};
|
|
15218
|
-
if (params.toolset) {
|
|
15219
|
-
env.
|
|
15154
|
+
if (params.toolset === "router") {
|
|
15155
|
+
env.CONTEXTSTREAM_PROGRESSIVE_MODE = "true";
|
|
15220
15156
|
}
|
|
15221
15157
|
return {
|
|
15222
15158
|
command: "npx",
|
|
@@ -15229,8 +15165,8 @@ function buildContextStreamVsCodeServer(params) {
|
|
|
15229
15165
|
CONTEXTSTREAM_API_URL: params.apiUrl,
|
|
15230
15166
|
CONTEXTSTREAM_API_KEY: params.apiKey
|
|
15231
15167
|
};
|
|
15232
|
-
if (params.toolset) {
|
|
15233
|
-
env.
|
|
15168
|
+
if (params.toolset === "router") {
|
|
15169
|
+
env.CONTEXTSTREAM_PROGRESSIVE_MODE = "true";
|
|
15234
15170
|
}
|
|
15235
15171
|
return {
|
|
15236
15172
|
type: "stdio",
|
|
@@ -15312,7 +15248,7 @@ async function upsertCodexTomlConfig(filePath, params) {
|
|
|
15312
15248
|
const existing = exists ? await fs5.readFile(filePath, "utf8").catch(() => "") : "";
|
|
15313
15249
|
const marker = "[mcp_servers.contextstream]";
|
|
15314
15250
|
const envMarker = "[mcp_servers.contextstream.env]";
|
|
15315
|
-
const toolsetLine = params.toolset ? `
|
|
15251
|
+
const toolsetLine = params.toolset === "router" ? `CONTEXTSTREAM_PROGRESSIVE_MODE = "true"
|
|
15316
15252
|
` : "";
|
|
15317
15253
|
const block = `
|
|
15318
15254
|
|
|
@@ -15602,19 +15538,16 @@ Created API key: ${maskedNewKey}
|
|
|
15602
15538
|
console.log(`
|
|
15603
15539
|
Detected plan: ${planLabel} (graph: ${graphTierLabel})`);
|
|
15604
15540
|
console.log("\nMCP toolset (which tools to expose to the AI):");
|
|
15605
|
-
console.log(" 1)
|
|
15606
|
-
console.log(" Best for:
|
|
15607
|
-
console.log("
|
|
15608
|
-
console.log("
|
|
15609
|
-
console.log("
|
|
15610
|
-
console.log(" Best for: Elite users or power users needing full graph + integrations");
|
|
15541
|
+
console.log(" 1) Standard (recommended) \u2014 consolidated domain tools (~11 tools, ~75% token reduction)");
|
|
15542
|
+
console.log(" Best for: all users, full functionality with minimal token overhead");
|
|
15543
|
+
console.log(" Includes: session_init, context_smart + 9 domain tools (search, session, memory, graph, etc.)");
|
|
15544
|
+
console.log(" 2) Router \u2014 ultra-minimal with AI routing (~2 meta-tools)");
|
|
15545
|
+
console.log(" Best for: experimental, routes requests through session_init + context_smart only");
|
|
15611
15546
|
console.log("");
|
|
15612
|
-
console.log(" Note:
|
|
15613
|
-
console.log(" Tip:
|
|
15614
|
-
|
|
15615
|
-
const
|
|
15616
|
-
const toolsetChoice = normalizeInput(await rl.question(`Choose [1/2/3] (default ${toolsetDefault}): `)) || toolsetDefault;
|
|
15617
|
-
const toolset = toolsetChoice === "1" ? "light" : toolsetChoice === "3" ? "complete" : "standard";
|
|
15547
|
+
console.log(" Note: v0.4.x uses consolidated domain tools by default for ~75% token reduction.");
|
|
15548
|
+
console.log(" Tip: Change later by setting CONTEXTSTREAM_CONSOLIDATED=true|false");
|
|
15549
|
+
const toolsetChoice = normalizeInput(await rl.question("Choose [1/2] (default 1): ")) || "1";
|
|
15550
|
+
const toolset = toolsetChoice === "2" ? "router" : "consolidated";
|
|
15618
15551
|
const editors = ["codex", "claude", "cursor", "windsurf", "cline", "kilo", "roo", "aider"];
|
|
15619
15552
|
console.log('\nSelect editors to configure (comma-separated numbers, or "all"):');
|
|
15620
15553
|
editors.forEach((e, i) => console.log(` ${i + 1}) ${EDITOR_LABELS[e]}`));
|
|
@@ -15671,9 +15604,9 @@ Detected plan: ${planLabel} (graph: ${graphTierLabel})`);
|
|
|
15671
15604
|
const mcpChoiceDefault = hasCodex && !hasProjectMcpEditors ? "1" : "3";
|
|
15672
15605
|
const mcpChoice = normalizeInput(await rl.question(`Choose [${hasCodex && !hasProjectMcpEditors ? "1/2" : "1/2/3/4"}] (default ${mcpChoiceDefault}): `)) || mcpChoiceDefault;
|
|
15673
15606
|
const mcpScope = mcpChoice === "2" && hasCodex && !hasProjectMcpEditors ? "skip" : mcpChoice === "4" ? "skip" : mcpChoice === "1" ? "global" : mcpChoice === "2" ? "project" : "both";
|
|
15674
|
-
const mcpServer =
|
|
15607
|
+
const mcpServer = buildContextStreamMcpServer({ apiUrl, apiKey, toolset });
|
|
15675
15608
|
const mcpServerClaude = buildContextStreamMcpServer({ apiUrl, apiKey, toolset });
|
|
15676
|
-
const vsCodeServer =
|
|
15609
|
+
const vsCodeServer = buildContextStreamVsCodeServer({ apiUrl, apiKey, toolset });
|
|
15677
15610
|
const needsGlobalMcpConfig = mcpScope === "global" || mcpScope === "both" || mcpScope === "project" && hasCodex;
|
|
15678
15611
|
if (needsGlobalMcpConfig) {
|
|
15679
15612
|
console.log("\nInstalling global MCP config...");
|
|
@@ -15687,8 +15620,7 @@ Detected plan: ${planLabel} (graph: ${graphTierLabel})`);
|
|
|
15687
15620
|
console.log(`- ${EDITOR_LABELS[editor]}: would update ${filePath}`);
|
|
15688
15621
|
continue;
|
|
15689
15622
|
}
|
|
15690
|
-
const
|
|
15691
|
-
const status = await upsertCodexTomlConfig(filePath, codexParams);
|
|
15623
|
+
const status = await upsertCodexTomlConfig(filePath, { apiUrl, apiKey, toolset });
|
|
15692
15624
|
writeActions.push({ kind: "mcp-config", target: filePath, status });
|
|
15693
15625
|
console.log(`- ${EDITOR_LABELS[editor]}: ${status} ${filePath}`);
|
|
15694
15626
|
continue;
|
|
@@ -15721,7 +15653,8 @@ Detected plan: ${planLabel} (graph: ${graphTierLabel})`);
|
|
|
15721
15653
|
}
|
|
15722
15654
|
}
|
|
15723
15655
|
console.log("- Claude Code: global MCP config is best done via `claude mcp add --transport stdio ...` (see docs).");
|
|
15724
|
-
|
|
15656
|
+
const envHint = toolset === "router" ? " --env CONTEXTSTREAM_PROGRESSIVE_MODE=true" : "";
|
|
15657
|
+
console.log(` macOS/Linux: claude mcp add --transport stdio contextstream --scope user --env CONTEXTSTREAM_API_URL=... --env CONTEXTSTREAM_API_KEY=...${envHint} -- npx -y @contextstream/mcp-server`);
|
|
15725
15658
|
console.log(" Windows (native): use `cmd /c npx -y @contextstream/mcp-server` after `--` if `npx` is not found.");
|
|
15726
15659
|
continue;
|
|
15727
15660
|
}
|
|
@@ -15925,17 +15858,16 @@ Applying to ${projects.length} project(s)...`);
|
|
|
15925
15858
|
const skipped = writeActions.filter((a) => a.status === "skipped").length;
|
|
15926
15859
|
const dry = writeActions.filter((a) => a.status === "dry-run").length;
|
|
15927
15860
|
console.log(`Summary: ${created} created, ${updated} updated, ${appended} appended, ${skipped} skipped, ${dry} dry-run.`);
|
|
15928
|
-
const toolsetDesc = toolset === "
|
|
15861
|
+
const toolsetDesc = toolset === "router" ? "~2 meta-tools (router mode)" : "~11 domain tools (consolidated)";
|
|
15929
15862
|
console.log(`Toolset: ${toolset} (${toolsetDesc})`);
|
|
15930
|
-
console.log(`
|
|
15863
|
+
console.log(`Token reduction: ~75% compared to previous versions.`);
|
|
15931
15864
|
}
|
|
15932
15865
|
console.log("\nNext steps:");
|
|
15933
15866
|
console.log("- Restart your editor/CLI after changing MCP config or rules.");
|
|
15934
|
-
console.log("-
|
|
15867
|
+
console.log("- v0.4.x uses consolidated domain tools by default (~11 tools vs ~58 in v0.3.x).");
|
|
15935
15868
|
console.log("- If any tools require UI-based MCP setup (e.g. Cline/Kilo/Roo global), follow https://contextstream.io/docs/mcp.");
|
|
15936
|
-
if (toolset === "
|
|
15937
|
-
console.log("-
|
|
15938
|
-
console.log("- Note: Claude Code/Desktop may warn about large tool contexts. This is expected with the complete toolset.");
|
|
15869
|
+
if (toolset === "router") {
|
|
15870
|
+
console.log("- Router mode uses 2 meta-tools (session_init + context_smart) for ultra-minimal token usage.");
|
|
15939
15871
|
}
|
|
15940
15872
|
} finally {
|
|
15941
15873
|
rl.close();
|
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.
|
|
4
|
+
"version": "0.4.3",
|
|
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",
|