distill-mcp 0.6.1-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.
@@ -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,4 @@
1
+ export * from "./types";
2
+ export * from "./constants";
3
+ export * from "./utils";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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,3 @@
1
+ export * from "./types";
2
+ export * from "./constants";
3
+ export * from "./utils";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.d.ts.map
@@ -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,3 @@
1
+ // Shared types
2
+ // Add types here as needed
3
+ export {};
@@ -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 "@distill/shared";
3
+ import { ANTHROPIC_MODELS, calculateCost, formatCost, calculateContextUsage, } from "../shared/index.js";
4
4
  export const analyzeContextSchema = {
5
5
  type: "object",
6
6
  properties: {
@@ -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 "@distill/shared";
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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "distill-mcp",
3
- "version": "0.6.1-beta",
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
- "@distill/shared": "workspace:*",
33
32
  "@huggingface/transformers": "^3.8.1",
34
33
  "@modelcontextprotocol/sdk": "^1.0.0",
35
34
  "js-tiktoken": "^1.0.15",