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.
- package/README.md +227 -0
- package/bin/cli.js +17 -17
- package/dist/cli/doctor.js +12 -12
- package/dist/cli/hooks.d.ts +1 -1
- package/dist/cli/hooks.js +13 -13
- package/dist/cli/setup.js +10 -10
- package/dist/cli/utils.d.ts +1 -1
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/middleware/chain.js +1 -1
- package/dist/sandbox/executor.d.ts +1 -1
- package/dist/sandbox/executor.js +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/server.js +4 -4
- package/dist/shared/constants.d.ts +23 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +25 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +3 -0
- package/dist/shared/types.d.ts +2 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +3 -0
- package/dist/shared/utils.d.ts +41 -0
- package/dist/shared/utils.d.ts.map +1 -0
- package/dist/shared/utils.js +101 -0
- package/dist/tools/analyze-context.js +1 -1
- package/dist/tools/code-execute.d.ts +1 -1
- package/dist/tools/code-execute.js +2 -2
- package/dist/tools/context-budget.js +1 -1
- package/dist/tools/dynamic-loader.js +1 -1
- package/dist/tools/lazy-mcp.js +2 -2
- package/dist/tools/lazy-mcp.test.js +2 -2
- package/dist/tools/optimization-tips.js +2 -2
- package/dist/utils/token-counter.js +1 -1
- package/package.json +2 -3
- package/scripts/install.ps1 +19 -19
- package/scripts/install.sh +19 -19
- package/scripts/pre-commit-hook.sh +9 -9
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const ANTHROPIC_MODELS: {
|
|
2
|
+
readonly "claude-opus-4-20250514": {
|
|
3
|
+
readonly name: "Claude Opus 4";
|
|
4
|
+
readonly inputPricePerMillion: 15000000;
|
|
5
|
+
readonly outputPricePerMillion: 75000000;
|
|
6
|
+
readonly contextWindow: 200000;
|
|
7
|
+
};
|
|
8
|
+
readonly "claude-sonnet-4-20250514": {
|
|
9
|
+
readonly name: "Claude Sonnet 4";
|
|
10
|
+
readonly inputPricePerMillion: 3000000;
|
|
11
|
+
readonly outputPricePerMillion: 15000000;
|
|
12
|
+
readonly contextWindow: 200000;
|
|
13
|
+
};
|
|
14
|
+
readonly "claude-3-5-haiku-20241022": {
|
|
15
|
+
readonly name: "Claude 3.5 Haiku";
|
|
16
|
+
readonly inputPricePerMillion: 800000;
|
|
17
|
+
readonly outputPricePerMillion: 4000000;
|
|
18
|
+
readonly contextWindow: 200000;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type AnthropicModel = keyof typeof ANTHROPIC_MODELS;
|
|
22
|
+
export declare const DEFAULT_MODEL: AnthropicModel;
|
|
23
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAE3D,eAAO,MAAM,aAAa,EAAE,cAA2C,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// Anthropic Model Pricing (per million tokens)
|
|
3
|
+
// Updated: December 2025
|
|
4
|
+
// ============================================
|
|
5
|
+
export const ANTHROPIC_MODELS = {
|
|
6
|
+
"claude-opus-4-20250514": {
|
|
7
|
+
name: "Claude Opus 4",
|
|
8
|
+
inputPricePerMillion: 15_000_000, // $15.00 in microdollars
|
|
9
|
+
outputPricePerMillion: 75_000_000, // $75.00 in microdollars
|
|
10
|
+
contextWindow: 200_000,
|
|
11
|
+
},
|
|
12
|
+
"claude-sonnet-4-20250514": {
|
|
13
|
+
name: "Claude Sonnet 4",
|
|
14
|
+
inputPricePerMillion: 3_000_000, // $3.00 in microdollars
|
|
15
|
+
outputPricePerMillion: 15_000_000, // $15.00 in microdollars
|
|
16
|
+
contextWindow: 200_000,
|
|
17
|
+
},
|
|
18
|
+
"claude-3-5-haiku-20241022": {
|
|
19
|
+
name: "Claude 3.5 Haiku",
|
|
20
|
+
inputPricePerMillion: 800_000, // $0.80 in microdollars
|
|
21
|
+
outputPricePerMillion: 4_000_000, // $4.00 in microdollars
|
|
22
|
+
contextWindow: 200_000,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export const DEFAULT_MODEL = "claude-sonnet-4-20250514";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate cost in microdollars for a given number of tokens
|
|
3
|
+
*/
|
|
4
|
+
export declare function calculateCost(model: string, inputTokens: number, outputTokens: number): {
|
|
5
|
+
inputCostMicros: number;
|
|
6
|
+
outputCostMicros: number;
|
|
7
|
+
totalCostMicros: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Format microdollars to human-readable currency string
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatCost(microdollars: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format large numbers with K, M, B suffixes
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatNumber(num: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Generate a URL-safe slug from a string
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateSlug(name: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Calculate context window usage percentage
|
|
23
|
+
*/
|
|
24
|
+
export declare function calculateContextUsage(tokens: number, model: string): number;
|
|
25
|
+
/**
|
|
26
|
+
* Truncate string with ellipsis
|
|
27
|
+
*/
|
|
28
|
+
export declare function truncate(str: string, maxLength: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get start of current month (UTC)
|
|
31
|
+
*/
|
|
32
|
+
export declare function getMonthStart(): Date;
|
|
33
|
+
/**
|
|
34
|
+
* Get start of next month (UTC)
|
|
35
|
+
*/
|
|
36
|
+
export declare function getNextMonthStart(): Date;
|
|
37
|
+
/**
|
|
38
|
+
* Check if a date is within the current month
|
|
39
|
+
*/
|
|
40
|
+
export declare function isCurrentMonth(date: Date): boolean;
|
|
41
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CA+BhF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CASvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAGpC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAMlD"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ANTHROPIC_MODELS } from "./constants";
|
|
2
|
+
/**
|
|
3
|
+
* Calculate cost in microdollars for a given number of tokens
|
|
4
|
+
*/
|
|
5
|
+
export function calculateCost(model, inputTokens, outputTokens) {
|
|
6
|
+
const modelInfo = ANTHROPIC_MODELS[model];
|
|
7
|
+
if (!modelInfo) {
|
|
8
|
+
// Default to Sonnet pricing if model not found
|
|
9
|
+
const defaultModel = ANTHROPIC_MODELS["claude-sonnet-4-20250514"];
|
|
10
|
+
const inputCostMicros = Math.ceil((inputTokens / 1_000_000) * defaultModel.inputPricePerMillion);
|
|
11
|
+
const outputCostMicros = Math.ceil((outputTokens / 1_000_000) * defaultModel.outputPricePerMillion);
|
|
12
|
+
return {
|
|
13
|
+
inputCostMicros,
|
|
14
|
+
outputCostMicros,
|
|
15
|
+
totalCostMicros: inputCostMicros + outputCostMicros,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const inputCostMicros = Math.ceil((inputTokens / 1_000_000) * modelInfo.inputPricePerMillion);
|
|
19
|
+
const outputCostMicros = Math.ceil((outputTokens / 1_000_000) * modelInfo.outputPricePerMillion);
|
|
20
|
+
return {
|
|
21
|
+
inputCostMicros,
|
|
22
|
+
outputCostMicros,
|
|
23
|
+
totalCostMicros: inputCostMicros + outputCostMicros,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Format microdollars to human-readable currency string
|
|
28
|
+
*/
|
|
29
|
+
export function formatCost(microdollars) {
|
|
30
|
+
const dollars = microdollars / 1_000_000;
|
|
31
|
+
if (dollars < 0.01) {
|
|
32
|
+
return `$${dollars.toFixed(6)}`;
|
|
33
|
+
}
|
|
34
|
+
if (dollars < 1) {
|
|
35
|
+
return `$${dollars.toFixed(4)}`;
|
|
36
|
+
}
|
|
37
|
+
return `$${dollars.toFixed(2)}`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Format large numbers with K, M, B suffixes
|
|
41
|
+
*/
|
|
42
|
+
export function formatNumber(num) {
|
|
43
|
+
if (num >= 1_000_000_000) {
|
|
44
|
+
return `${(num / 1_000_000_000).toFixed(1)}B`;
|
|
45
|
+
}
|
|
46
|
+
if (num >= 1_000_000) {
|
|
47
|
+
return `${(num / 1_000_000).toFixed(1)}M`;
|
|
48
|
+
}
|
|
49
|
+
if (num >= 1_000) {
|
|
50
|
+
return `${(num / 1_000).toFixed(1)}K`;
|
|
51
|
+
}
|
|
52
|
+
return num.toString();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate a URL-safe slug from a string
|
|
56
|
+
*/
|
|
57
|
+
export function generateSlug(name) {
|
|
58
|
+
return name
|
|
59
|
+
.toLowerCase()
|
|
60
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
61
|
+
.replace(/^-+|-+$/g, "")
|
|
62
|
+
.substring(0, 50);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Calculate context window usage percentage
|
|
66
|
+
*/
|
|
67
|
+
export function calculateContextUsage(tokens, model) {
|
|
68
|
+
const modelInfo = ANTHROPIC_MODELS[model];
|
|
69
|
+
const contextWindow = modelInfo?.contextWindow ?? 200_000;
|
|
70
|
+
return Math.round((tokens / contextWindow) * 100);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Truncate string with ellipsis
|
|
74
|
+
*/
|
|
75
|
+
export function truncate(str, maxLength) {
|
|
76
|
+
if (str.length <= maxLength)
|
|
77
|
+
return str;
|
|
78
|
+
return str.substring(0, maxLength - 3) + "...";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get start of current month (UTC)
|
|
82
|
+
*/
|
|
83
|
+
export function getMonthStart() {
|
|
84
|
+
const now = new Date();
|
|
85
|
+
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get start of next month (UTC)
|
|
89
|
+
*/
|
|
90
|
+
export function getNextMonthStart() {
|
|
91
|
+
const now = new Date();
|
|
92
|
+
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Check if a date is within the current month
|
|
96
|
+
*/
|
|
97
|
+
export function isCurrentMonth(date) {
|
|
98
|
+
const now = new Date();
|
|
99
|
+
return (date.getUTCFullYear() === now.getUTCFullYear() &&
|
|
100
|
+
date.getUTCMonth() === now.getUTCMonth());
|
|
101
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { encodingForModel } from "js-tiktoken";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { ANTHROPIC_MODELS, calculateCost, formatCost, calculateContextUsage, } from "
|
|
3
|
+
import { ANTHROPIC_MODELS, calculateCost, formatCost, calculateContextUsage, } from "../shared/index.js";
|
|
4
4
|
export const analyzeContextSchema = {
|
|
5
5
|
type: "object",
|
|
6
6
|
properties: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Code Execute Tool
|
|
3
3
|
*
|
|
4
|
-
* Executes TypeScript code with
|
|
4
|
+
* Executes TypeScript code with Distill SDK in a sandboxed environment.
|
|
5
5
|
* Reduces MCP token overhead by ~98% compared to individual tool calls.
|
|
6
6
|
*/
|
|
7
7
|
import type { ToolDefinition } from "./registry.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Code Execute Tool
|
|
3
3
|
*
|
|
4
|
-
* Executes TypeScript code with
|
|
4
|
+
* Executes TypeScript code with Distill SDK in a sandboxed environment.
|
|
5
5
|
* Reduces MCP token overhead by ~98% compared to individual tool calls.
|
|
6
6
|
*/
|
|
7
7
|
import { executeSandbox, DEFAULT_LIMITS } from "../sandbox/index.js";
|
|
@@ -67,7 +67,7 @@ async function executeCodeExecute(args) {
|
|
|
67
67
|
/**
|
|
68
68
|
* Tool description with SDK reference
|
|
69
69
|
*/
|
|
70
|
-
const DESCRIPTION = `Execute TypeScript with
|
|
70
|
+
const DESCRIPTION = `Execute TypeScript with Distill SDK. 98% fewer tokens than tool calls.
|
|
71
71
|
|
|
72
72
|
SDK (ctx):
|
|
73
73
|
compress: auto(content,hint?) logs(logs) diff(diff) semantic(content,ratio?)
|
|
@@ -8,7 +8,7 @@ import { z } from "zod";
|
|
|
8
8
|
import { countTokens } from "../utils/token-counter.js";
|
|
9
9
|
import { detectContentType } from "../utils/content-detector.js";
|
|
10
10
|
import { estimateOutputTokens } from "../utils/output-estimator.js";
|
|
11
|
-
import { ANTHROPIC_MODELS, DEFAULT_MODEL, calculateCost, formatCost, calculateContextUsage, } from "
|
|
11
|
+
import { ANTHROPIC_MODELS, DEFAULT_MODEL, calculateCost, formatCost, calculateContextUsage, } from "../shared/index.js";
|
|
12
12
|
/**
|
|
13
13
|
* JSON Schema for MCP tool registration
|
|
14
14
|
*/
|
|
@@ -30,7 +30,7 @@ export const TOOL_CATALOG = [
|
|
|
30
30
|
name: "code_execute",
|
|
31
31
|
category: "core",
|
|
32
32
|
keywords: ["execute", "code", "sdk", "typescript", "script", "sandbox"],
|
|
33
|
-
description: "Execute TypeScript with
|
|
33
|
+
description: "Execute TypeScript with Distill SDK (98% token savings)",
|
|
34
34
|
loader: async () => (await import("./code-execute.js")).codeExecuteTool,
|
|
35
35
|
},
|
|
36
36
|
// Compress category
|
package/dist/tools/lazy-mcp.js
CHANGED
|
@@ -33,7 +33,7 @@ async function executeBrowseTools(args) {
|
|
|
33
33
|
categories.set(tool.category, (categories.get(tool.category) || 0) + 1);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const lines = ["
|
|
36
|
+
const lines = ["distill/", ""];
|
|
37
37
|
for (const [cat, count] of categories) {
|
|
38
38
|
lines.push(` ${cat}/ (${count} tools)`);
|
|
39
39
|
}
|
|
@@ -48,7 +48,7 @@ async function executeBrowseTools(args) {
|
|
|
48
48
|
content: [{ type: "text", text: `No tools in category: ${category}` }],
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
const lines = [`
|
|
51
|
+
const lines = [`distill/${category}/`, ""];
|
|
52
52
|
for (const tool of tools) {
|
|
53
53
|
lines.push(` ${tool.name}: ${tool.description}`);
|
|
54
54
|
}
|
|
@@ -18,7 +18,7 @@ describe("Lazy MCP Pattern", () => {
|
|
|
18
18
|
it("should list categories when no category specified", async () => {
|
|
19
19
|
const result = await browseToolsTool.execute({});
|
|
20
20
|
const text = result.content[0]?.text ?? "";
|
|
21
|
-
expect(text).toContain("
|
|
21
|
+
expect(text).toContain("distill/");
|
|
22
22
|
expect(text).toContain("compress/");
|
|
23
23
|
expect(text).toContain("analyze/");
|
|
24
24
|
expect(text).toContain("logs/");
|
|
@@ -28,7 +28,7 @@ describe("Lazy MCP Pattern", () => {
|
|
|
28
28
|
it("should list tools in a specific category", async () => {
|
|
29
29
|
const result = await browseToolsTool.execute({ category: "compress" });
|
|
30
30
|
const text = result.content[0]?.text ?? "";
|
|
31
|
-
expect(text).toContain("
|
|
31
|
+
expect(text).toContain("distill/compress/");
|
|
32
32
|
expect(text).toContain("compress_context");
|
|
33
33
|
expect(text).toContain("semantic_compress");
|
|
34
34
|
});
|
|
@@ -125,8 +125,8 @@ export async function optimizationTips(args, _config) {
|
|
|
125
125
|
const result = `${tips}
|
|
126
126
|
|
|
127
127
|
---
|
|
128
|
-
*Tips from
|
|
129
|
-
*Learn more at https://
|
|
128
|
+
*Tips from Distill - LLM Token Optimization*
|
|
129
|
+
*Learn more at https://distill.dev*`;
|
|
130
130
|
return {
|
|
131
131
|
content: [{ type: "text", text: result }],
|
|
132
132
|
};
|
|
@@ -16,7 +16,7 @@ function getEncoder() {
|
|
|
16
16
|
encoder = encodingForModel("gpt-4");
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
19
|
-
console.error("[
|
|
19
|
+
console.error("[distill] Failed to initialize tiktoken encoder:", error);
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "distill-mcp",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-beta",
|
|
4
4
|
"description": "Distill - MCP Server for LLM token optimization and context compression",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"test:coverage": "vitest run --coverage"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ctxopt/shared": "workspace:*",
|
|
33
32
|
"@huggingface/transformers": "^3.8.1",
|
|
34
33
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
35
34
|
"js-tiktoken": "^1.0.15",
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
],
|
|
57
56
|
"repository": {
|
|
58
57
|
"type": "git",
|
|
59
|
-
"url": "https://github.com/ArthurDEV44/
|
|
58
|
+
"url": "https://github.com/ArthurDEV44/distill.git",
|
|
60
59
|
"directory": "packages/mcp-server"
|
|
61
60
|
},
|
|
62
61
|
"license": "MIT"
|
package/scripts/install.ps1
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
# https://
|
|
1
|
+
# Distill MCP Server Installation Script for Windows
|
|
2
|
+
# https://distill.dev
|
|
3
3
|
#
|
|
4
4
|
# Usage:
|
|
5
|
-
# irm https://
|
|
5
|
+
# irm https://distill.dev/install.ps1 | iex
|
|
6
6
|
#
|
|
7
7
|
# This script will:
|
|
8
8
|
# 1. Detect your package manager
|
|
9
|
-
# 2. Install
|
|
9
|
+
# 2. Install distill-mcp globally
|
|
10
10
|
# 3. Auto-configure detected IDEs (Claude Code, Cursor, Windsurf)
|
|
11
11
|
# 4. Verify the installation
|
|
12
12
|
|
|
@@ -50,13 +50,13 @@ function Test-NodeVersion {
|
|
|
50
50
|
function Install-Package {
|
|
51
51
|
param([string]$PackageManager)
|
|
52
52
|
|
|
53
|
-
Write-Info "Installing
|
|
53
|
+
Write-Info "Installing distill-mcp using $PackageManager..."
|
|
54
54
|
|
|
55
55
|
switch ($PackageManager) {
|
|
56
|
-
"bun" { bun install -g
|
|
57
|
-
"npm" { npm install -g
|
|
58
|
-
"yarn" { yarn global add
|
|
59
|
-
"pnpm" { pnpm add -g
|
|
56
|
+
"bun" { bun install -g distill-mcp }
|
|
57
|
+
"npm" { npm install -g distill-mcp }
|
|
58
|
+
"yarn" { yarn global add distill-mcp }
|
|
59
|
+
"pnpm" { pnpm add -g distill-mcp }
|
|
60
60
|
default {
|
|
61
61
|
Write-Error "No supported package manager found."
|
|
62
62
|
Write-Host ""
|
|
@@ -74,7 +74,7 @@ function Install-Package {
|
|
|
74
74
|
function Main {
|
|
75
75
|
Write-Host ""
|
|
76
76
|
Write-Host "================================================" -ForegroundColor Cyan
|
|
77
|
-
Write-Host "
|
|
77
|
+
Write-Host " Distill MCP Server Installation" -ForegroundColor Cyan
|
|
78
78
|
Write-Host "================================================" -ForegroundColor Cyan
|
|
79
79
|
Write-Host ""
|
|
80
80
|
|
|
@@ -96,12 +96,12 @@ function Main {
|
|
|
96
96
|
|
|
97
97
|
# Verify installation
|
|
98
98
|
Write-Host ""
|
|
99
|
-
if (Get-Command
|
|
100
|
-
$version =
|
|
99
|
+
if (Get-Command distill-mcp -ErrorAction SilentlyContinue) {
|
|
100
|
+
$version = distill-mcp --version 2>$null
|
|
101
101
|
if (-not $version) { $version = "unknown" }
|
|
102
|
-
Write-Success "
|
|
102
|
+
Write-Success "distill-mcp v$version is now available"
|
|
103
103
|
} else {
|
|
104
|
-
Write-Warning "
|
|
104
|
+
Write-Warning "distill-mcp not found in PATH. You may need to restart your terminal."
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
# Run setup
|
|
@@ -109,11 +109,11 @@ function Main {
|
|
|
109
109
|
Write-Info "Configuring IDEs..."
|
|
110
110
|
Write-Host ""
|
|
111
111
|
|
|
112
|
-
if (Get-Command
|
|
113
|
-
|
|
112
|
+
if (Get-Command distill-mcp -ErrorAction SilentlyContinue) {
|
|
113
|
+
distill-mcp setup
|
|
114
114
|
} else {
|
|
115
115
|
# Fallback to npx if global install didn't add to PATH yet
|
|
116
|
-
npx
|
|
116
|
+
npx distill-mcp setup
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
# Final message
|
|
@@ -122,10 +122,10 @@ function Main {
|
|
|
122
122
|
Write-Host ""
|
|
123
123
|
Write-Host "Next steps:"
|
|
124
124
|
Write-Host " 1. Restart your IDE to load the MCP server"
|
|
125
|
-
Write-Host " 2. Run '
|
|
125
|
+
Write-Host " 2. Run 'distill-mcp doctor' to verify everything is working"
|
|
126
126
|
Write-Host ""
|
|
127
127
|
Write-Host "Documentation: " -NoNewline
|
|
128
|
-
Write-Host "https://
|
|
128
|
+
Write-Host "https://distill.dev/docs" -ForegroundColor Cyan
|
|
129
129
|
Write-Host ""
|
|
130
130
|
}
|
|
131
131
|
|
package/scripts/install.sh
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
# https://
|
|
3
|
+
# Distill MCP Server Installation Script
|
|
4
|
+
# https://distill.dev
|
|
5
5
|
#
|
|
6
6
|
# Usage:
|
|
7
|
-
# curl -fsSL https://
|
|
7
|
+
# curl -fsSL https://distill.dev/install.sh | bash
|
|
8
8
|
#
|
|
9
9
|
# This script will:
|
|
10
10
|
# 1. Detect your OS and package manager
|
|
11
|
-
# 2. Install
|
|
11
|
+
# 2. Install distill-mcp globally
|
|
12
12
|
# 3. Auto-configure detected IDEs (Claude Code, Cursor, Windsurf)
|
|
13
13
|
# 4. Verify the installation
|
|
14
14
|
|
|
@@ -92,20 +92,20 @@ check_node() {
|
|
|
92
92
|
install_package() {
|
|
93
93
|
local pm=$1
|
|
94
94
|
|
|
95
|
-
log "Installing
|
|
95
|
+
log "Installing distill-mcp using $pm..."
|
|
96
96
|
|
|
97
97
|
case "$pm" in
|
|
98
98
|
bun)
|
|
99
|
-
bun install -g
|
|
99
|
+
bun install -g distill-mcp
|
|
100
100
|
;;
|
|
101
101
|
npm)
|
|
102
|
-
npm install -g
|
|
102
|
+
npm install -g distill-mcp
|
|
103
103
|
;;
|
|
104
104
|
yarn)
|
|
105
|
-
yarn global add
|
|
105
|
+
yarn global add distill-mcp
|
|
106
106
|
;;
|
|
107
107
|
pnpm)
|
|
108
|
-
pnpm add -g
|
|
108
|
+
pnpm add -g distill-mcp
|
|
109
109
|
;;
|
|
110
110
|
*)
|
|
111
111
|
error "No supported package manager found."
|
|
@@ -125,7 +125,7 @@ install_package() {
|
|
|
125
125
|
main() {
|
|
126
126
|
echo ""
|
|
127
127
|
echo -e "${BOLD}${CYAN}╔══════════════════════════════════════════╗${NC}"
|
|
128
|
-
echo -e "${BOLD}${CYAN}║
|
|
128
|
+
echo -e "${BOLD}${CYAN}║ Distill MCP Server Installation ║${NC}"
|
|
129
129
|
echo -e "${BOLD}${CYAN}╚══════════════════════════════════════════╝${NC}"
|
|
130
130
|
echo ""
|
|
131
131
|
|
|
@@ -148,11 +148,11 @@ main() {
|
|
|
148
148
|
|
|
149
149
|
# Verify installation
|
|
150
150
|
echo ""
|
|
151
|
-
if command -v
|
|
152
|
-
VERSION=$(
|
|
153
|
-
success "
|
|
151
|
+
if command -v distill-mcp &> /dev/null; then
|
|
152
|
+
VERSION=$(distill-mcp --version 2>/dev/null || echo "unknown")
|
|
153
|
+
success "distill-mcp v$VERSION is now available"
|
|
154
154
|
else
|
|
155
|
-
warn "
|
|
155
|
+
warn "distill-mcp not found in PATH. You may need to restart your terminal."
|
|
156
156
|
fi
|
|
157
157
|
|
|
158
158
|
# Run setup
|
|
@@ -160,11 +160,11 @@ main() {
|
|
|
160
160
|
log "Configuring IDEs..."
|
|
161
161
|
echo ""
|
|
162
162
|
|
|
163
|
-
if command -v
|
|
164
|
-
|
|
163
|
+
if command -v distill-mcp &> /dev/null; then
|
|
164
|
+
distill-mcp setup
|
|
165
165
|
else
|
|
166
166
|
# Fallback to npx if global install didn't add to PATH yet
|
|
167
|
-
npx
|
|
167
|
+
npx distill-mcp setup
|
|
168
168
|
fi
|
|
169
169
|
|
|
170
170
|
# Final message
|
|
@@ -173,9 +173,9 @@ main() {
|
|
|
173
173
|
echo ""
|
|
174
174
|
echo "Next steps:"
|
|
175
175
|
echo " 1. Restart your IDE to load the MCP server"
|
|
176
|
-
echo " 2. Run '
|
|
176
|
+
echo " 2. Run 'distill-mcp doctor' to verify everything is working"
|
|
177
177
|
echo ""
|
|
178
|
-
echo -e "Documentation: ${CYAN}https://
|
|
178
|
+
echo -e "Documentation: ${CYAN}https://distill.dev/docs${NC}"
|
|
179
179
|
echo ""
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
# Distill Pre-commit Hook
|
|
4
4
|
#
|
|
5
5
|
# Warns about files with high token counts that may cause issues
|
|
6
6
|
# with AI coding assistants.
|
|
7
7
|
#
|
|
8
8
|
# Installation:
|
|
9
|
-
#
|
|
9
|
+
# distill-mcp setup --hooks
|
|
10
10
|
# OR
|
|
11
11
|
# cp scripts/pre-commit-hook.sh .git/hooks/pre-commit
|
|
12
12
|
# chmod +x .git/hooks/pre-commit
|
|
@@ -24,17 +24,17 @@ GREEN='\033[0;32m'
|
|
|
24
24
|
CYAN='\033[0;36m'
|
|
25
25
|
NC='\033[0m' # No Color
|
|
26
26
|
|
|
27
|
-
# Check if
|
|
28
|
-
if ! command -v
|
|
27
|
+
# Check if distill-mcp is installed
|
|
28
|
+
if ! command -v distill-mcp &> /dev/null; then
|
|
29
29
|
# Try npx as fallback
|
|
30
30
|
if command -v npx &> /dev/null; then
|
|
31
|
-
CTXOPT_CMD="npx @anthropic-ai/
|
|
31
|
+
CTXOPT_CMD="npx @anthropic-ai/distill-mcp"
|
|
32
32
|
else
|
|
33
|
-
echo -e "${YELLOW}Warning:
|
|
33
|
+
echo -e "${YELLOW}Warning: distill-mcp not found. Skipping token analysis.${NC}"
|
|
34
34
|
exit 0
|
|
35
35
|
fi
|
|
36
36
|
else
|
|
37
|
-
CTXOPT_CMD="
|
|
37
|
+
CTXOPT_CMD="distill-mcp"
|
|
38
38
|
fi
|
|
39
39
|
|
|
40
40
|
# Get staged files (only source code files)
|
|
@@ -54,7 +54,7 @@ for file in $STAGED_FILES; do
|
|
|
54
54
|
fi
|
|
55
55
|
|
|
56
56
|
# Get token count using a simple wc-based estimate
|
|
57
|
-
# More accurate counting requires the full
|
|
57
|
+
# More accurate counting requires the full distill-mcp analyze
|
|
58
58
|
LINES=$(wc -l < "$file" 2>/dev/null || echo "0")
|
|
59
59
|
WORDS=$(wc -w < "$file" 2>/dev/null || echo "0")
|
|
60
60
|
|
|
@@ -72,7 +72,7 @@ done
|
|
|
72
72
|
if [ "$WARNINGS" -gt 0 ]; then
|
|
73
73
|
echo ""
|
|
74
74
|
echo -e "${YELLOW}$WARNINGS file(s) may have high token counts.${NC}"
|
|
75
|
-
echo -e "Consider using
|
|
75
|
+
echo -e "Consider using Distill tools when working with these files:"
|
|
76
76
|
echo -e " - ${CYAN}smart_file_read${NC}: Extract specific functions/classes"
|
|
77
77
|
echo -e " - ${CYAN}code_skeleton${NC}: Get signatures only"
|
|
78
78
|
echo ""
|