distill-mcp 0.6.0-beta → 0.6.2-beta

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 (42) hide show
  1. package/README.md +227 -0
  2. package/bin/cli.js +17 -17
  3. package/dist/cli/doctor.js +12 -12
  4. package/dist/cli/hooks.d.ts +1 -1
  5. package/dist/cli/hooks.js +13 -13
  6. package/dist/cli/setup.js +10 -10
  7. package/dist/cli/utils.d.ts +1 -1
  8. package/dist/cli/utils.d.ts.map +1 -1
  9. package/dist/cli/utils.js +3 -3
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +2 -2
  12. package/dist/middleware/chain.js +1 -1
  13. package/dist/sandbox/executor.d.ts +1 -1
  14. package/dist/sandbox/executor.js +1 -1
  15. package/dist/sandbox/index.d.ts +1 -1
  16. package/dist/sandbox/index.js +1 -1
  17. package/dist/server.js +4 -4
  18. package/dist/shared/constants.d.ts +23 -0
  19. package/dist/shared/constants.d.ts.map +1 -0
  20. package/dist/shared/constants.js +25 -0
  21. package/dist/shared/index.d.ts +4 -0
  22. package/dist/shared/index.d.ts.map +1 -0
  23. package/dist/shared/index.js +3 -0
  24. package/dist/shared/types.d.ts +2 -0
  25. package/dist/shared/types.d.ts.map +1 -0
  26. package/dist/shared/types.js +3 -0
  27. package/dist/shared/utils.d.ts +41 -0
  28. package/dist/shared/utils.d.ts.map +1 -0
  29. package/dist/shared/utils.js +101 -0
  30. package/dist/tools/analyze-context.js +1 -1
  31. package/dist/tools/code-execute.d.ts +1 -1
  32. package/dist/tools/code-execute.js +2 -2
  33. package/dist/tools/context-budget.js +1 -1
  34. package/dist/tools/dynamic-loader.js +1 -1
  35. package/dist/tools/lazy-mcp.js +2 -2
  36. package/dist/tools/lazy-mcp.test.js +2 -2
  37. package/dist/tools/optimization-tips.js +2 -2
  38. package/dist/utils/token-counter.js +1 -1
  39. package/package.json +2 -3
  40. package/scripts/install.ps1 +19 -19
  41. package/scripts/install.sh +19 -19
  42. package/scripts/pre-commit-hook.sh +9 -9
package/README.md ADDED
@@ -0,0 +1,227 @@
1
+ # Distill
2
+
3
+ > Extract the essence. Compress the context. Save tokens.
4
+
5
+ **Distill** is an open-source MCP server that optimizes LLM token usage through intelligent context compression. Works with Claude Code, Cursor, and Windsurf.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/distill-mcp.svg)](https://www.npmjs.com/package/distill-mcp)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ ## Why Distill?
11
+
12
+ | Problem | Distill Solution | Savings |
13
+ |---------|------------------|---------|
14
+ | Large build outputs | Auto-compress errors | 80-95% |
15
+ | Reading entire files | AST-based extraction | 50-70% |
16
+ | Multiple tool calls | TypeScript SDK execution | **98%** |
17
+ | Verbose logs | Smart summarization | 80-90% |
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ # Run directly with npx
23
+ npx distill-mcp
24
+
25
+ # Or install globally
26
+ npm install -g distill-mcp
27
+
28
+ # Configure your IDE
29
+ distill-mcp setup
30
+ ```
31
+
32
+ ### Add to Claude Code
33
+
34
+ ```bash
35
+ claude mcp add distill -- npx distill-mcp
36
+ ```
37
+
38
+ ## Features
39
+
40
+ - **Smart File Reading** - Extract functions, classes, or signatures without loading entire files
41
+ - **Auto Compression** - Detects content type and applies optimal compression
42
+ - **Code Execution SDK** - Write TypeScript instead of chaining tool calls
43
+ - **Lazy Loading** - Only loads tools when needed (85% token overhead reduction)
44
+ - **7 Languages** - TypeScript, JavaScript, Python, Go, Rust, PHP, Swift
45
+
46
+ ## MCP Tools
47
+
48
+ ### Core Tools (Always Loaded)
49
+
50
+ | Tool | Purpose | Savings |
51
+ |------|---------|---------|
52
+ | `auto_optimize` | Auto-detect and compress content | 40-95% |
53
+ | `smart_file_read` | Read code with AST extraction | 50-70% |
54
+ | `code_execute` | Execute TypeScript with SDK | **98%** |
55
+ | `discover_tools` | Browse/load additional tools | - |
56
+
57
+ ### On-Demand Tools
58
+
59
+ | Tool | Purpose | Savings |
60
+ |------|---------|---------|
61
+ | `semantic_compress` | TF-IDF based compression | 40-60% |
62
+ | `summarize_logs` | Summarize server/test/build logs | 80-90% |
63
+ | `analyze_build_output` | Parse build errors | 95%+ |
64
+ | `deduplicate_errors` | Group repeated errors | 80-95% |
65
+ | `diff_compress` | Compress git diffs | 50-80% |
66
+ | `context_budget` | Pre-flight token estimation | - |
67
+ | `session_stats` | Usage analytics | - |
68
+
69
+ ## Usage Examples
70
+
71
+ ### Smart File Reading
72
+
73
+ ```bash
74
+ # Get file structure overview
75
+ mcp__distill__smart_file_read filePath="src/server.ts"
76
+
77
+ # Extract specific function
78
+ mcp__distill__smart_file_read filePath="src/server.ts" target={"type":"function","name":"createServer"}
79
+
80
+ # Get skeleton (signatures only)
81
+ mcp__distill__smart_file_read filePath="src/server.ts" skeleton=true
82
+ ```
83
+
84
+ ### Compress Build Output
85
+
86
+ ```bash
87
+ # After a failed build, compress the output
88
+ mcp__distill__auto_optimize content="<paste npm/tsc/webpack output>"
89
+ ```
90
+
91
+ ### Code Execution SDK
92
+
93
+ The `code_execute` tool provides **98% token savings** by letting LLMs write TypeScript:
94
+
95
+ ```bash
96
+ mcp__distill__code_execute code="return ctx.compress.auto(ctx.files.read('logs.txt'))"
97
+ ```
98
+
99
+ **SDK API:**
100
+
101
+ ```typescript
102
+ // File operations
103
+ ctx.files.read(path)
104
+ ctx.files.glob(pattern)
105
+ ctx.files.exists(path)
106
+
107
+ // Code analysis
108
+ ctx.code.skeleton(content, lang)
109
+ ctx.code.extract(content, lang, {type, name})
110
+ ctx.code.parse(content, lang)
111
+
112
+ // Compression
113
+ ctx.compress.auto(content, hint?)
114
+ ctx.compress.logs(logs)
115
+ ctx.compress.diff(diff)
116
+ ctx.compress.semantic(content, ratio?)
117
+
118
+ // Git operations
119
+ ctx.git.diff(ref?)
120
+ ctx.git.log(limit?)
121
+ ctx.git.blame(file, line?)
122
+
123
+ // Search
124
+ ctx.search.grep(pattern, glob?)
125
+ ctx.search.symbols(query)
126
+
127
+ // Analysis
128
+ ctx.analyze.dependencies(file)
129
+ ctx.analyze.callGraph(fn)
130
+ ```
131
+
132
+ ### Discover Tools
133
+
134
+ ```bash
135
+ # Browse available tools (metadata only)
136
+ mcp__distill__discover_tools category="compress"
137
+
138
+ # Load tools when needed
139
+ mcp__distill__discover_tools category="compress" load=true
140
+
141
+ # TOON format for compact output
142
+ mcp__distill__discover_tools format="toon"
143
+ ```
144
+
145
+ ## CLI Commands
146
+
147
+ ```bash
148
+ distill-mcp setup # Auto-configure detected IDEs
149
+ distill-mcp setup --claude # Configure Claude Code only
150
+ distill-mcp setup --cursor # Configure Cursor only
151
+ distill-mcp doctor # Verify installation
152
+ distill-mcp serve # Start MCP server
153
+ distill-mcp analyze # Analyze codebase token usage
154
+ distill-mcp --help # Show help
155
+ ```
156
+
157
+ ## IDE Configuration
158
+
159
+ ### Claude Code
160
+
161
+ After running `distill-mcp setup`, your config will include:
162
+
163
+ ```json
164
+ {
165
+ "mcpServers": {
166
+ "distill": {
167
+ "command": "npx",
168
+ "args": ["distill-mcp", "serve"]
169
+ }
170
+ }
171
+ }
172
+ ```
173
+
174
+ ### Cursor / Windsurf
175
+
176
+ Configuration is automatically added to the appropriate settings file.
177
+
178
+ ## Token Overhead
179
+
180
+ Distill uses **lazy loading** to minimize overhead:
181
+
182
+ | Mode | Tokens | Description |
183
+ |------|--------|-------------|
184
+ | Core only | 264 | Default (4 tools) |
185
+ | All tools | 1,108 | Full suite (21 tools) |
186
+ | **Savings** | **76%** | Lazy vs eager loading |
187
+
188
+ ## Security
189
+
190
+ Code execution runs in a sandboxed environment:
191
+ - Blocked: `eval`, `require`, `import()`, `process`, `global`
192
+ - File access restricted to working directory
193
+ - Sensitive files blocked (`.env`, credentials, keys)
194
+ - Memory limit: 128MB, Timeout: 30s
195
+
196
+ ## Development
197
+
198
+ ```bash
199
+ # Install dependencies
200
+ bun install
201
+
202
+ # Run tests
203
+ bun run test
204
+
205
+ # Build
206
+ bun run build
207
+
208
+ # Start dev server
209
+ bun run dev
210
+ ```
211
+
212
+ ## Contributing
213
+
214
+ Contributions welcome! See [CONTRIBUTING.md](https://github.com/ArthurDEV44/distill/blob/main/CONTRIBUTING.md) for guidelines.
215
+
216
+ **Priority areas:**
217
+ - New language parsers (Java, C#, Kotlin)
218
+ - SDK extensions
219
+ - Documentation
220
+
221
+ ## License
222
+
223
+ MIT
224
+
225
+ ---
226
+
227
+ **[npm](https://www.npmjs.com/package/distill-mcp)** · **[GitHub](https://github.com/ArthurDEV44/distill)** · **[Documentation](https://github.com/ArthurDEV44/distill/tree/main/docs)**
package/bin/cli.js CHANGED
@@ -12,15 +12,15 @@ const command = args[0];
12
12
  function showHelp() {
13
13
  const version = getPackageVersion();
14
14
  console.log(`
15
- ${COLORS.bright}${COLORS.cyan}CtxOpt MCP Server${COLORS.reset} v${version}
16
- Context Engineering Optimizer for Claude Code, Cursor, and Windsurf
15
+ ${COLORS.bright}${COLORS.cyan}Distill MCP Server${COLORS.reset} v${version}
16
+ Extract the essence. Compress the context. Save tokens.
17
17
 
18
18
  ${COLORS.bright}Usage:${COLORS.reset}
19
- ctxopt-mcp <command> [options]
19
+ distill-mcp <command> [options]
20
20
 
21
21
  ${COLORS.bright}Commands:${COLORS.reset}
22
22
  serve Start the MCP server (stdio mode)
23
- setup Configure IDEs to use CtxOpt
23
+ setup Configure IDEs to use Distill
24
24
  doctor Check installation and configuration
25
25
  analyze Analyze files for token usage
26
26
 
@@ -47,20 +47,20 @@ ${COLORS.bright}Other Options:${COLORS.reset}
47
47
  --help, -h Show this help message
48
48
 
49
49
  ${COLORS.bright}Examples:${COLORS.reset}
50
- ctxopt-mcp setup Auto-detect and configure all IDEs
51
- ctxopt-mcp setup --claude Configure Claude Code only
52
- ctxopt-mcp setup --claude --hooks Configure Claude Code + install hooks
53
- ctxopt-mcp setup --hooks Install hooks only (current project)
54
- ctxopt-mcp setup --force Overwrite existing configurations
55
- ctxopt-mcp doctor Verify installation
56
- ctxopt-mcp serve Start MCP server (used by IDE)
57
- ctxopt-mcp serve --lazy Start with lazy mode (95% savings)
58
- ctxopt-mcp serve --verbose Start with verbose logging
59
- ctxopt-mcp analyze Analyze token usage in codebase
60
- ctxopt-mcp analyze -t 5000 --json Custom threshold, JSON output
50
+ distill-mcp setup Auto-detect and configure all IDEs
51
+ distill-mcp setup --claude Configure Claude Code only
52
+ distill-mcp setup --claude --hooks Configure Claude Code + install hooks
53
+ distill-mcp setup --hooks Install hooks only (current project)
54
+ distill-mcp setup --force Overwrite existing configurations
55
+ distill-mcp doctor Verify installation
56
+ distill-mcp serve Start MCP server (used by IDE)
57
+ distill-mcp serve --lazy Start with lazy mode (95% savings)
58
+ distill-mcp serve --verbose Start with verbose logging
59
+ distill-mcp analyze Analyze token usage in codebase
60
+ distill-mcp analyze -t 5000 --json Custom threshold, JSON output
61
61
 
62
62
  ${COLORS.bright}Documentation:${COLORS.reset}
63
- https://ctxopt.dev/docs
63
+ https://distill.dev/docs
64
64
  `);
65
65
  }
66
66
 
@@ -121,7 +121,7 @@ async function main() {
121
121
 
122
122
  default: {
123
123
  console.error(`Unknown command: ${command}`);
124
- console.error('Run "ctxopt-mcp --help" for usage information.');
124
+ console.error('Run "distill-mcp --help" for usage information.');
125
125
  process.exit(1);
126
126
  }
127
127
  }
@@ -1,6 +1,6 @@
1
1
  import { execSync } from "child_process";
2
2
  import { existsSync } from "fs";
3
- import { detectInstalledIDEs, readJSONFile, isCtxOptConfigured, success, warn, error, log, COLORS, getPackageVersion, } from "./utils.js";
3
+ import { detectInstalledIDEs, readJSONFile, isDistillConfigured, success, warn, error, log, COLORS, getPackageVersion, } from "./utils.js";
4
4
  function checkNodeVersion() {
5
5
  try {
6
6
  const version = process.version;
@@ -30,20 +30,20 @@ function checkNodeVersion() {
30
30
  }
31
31
  function checkPackageInstallation() {
32
32
  try {
33
- // Check if ctxopt-mcp is in PATH
33
+ // Check if distill-mcp is in PATH
34
34
  const which = process.platform === "win32" ? "where" : "which";
35
- execSync(`${which} ctxopt-mcp`, { stdio: "pipe" });
35
+ execSync(`${which} distill-mcp`, { stdio: "pipe" });
36
36
  return {
37
37
  name: "Package installation",
38
38
  status: "pass",
39
- message: `@ctxopt/mcp-server v${getPackageVersion()} installed globally`,
39
+ message: `distill-mcp v${getPackageVersion()} installed globally`,
40
40
  };
41
41
  }
42
42
  catch {
43
43
  return {
44
44
  name: "Package installation",
45
45
  status: "warn",
46
- message: "ctxopt-mcp not found in PATH (may be running via npx)",
46
+ message: "distill-mcp not found in PATH (may be running via npx)",
47
47
  };
48
48
  }
49
49
  }
@@ -68,25 +68,25 @@ function checkIDEConfigurations() {
68
68
  });
69
69
  continue;
70
70
  }
71
- if (isCtxOptConfigured(configFile)) {
71
+ if (isDistillConfigured(configFile)) {
72
72
  results.push({
73
73
  name: `${config.name} configuration`,
74
74
  status: "pass",
75
- message: `CtxOpt configured in ${config.configPath}`,
75
+ message: `Distill configured in ${config.configPath}`,
76
76
  });
77
77
  }
78
78
  else {
79
79
  results.push({
80
80
  name: `${config.name} configuration`,
81
81
  status: "fail",
82
- message: `CtxOpt not configured. Run 'ctxopt-mcp setup --${ide}'`,
82
+ message: `Distill not configured. Run 'distill-mcp setup --${ide}'`,
83
83
  });
84
84
  }
85
85
  }
86
86
  return results;
87
87
  }
88
88
  export async function doctor() {
89
- log(`\n${COLORS.bright}${COLORS.cyan}CtxOpt MCP Server Doctor${COLORS.reset}\n`);
89
+ log(`\n${COLORS.bright}${COLORS.cyan}Distill MCP Server Doctor${COLORS.reset}\n`);
90
90
  log(`Running diagnostic checks...\n`);
91
91
  const checks = [
92
92
  checkNodeVersion(),
@@ -114,14 +114,14 @@ export async function doctor() {
114
114
  }
115
115
  log("\n" + "─".repeat(50));
116
116
  if (failCount === 0 && warnCount === 0) {
117
- success(`All ${passCount} checks passed! CtxOpt is ready to use.`);
117
+ success(`All ${passCount} checks passed! Distill is ready to use.`);
118
118
  }
119
119
  else if (failCount === 0) {
120
- warn(`${passCount} passed, ${warnCount} warnings. CtxOpt should work but may have limited functionality.`);
120
+ warn(`${passCount} passed, ${warnCount} warnings. Distill should work but may have limited functionality.`);
121
121
  }
122
122
  else {
123
123
  error(`${passCount} passed, ${warnCount} warnings, ${failCount} failed.`);
124
- log(`\nRun ${COLORS.cyan}ctxopt-mcp setup${COLORS.reset} to fix configuration issues.`);
124
+ log(`\nRun ${COLORS.cyan}distill-mcp setup${COLORS.reset} to fix configuration issues.`);
125
125
  }
126
126
  log("");
127
127
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CtxOpt Hooks Installation Module
2
+ * Distill Hooks Installation Module
3
3
  *
4
4
  * Installs Claude Code hooks that suggest MCP tool usage:
5
5
  * - PreToolUse: Suggests smart_file_read for code files (non-blocking for Edit compatibility)
package/dist/cli/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CtxOpt Hooks Installation Module
2
+ * Distill Hooks Installation Module
3
3
  *
4
4
  * Installs Claude Code hooks that suggest MCP tool usage:
5
5
  * - PreToolUse: Suggests smart_file_read for code files (non-blocking for Edit compatibility)
@@ -13,7 +13,7 @@ import { success, warn, info, error, log, COLORS, readJSONFile, writeJSONFile }
13
13
  // Hook Script Templates
14
14
  // ============================================================================
15
15
  const PRE_READ_CHECK_SCRIPT = `#!/bin/bash
16
- # CtxOpt - PreToolUse Hook for Read
16
+ # Distill - PreToolUse Hook for Read
17
17
  # Suggests smart_file_read for code files (non-blocking to allow Edit to work)
18
18
 
19
19
  INPUT=$(cat)
@@ -35,7 +35,7 @@ fi
35
35
  if echo "$FILE_PATH" | grep -qE "\\.(ts|tsx|js|jsx|py|go|rs|java|cpp|c|h|hpp)$"; then
36
36
  # Use systemMessage to suggest without blocking (allows Edit to work)
37
37
  cat << EOF
38
- {"systemMessage": "TIP: Consider using mcp__ctxopt__smart_file_read for '\$BASENAME' to save 50-70% tokens. Example: mcp__ctxopt__smart_file_read filePath=\\"\$FILE_PATH\\" target={\\"type\\":\\"function\\",\\"name\\":\\"myFunc\\"}"}
38
+ {"systemMessage": "TIP: Consider using mcp__distill__smart_file_read for '\$BASENAME' to save 50-70% tokens. Example: mcp__distill__smart_file_read filePath=\\"\$FILE_PATH\\" target={\\"type\\":\\"function\\",\\"name\\":\\"myFunc\\"}"}
39
39
  EOF
40
40
  exit 0
41
41
  fi
@@ -44,7 +44,7 @@ fi
44
44
  exit 0
45
45
  `;
46
46
  const POST_BASH_REMIND_SCRIPT = `#!/bin/bash
47
- # CtxOpt - PostToolUse Hook for Bash
47
+ # Distill - PostToolUse Hook for Bash
48
48
  # Reminds to use MCP tools for large outputs
49
49
 
50
50
  INPUT=$(cat)
@@ -61,29 +61,29 @@ fi
61
61
 
62
62
  # Detect content type and suggest appropriate tool
63
63
  if echo "$TOOL_RESPONSE" | grep -qiE "(error TS|warning TS|error\\[E|npm ERR|ERROR in|failed|FAILED)"; then
64
- echo '{"systemMessage": "TIP: Large build output detected. Use mcp__ctxopt__auto_optimize to compress errors (95%+ reduction)."}'
64
+ echo '{"systemMessage": "TIP: Large build output detected. Use mcp__distill__auto_optimize to compress errors (95%+ reduction)."}'
65
65
  exit 0
66
66
  fi
67
67
 
68
68
  if echo "$TOOL_RESPONSE" | grep -qiE "(\\[INFO\\]|\\[ERROR\\]|\\[WARN\\]|\\[DEBUG\\]|[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2})"; then
69
- echo '{"systemMessage": "TIP: Large log output detected. Use mcp__ctxopt__summarize_logs to compress (80-90% reduction)."}'
69
+ echo '{"systemMessage": "TIP: Large log output detected. Use mcp__distill__summarize_logs to compress (80-90% reduction)."}'
70
70
  exit 0
71
71
  fi
72
72
 
73
73
  # Generic large output
74
- echo '{"systemMessage": "TIP: Large output ('$RESPONSE_SIZE' chars). Consider using mcp__ctxopt__auto_optimize for compression (40-60% reduction)."}'
74
+ echo '{"systemMessage": "TIP: Large output ('$RESPONSE_SIZE' chars). Consider using mcp__distill__auto_optimize for compression (40-60% reduction)."}'
75
75
  exit 0
76
76
  `;
77
77
  const PROMPT_INJECT_SCRIPT = `#!/bin/bash
78
- # CtxOpt - UserPromptSubmit Hook
78
+ # Distill - UserPromptSubmit Hook
79
79
  # Injects MCP tool reminders at the start of each prompt
80
80
 
81
81
  cat << 'EOF'
82
82
  <user-prompt-submit-hook>
83
- CTXOPT REMINDER: Use MCP tools for token optimization:
84
- - Code files: mcp__ctxopt__smart_file_read (50-70% savings vs Read)
85
- - Build/test output: mcp__ctxopt__auto_optimize
86
- - Session stats: mcp__ctxopt__session_stats
83
+ DISTILL REMINDER: Use MCP tools for token optimization:
84
+ - Code files: mcp__distill__smart_file_read (50-70% savings vs Read)
85
+ - Build/test output: mcp__distill__auto_optimize
86
+ - Session stats: mcp__distill__session_stats
87
87
  </user-prompt-submit-hook>
88
88
  EOF
89
89
  exit 0
@@ -133,7 +133,7 @@ function createHooksConfig() {
133
133
  export async function installHooks(options = {}) {
134
134
  const projectDir = options.projectDir || process.cwd();
135
135
  const force = options.force || false;
136
- log(`\n${COLORS.bright}Installing CtxOpt hooks...${COLORS.reset}\n`);
136
+ log(`\n${COLORS.bright}Installing Distill hooks...${COLORS.reset}\n`);
137
137
  // Check for jq dependency
138
138
  info("Checking dependencies...");
139
139
  const jqCheck = checkJqInstalled();
package/dist/cli/setup.js CHANGED
@@ -1,14 +1,14 @@
1
- import { detectInstalledIDEs, readJSONFile, writeJSONFile, getMCPServerConfig, isCtxOptConfigured, success, warn, error, info, log, COLORS, } from "./utils.js";
1
+ import { detectInstalledIDEs, readJSONFile, writeJSONFile, getMCPServerConfig, isDistillConfigured, success, warn, error, info, log, COLORS, } from "./utils.js";
2
2
  import { installHooks } from "./hooks.js";
3
3
  function configureIDE(ide, config, force) {
4
4
  log(`\nConfiguring ${COLORS.bright}${config.name}${COLORS.reset}...`);
5
5
  const existingConfig = readJSONFile(config.configPath) || {};
6
- if (isCtxOptConfigured(existingConfig) && !force) {
7
- warn(`CtxOpt already configured in ${config.name}. Use --force to overwrite.`);
6
+ if (isDistillConfigured(existingConfig) && !force) {
7
+ warn(`Distill already configured in ${config.name}. Use --force to overwrite.`);
8
8
  return true;
9
9
  }
10
10
  const mcpServers = existingConfig.mcpServers || {};
11
- mcpServers.ctxopt = getMCPServerConfig();
11
+ mcpServers.distill = getMCPServerConfig();
12
12
  existingConfig.mcpServers = mcpServers;
13
13
  if (writeJSONFile(config.configPath, existingConfig)) {
14
14
  success(`Configured ${config.name} at ${config.configPath}`);
@@ -20,7 +20,7 @@ function configureIDE(ide, config, force) {
20
20
  }
21
21
  }
22
22
  export async function setup(options = {}) {
23
- log(`\n${COLORS.bright}${COLORS.cyan}CtxOpt MCP Server Setup${COLORS.reset}\n`);
23
+ log(`\n${COLORS.bright}${COLORS.cyan}Distill MCP Server Setup${COLORS.reset}\n`);
24
24
  const ideConfigs = detectInstalledIDEs();
25
25
  const specificIDEs = options.claude || options.cursor || options.windsurf;
26
26
  const hooksOnly = options.hooks && !specificIDEs;
@@ -53,9 +53,9 @@ export async function setup(options = {}) {
53
53
  log(" • Cursor");
54
54
  log(" • Windsurf");
55
55
  log("\nYou can manually configure by running:");
56
- log(" ctxopt-mcp setup --claude");
57
- log(" ctxopt-mcp setup --cursor");
58
- log(" ctxopt-mcp setup --windsurf");
56
+ log(" distill-mcp setup --claude");
57
+ log(" distill-mcp setup --cursor");
58
+ log(" distill-mcp setup --windsurf");
59
59
  return;
60
60
  }
61
61
  if (idesToConfigure.length > 0) {
@@ -88,8 +88,8 @@ export async function setup(options = {}) {
88
88
  }
89
89
  log(`\n${COLORS.dim}Next steps:${COLORS.reset}`);
90
90
  log(" 1. Restart your IDE to load the MCP server");
91
- log(" 2. Run 'ctxopt-mcp doctor' to verify the installation");
92
- log(` 3. Visit ${COLORS.cyan}https://ctxopt.dev/docs${COLORS.reset} for documentation\n`);
91
+ log(" 2. Run 'distill-mcp doctor' to verify the installation");
92
+ log(` 3. Visit ${COLORS.cyan}https://distill.dev/docs${COLORS.reset} for documentation\n`);
93
93
  }
94
94
  export function parseSetupArgs(args) {
95
95
  const options = {};
@@ -25,6 +25,6 @@ export declare function detectInstalledIDEs(): Record<IDE, IDEConfig>;
25
25
  export declare function readJSONFile(path: string): Record<string, unknown> | null;
26
26
  export declare function writeJSONFile(path: string, data: Record<string, unknown>): boolean;
27
27
  export declare function getMCPServerConfig(): Record<string, unknown>;
28
- export declare function isCtxOptConfigured(config: Record<string, unknown> | null): boolean;
28
+ export declare function isDistillConfigured(config: Record<string, unknown> | null): boolean;
29
29
  export declare function getPackageVersion(): string;
30
30
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,MAAM;;;;;;;;;CASlB,CAAC;AAEF,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAgC1D;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAS5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAUzE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAWlF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM5D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,CAIlF;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,MAAM;;;;;;;;;CASlB,CAAC;AAEF,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAgC1D;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAS5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAUzE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAWlF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM5D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,CAInF;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C"}
package/dist/cli/utils.js CHANGED
@@ -93,16 +93,16 @@ export function writeJSONFile(path, data) {
93
93
  }
94
94
  export function getMCPServerConfig() {
95
95
  return {
96
- command: "ctxopt-mcp",
96
+ command: "distill-mcp",
97
97
  args: ["serve"],
98
98
  env: {},
99
99
  };
100
100
  }
101
- export function isCtxOptConfigured(config) {
101
+ export function isDistillConfigured(config) {
102
102
  if (!config)
103
103
  return false;
104
104
  const mcpServers = config.mcpServers;
105
- return mcpServers?.ctxopt !== undefined;
105
+ return mcpServers?.distill !== undefined;
106
106
  }
107
107
  export function getPackageVersion() {
108
108
  try {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @ctxopt/mcp-server
2
+ * distill-mcp
3
3
  *
4
- * MCP Server for CtxOpt - Context Engineering Optimizer
4
+ * MCP Server for Distill - LLM Token Optimization
5
5
  *
6
6
  * Provides tools for analyzing and optimizing LLM context usage.
7
7
  */
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @ctxopt/mcp-server
2
+ * distill-mcp
3
3
  *
4
- * MCP Server for CtxOpt - Context Engineering Optimizer
4
+ * MCP Server for Distill - LLM Token Optimization
5
5
  *
6
6
  * Provides tools for analyzing and optimizing LLM context usage.
7
7
  */
@@ -44,7 +44,7 @@ export class MiddlewareChain {
44
44
  timestamp: Date.now(),
45
45
  });
46
46
  // Also log for debugging
47
- console.error(`[ctxopt] Middleware ${middlewareName} ${phase} error:`, err.message);
47
+ console.error(`[distill] Middleware ${middlewareName} ${phase} error:`, err.message);
48
48
  }
49
49
  /**
50
50
  * Execute beforeTool hooks for all middlewares
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Sandbox Executor
3
3
  *
4
- * Executes user code in a sandboxed environment with ctxopt SDK.
4
+ * Executes user code in a sandboxed environment with Distill SDK.
5
5
  * Uses Function constructor with restricted scope for isolation.
6
6
  */
7
7
  import type { ExecutionContext, ExecutionResult } from "./types.js";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Sandbox Executor
3
3
  *
4
- * Executes user code in a sandboxed environment with ctxopt SDK.
4
+ * Executes user code in a sandboxed environment with Distill SDK.
5
5
  * Uses Function constructor with restricted scope for isolation.
6
6
  */
7
7
  import * as fs from "fs";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Sandbox Module
3
3
  *
4
- * Provides safe code execution with ctxopt SDK.
4
+ * Provides safe code execution with Distill SDK.
5
5
  */
6
6
  export { executeSandbox } from "./executor.js";
7
7
  export { analyzeCode, sanitizeError } from "./security/index.js";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Sandbox Module
3
3
  *
4
- * Provides safe code execution with ctxopt SDK.
4
+ * Provides safe code execution with Distill SDK.
5
5
  */
6
6
  export { executeSandbox } from "./executor.js";
7
7
  export { analyzeCode, sanitizeError } from "./security/index.js";
package/dist/server.js CHANGED
@@ -45,7 +45,7 @@ export async function createServer(config = {}) {
45
45
  });
46
46
  if (config.verbose) {
47
47
  const savings = calculateLazySavings();
48
- console.error(`[ctxopt] Lazy mode: ${savings.savingsPercent}% token savings`);
48
+ console.error(`[distill] Lazy mode: ${savings.savingsPercent}% token savings`);
49
49
  }
50
50
  }
51
51
  else if (mode === "all") {
@@ -75,7 +75,7 @@ export async function createServer(config = {}) {
75
75
  });
76
76
  // Create MCP server
77
77
  const server = new Server({
78
- name: "@ctxopt/mcp-server",
78
+ name: "distill-mcp",
79
79
  version: "0.1.0",
80
80
  }, {
81
81
  capabilities: {
@@ -124,10 +124,10 @@ export async function runServer(config = {}) {
124
124
  // Handle server close event
125
125
  server.onclose = async () => {
126
126
  if (config.verbose) {
127
- console.error("[ctxopt] Server connection closed");
127
+ console.error("[distill] Server connection closed");
128
128
  }
129
129
  process.exit(0);
130
130
  };
131
131
  await server.connect(transport);
132
- console.error("CtxOpt MCP Server running on stdio");
132
+ console.error("Distill MCP Server running on stdio");
133
133
  }