@utilix-tech/mcp 0.24.0 → 0.26.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
4
4
 
5
+ ## 0.26.0
6
+ - Add `calculate_break_even` tool: break-even unit count and revenue from fixed costs, variable cost per unit, and price per unit, plus profit and margin of safety at an optional sales volume.
7
+ - Add `calculate_string_distance` tool: Levenshtein edit distance and normalized similarity between two strings, with an optional Damerau (transposition) mode.
8
+
9
+ ## 0.25.0
10
+ - Add `calculate_discount` tool: solve a sale price, amount saved, or discount percent from any one of them, or stack successive discounts where 20% then 10% is an effective 28% off.
11
+ - Add `convert_subtitles` tool: convert between SubRip (.srt) and WebVTT (.vtt) with an optional time shift to resync every cue.
12
+
5
13
  ## 0.24.0
6
14
  - Add `calculate_margin_markup` tool: given exactly two of cost, price, margin percent, and markup percent, solve for the other two plus the gross profit.
7
15
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @utilix-tech/mcp
2
2
 
3
- MCP server exposing 135 developer utility tools to Claude, Cursor, VS Code Copilot, and any [Model Context Protocol](https://modelcontextprotocol.io) compatible AI assistant.
3
+ MCP server exposing 137 developer utility tools to Claude, Cursor, VS Code Copilot, and any [Model Context Protocol](https://modelcontextprotocol.io) compatible AI assistant.
4
4
 
5
5
  No API key required. All tools run locally. Requires Node.js 18 or later.
6
6
 
@@ -126,7 +126,7 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
126
126
  | `generate_qr` | Generate a QR code as an SVG string |
127
127
  | `generate_random_data` | Generate random mock data: names, emails, UUIDs, IPs, etc. |
128
128
 
129
- ### Text (12 tools)
129
+ ### Text (13 tools)
130
130
  | Tool | Description |
131
131
  |------|-------------|
132
132
  | `convert_case` | Convert text case: camelCase, snake_case, PascalCase, etc. |
@@ -141,6 +141,7 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
141
141
  | `detect_passive_voice` | Flag sentences written in passive voice, e.g. "was written", "were approved by the team" |
142
142
  | `score_readability` | Score text with Flesch Reading Ease, Flesch-Kincaid Grade Level, and Gunning Fog Index |
143
143
  | `detect_filler_words` | Scan text for filler words, hedge phrases, and clichés with per-phrase counts and a density score |
144
+ | `calculate_string_distance` | Compute the Levenshtein (or Damerau) edit distance and normalized similarity between two strings |
144
145
 
145
146
  ### Time (6 tools)
146
147
  | Tool | Description |
@@ -152,7 +153,7 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
152
153
  | `convert_timezone` | Convert a date/time between timezones |
153
154
  | `convert_iso8601_duration` | Parse an ISO 8601 duration into components and total seconds, or format seconds into a duration string |
154
155
 
155
- ### Units (15 tools)
156
+ ### Units (18 tools)
156
157
  | Tool | Description |
157
158
  |------|-------------|
158
159
  | `convert_bytes` | Convert between B, KB, MB, GB, TB, KiB, MiB, GiB, TiB |
@@ -170,6 +171,9 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
170
171
  | `calculate_percentage_change` | Compute the percentage change between two numbers, with absolute change, direction, and multiplier |
171
172
  | `convert_apr_apy` | Convert between a nominal APR and effective APY for a given compounding frequency, in both directions |
172
173
  | `calculate_margin_markup` | Given any two of cost, price, margin percent, and markup percent, solve for the other two plus gross profit |
174
+ | `calculate_discount` | Solve a sale price, amount saved, or discount percent from any one of them, or stack successive discounts in order |
175
+ | `convert_subtitles` | Convert subtitles between SubRip (.srt) and WebVTT (.vtt), with an optional time shift to resync every cue |
176
+ | `calculate_break_even` | Compute the break-even unit count and revenue from fixed costs, variable cost per unit, and price per unit |
173
177
 
174
178
  ### API / Network (10 tools)
175
179
  | Tool | Description |
package/dist/index.js CHANGED
@@ -4124,5 +4124,317 @@ server.tool(
4124
4124
  return text(JSON.stringify(result, null, 2));
4125
4125
  }
4126
4126
  );
4127
+ var _DISCOUNT_FIELDS_MCP = ["discountPercent", "discountAmount", "finalPrice"];
4128
+ function _calculateDiscountMcp(input) {
4129
+ const provided = (v) => typeof v === "number" && Number.isFinite(v);
4130
+ if (!provided(input.originalPrice)) return { error: "originalPrice is required and must be a finite number" };
4131
+ const originalPrice = input.originalPrice;
4132
+ if (originalPrice <= 0) return { error: "Original price must be greater than zero" };
4133
+ const given = _DISCOUNT_FIELDS_MCP.filter((f) => provided(input[f]));
4134
+ if (given.length !== 1) {
4135
+ return { error: `Provide exactly one of discountPercent, discountAmount, finalPrice (got ${given.length})` };
4136
+ }
4137
+ const field = given[0];
4138
+ let discountAmount;
4139
+ if (field === "discountPercent") {
4140
+ const pct = input.discountPercent;
4141
+ if (pct < 0) return { error: "Discount percent cannot be negative" };
4142
+ if (pct > 100) return { error: "Discount percent cannot exceed 100" };
4143
+ discountAmount = originalPrice * (pct / 100);
4144
+ } else if (field === "discountAmount") {
4145
+ const amt = input.discountAmount;
4146
+ if (amt < 0) return { error: "Discount amount cannot be negative" };
4147
+ if (amt > originalPrice) return { error: "Discount amount cannot exceed the original price" };
4148
+ discountAmount = amt;
4149
+ } else {
4150
+ const fin = input.finalPrice;
4151
+ if (fin < 0) return { error: "Final price cannot be negative" };
4152
+ if (fin > originalPrice) return { error: "Final price cannot exceed the original price: that is a price increase, not a discount" };
4153
+ discountAmount = originalPrice - fin;
4154
+ }
4155
+ const round4 = (n) => Math.round(n * 1e4) / 1e4;
4156
+ return {
4157
+ originalPrice: round4(originalPrice),
4158
+ finalPrice: round4(originalPrice - discountAmount),
4159
+ discountAmount: round4(discountAmount),
4160
+ discountPercent: round4(discountAmount / originalPrice * 100),
4161
+ given: field,
4162
+ solvedFor: _DISCOUNT_FIELDS_MCP.filter((f) => f !== field)
4163
+ };
4164
+ }
4165
+ function _applySuccessiveDiscountsMcp(originalPrice, discountPercents) {
4166
+ if (!Number.isFinite(originalPrice) || originalPrice <= 0) {
4167
+ return { error: "Original price must be a finite number greater than zero" };
4168
+ }
4169
+ if (discountPercents.length === 0) return { error: "Provide at least one discount percent" };
4170
+ if (discountPercents.length > 20) return { error: "Provide at most 20 successive discounts" };
4171
+ const round4 = (n) => Math.round(n * 1e4) / 1e4;
4172
+ const steps = [];
4173
+ let running = originalPrice;
4174
+ let sumOfDiscountPercents = 0;
4175
+ for (const pct of discountPercents) {
4176
+ if (!Number.isFinite(pct)) return { error: "Every discount percent must be a finite number" };
4177
+ if (pct < 0) return { error: "Discount percent cannot be negative" };
4178
+ if (pct > 100) return { error: "Discount percent cannot exceed 100" };
4179
+ const priceBefore = running;
4180
+ const saved = priceBefore * (pct / 100);
4181
+ running = priceBefore - saved;
4182
+ sumOfDiscountPercents += pct;
4183
+ steps.push({ discountPercent: round4(pct), priceBefore: round4(priceBefore), priceAfter: round4(running), saved: round4(saved) });
4184
+ }
4185
+ const totalSaved = originalPrice - running;
4186
+ return {
4187
+ originalPrice: round4(originalPrice),
4188
+ finalPrice: round4(running),
4189
+ totalSaved: round4(totalSaved),
4190
+ effectiveDiscountPercent: round4(totalSaved / originalPrice * 100),
4191
+ sumOfDiscountPercents: round4(sumOfDiscountPercents),
4192
+ steps
4193
+ };
4194
+ }
4195
+ server.tool(
4196
+ "calculate_discount",
4197
+ "Discount / markdown calculator. Give an original price plus exactly one of discountPercent, discountAmount, or finalPrice and the other two are derived. Pass discountPercents instead to stack discounts in sequence, where 20% then a further 10% is an effective 28% off rather than 30%. Pure arithmetic, no live price feed and no tax or shipping.",
4198
+ {
4199
+ originalPrice: z.number().describe("The price before any discount (must be greater than zero)"),
4200
+ discountPercent: z.number().optional().describe("Discount as a percent of the original price (0-100). Provide exactly one of discountPercent, discountAmount, finalPrice."),
4201
+ discountAmount: z.number().optional().describe("Discount as an absolute amount off the original price"),
4202
+ finalPrice: z.number().optional().describe("The price after the discount, to solve for the percent and amount"),
4203
+ discountPercents: z.array(z.number()).optional().describe("Successive discount percents applied in order, each off the running price (max 20). Overrides the single-discount fields when present.")
4204
+ },
4205
+ async ({ originalPrice, discountPercent, discountAmount, finalPrice, discountPercents }) => {
4206
+ const result = discountPercents ? _applySuccessiveDiscountsMcp(originalPrice, discountPercents) : _calculateDiscountMcp({ originalPrice, discountPercent, discountAmount, finalPrice });
4207
+ if ("error" in result) return errText(result);
4208
+ return text(JSON.stringify(result, null, 2));
4209
+ }
4210
+ );
4211
+ var _SUBTITLE_TIMESTAMP_RE_MCP = /(\d+):(\d{1,2}):(\d{1,2})[.,](\d{1,3})|(\d{1,3}):(\d{1,2})[.,](\d{1,3})/;
4212
+ var _VTT_BLOCK_KEYWORDS_MCP = ["NOTE", "STYLE", "REGION"];
4213
+ function _parseSubtitleTimestampMcp(raw) {
4214
+ const m = _SUBTITLE_TIMESTAMP_RE_MCP.exec(raw.trim());
4215
+ if (!m || m.index !== 0) return null;
4216
+ let hours;
4217
+ let minutes;
4218
+ let seconds;
4219
+ let millis;
4220
+ if (m[1] !== void 0) {
4221
+ hours = Number(m[1]);
4222
+ minutes = Number(m[2]);
4223
+ seconds = Number(m[3]);
4224
+ millis = m[4];
4225
+ } else {
4226
+ hours = 0;
4227
+ minutes = Number(m[5]);
4228
+ seconds = Number(m[6]);
4229
+ millis = m[7];
4230
+ }
4231
+ if (minutes > 59 || seconds > 59) return null;
4232
+ return hours * 3600 + minutes * 60 + seconds + Number(millis.padEnd(3, "0")) / 1e3;
4233
+ }
4234
+ function _formatSubtitleTimestampMcp(totalSeconds, format) {
4235
+ const totalMs = Math.round(Math.max(0, totalSeconds) * 1e3);
4236
+ const ms = totalMs % 1e3;
4237
+ const totalSecs = Math.floor(totalMs / 1e3);
4238
+ const pad = (n, width = 2) => String(n).padStart(width, "0");
4239
+ return `${pad(Math.floor(totalSecs / 3600))}:${pad(Math.floor(totalSecs / 60) % 60)}:${pad(totalSecs % 60)}${format === "srt" ? "," : "."}${pad(ms, 3)}`;
4240
+ }
4241
+ function _detectSubtitleFormatMcp(input) {
4242
+ const t = (input.charCodeAt(0) === 65279 ? input.slice(1) : input).trimStart();
4243
+ if (/^WEBVTT/.test(t)) return "vtt";
4244
+ const arrow = /(\d{1,3}):(\d{1,2})(?::(\d{1,2}))?([.,])(\d{1,3})\s*-->/.exec(t);
4245
+ if (arrow && arrow[4] === ".") return "vtt";
4246
+ return "srt";
4247
+ }
4248
+ function _convertSubtitlesMcp(input, target, offsetSeconds) {
4249
+ if (typeof input !== "string" || input.trim().length === 0) return { error: "Subtitle input is empty" };
4250
+ if (!Number.isFinite(offsetSeconds)) return { error: "offsetSeconds must be a finite number" };
4251
+ const sourceFormat = _detectSubtitleFormatMcp(input);
4252
+ const warnings = [];
4253
+ let body = (input.charCodeAt(0) === 65279 ? input.slice(1) : input).replace(/\r\n?/g, "\n");
4254
+ if (sourceFormat === "vtt") {
4255
+ const headerMatch = /^WEBVTT[^\n]*\n?/.exec(body.trimStart());
4256
+ if (headerMatch) body = body.trimStart().slice(headerMatch[0].length);
4257
+ else warnings.push('WebVTT input is missing its "WEBVTT" header line');
4258
+ }
4259
+ const blocks = body.split(/\n[ \t]*\n+/).map((b) => b.trim()).filter((b) => b.length > 0);
4260
+ const cues = [];
4261
+ for (const block of blocks) {
4262
+ const lines = block.split("\n");
4263
+ const arrowIdx = lines.findIndex((l) => l.includes("-->"));
4264
+ if (arrowIdx === -1) {
4265
+ const keyword = _VTT_BLOCK_KEYWORDS_MCP.find((k) => lines[0] === k || lines[0].startsWith(`${k} `));
4266
+ if (sourceFormat === "vtt" && keyword) warnings.push(`Dropped a WebVTT ${keyword} block, which has no SRT equivalent`);
4267
+ else warnings.push(`Skipped a block with no "-->" timing line: ${JSON.stringify(lines[0].slice(0, 40))}`);
4268
+ continue;
4269
+ }
4270
+ const timingLine = lines[arrowIdx];
4271
+ const parts = timingLine.split("-->");
4272
+ const start = _parseSubtitleTimestampMcp(parts[0] ?? "");
4273
+ const rightTrimmed = (parts[1] ?? "").trim();
4274
+ const end = _parseSubtitleTimestampMcp(rightTrimmed);
4275
+ if (start === null || end === null) {
4276
+ warnings.push(`Skipped a cue with an unparseable timing line: ${JSON.stringify(timingLine.slice(0, 60))}`);
4277
+ continue;
4278
+ }
4279
+ const endMatch = _SUBTITLE_TIMESTAMP_RE_MCP.exec(rightTrimmed);
4280
+ const settings = endMatch ? rightTrimmed.slice(endMatch[0].length).trim() : "";
4281
+ const idLines = lines.slice(0, arrowIdx).filter((l) => l.trim().length > 0);
4282
+ const cueText = lines.slice(arrowIdx + 1).join("\n").trim();
4283
+ const cue = { index: cues.length + 1, start, end, text: cueText };
4284
+ if (sourceFormat === "vtt" && idLines.length > 0) cue.id = idLines[idLines.length - 1].trim();
4285
+ if (settings.length > 0) cue.settings = settings;
4286
+ if (end < start) warnings.push(`Cue ${cue.index} ends before it starts`);
4287
+ if (cueText.length === 0) warnings.push(`Cue ${cue.index} has no text`);
4288
+ if (cues.length > 0 && start < cues[cues.length - 1].end) {
4289
+ warnings.push(`Cue ${cue.index} starts before cue ${cue.index - 1} ends (overlapping cues)`);
4290
+ }
4291
+ cues.push(cue);
4292
+ }
4293
+ if (cues.length === 0) return { error: "No subtitle cues found: check that the input is a valid SRT or WebVTT file" };
4294
+ let clamped = 0;
4295
+ const shifted = cues.map((cue) => {
4296
+ const start = cue.start + offsetSeconds;
4297
+ if (start < 0) clamped += 1;
4298
+ return { ...cue, start: Math.max(0, start), end: Math.max(0, cue.end + offsetSeconds) };
4299
+ });
4300
+ if (clamped > 0) warnings.push(`${clamped} cue(s) would start before zero and were clamped to 00:00:00`);
4301
+ if (target === "srt") {
4302
+ const droppedSettings = shifted.filter((c) => c.settings).length;
4303
+ const droppedIds = shifted.filter((c) => c.id).length;
4304
+ if (droppedSettings > 0) warnings.push(`Dropped WebVTT cue settings on ${droppedSettings} cue(s): SRT has no equivalent`);
4305
+ if (droppedIds > 0) warnings.push(`Dropped ${droppedIds} WebVTT cue identifier(s): SRT numbers cues sequentially instead`);
4306
+ }
4307
+ const serialised = shifted.map((cue, i) => {
4308
+ const time = `${_formatSubtitleTimestampMcp(cue.start, target)} --> ${_formatSubtitleTimestampMcp(cue.end, target)}`;
4309
+ if (target === "srt") return `${i + 1}
4310
+ ${time}
4311
+ ${cue.text}`;
4312
+ const timing = cue.settings ? `${time} ${cue.settings}` : time;
4313
+ return cue.id ? `${cue.id}
4314
+ ${timing}
4315
+ ${cue.text}` : `${timing}
4316
+ ${cue.text}`;
4317
+ }).join("\n\n");
4318
+ return {
4319
+ format: target,
4320
+ sourceFormat,
4321
+ output: target === "vtt" ? `WEBVTT
4322
+
4323
+ ${serialised}
4324
+ ` : `${serialised}
4325
+ `,
4326
+ cueCount: shifted.length,
4327
+ duration: Math.round(Math.max(...shifted.map((c) => c.end)) * 1e3) / 1e3,
4328
+ warnings
4329
+ };
4330
+ }
4331
+ server.tool(
4332
+ "convert_subtitles",
4333
+ "Convert a subtitle file between SubRip (.srt) and WebVTT (.vtt), optionally shifting every cue by a fixed number of seconds to resync it. The source format is auto-detected. Converting WebVTT to SRT drops cue identifiers, cue settings, and NOTE/STYLE/REGION blocks, since SubRip has no equivalent; every drop is reported as a warning.",
4334
+ {
4335
+ input: z.string().describe("The full SRT or WebVTT file contents"),
4336
+ target: z.enum(["srt", "vtt"]).default("vtt").describe("Output format"),
4337
+ offsetSeconds: z.number().default(0).describe("Shift every cue by this many seconds (may be negative; results below zero are clamped to 00:00:00)")
4338
+ },
4339
+ async ({ input, target, offsetSeconds }) => {
4340
+ const result = _convertSubtitlesMcp(input, target, offsetSeconds);
4341
+ if ("error" in result) return errText(result);
4342
+ return text(JSON.stringify(result, null, 2));
4343
+ }
4344
+ );
4345
+ function _calculateBreakEvenMcp(fixedCosts, variableCostPerUnit, pricePerUnit, salesVolume) {
4346
+ if (!Number.isFinite(fixedCosts)) return { error: "fixedCosts must be a finite number" };
4347
+ if (!Number.isFinite(variableCostPerUnit)) return { error: "variableCostPerUnit must be a finite number" };
4348
+ if (!Number.isFinite(pricePerUnit)) return { error: "pricePerUnit must be a finite number" };
4349
+ if (fixedCosts < 0) return { error: "fixedCosts cannot be negative" };
4350
+ if (variableCostPerUnit < 0) return { error: "variableCostPerUnit cannot be negative" };
4351
+ if (pricePerUnit <= 0) return { error: "pricePerUnit must be greater than zero" };
4352
+ if (pricePerUnit <= variableCostPerUnit) {
4353
+ return { error: "pricePerUnit must be greater than variableCostPerUnit, otherwise every unit sold loses money and break-even is never reached" };
4354
+ }
4355
+ const round4 = (n) => Math.round(n * 1e4) / 1e4;
4356
+ const contributionMarginPerUnit = pricePerUnit - variableCostPerUnit;
4357
+ const contributionMarginRatio = contributionMarginPerUnit / pricePerUnit * 100;
4358
+ const breakEvenUnits = fixedCosts / contributionMarginPerUnit;
4359
+ const breakEvenUnitsRounded = Math.ceil(breakEvenUnits);
4360
+ const breakEvenRevenue = breakEvenUnits * pricePerUnit;
4361
+ const result = {
4362
+ fixedCosts: round4(fixedCosts),
4363
+ variableCostPerUnit: round4(variableCostPerUnit),
4364
+ pricePerUnit: round4(pricePerUnit),
4365
+ contributionMarginPerUnit: round4(contributionMarginPerUnit),
4366
+ contributionMarginRatio: round4(contributionMarginRatio),
4367
+ breakEvenUnits: round4(breakEvenUnits),
4368
+ breakEvenUnitsRounded,
4369
+ breakEvenRevenue: round4(breakEvenRevenue)
4370
+ };
4371
+ if (typeof salesVolume === "number" && Number.isFinite(salesVolume)) {
4372
+ if (salesVolume < 0) return { error: "salesVolume cannot be negative" };
4373
+ const marginOfSafetyUnits = salesVolume - breakEvenUnits;
4374
+ result.salesVolume = round4(salesVolume);
4375
+ result.revenueAtSalesVolume = round4(salesVolume * pricePerUnit);
4376
+ result.profitAtSalesVolume = round4(salesVolume * contributionMarginPerUnit - fixedCosts);
4377
+ result.marginOfSafetyUnits = round4(marginOfSafetyUnits);
4378
+ result.marginOfSafetyPercent = salesVolume > 0 ? round4(marginOfSafetyUnits / salesVolume * 100) : 0;
4379
+ }
4380
+ return result;
4381
+ }
4382
+ server.tool(
4383
+ "calculate_break_even",
4384
+ "From fixed costs, the variable cost per unit, and the selling price per unit, compute the break-even point: the unit count and revenue at which profit is exactly zero. The price must exceed the variable cost, since otherwise every unit sold loses money and break-even is never reached no matter the volume. Optionally pass a sales volume to also get the profit (or loss) at that volume and the margin of safety above break-even. Pure arithmetic, no live cost/pricing feed.",
4385
+ {
4386
+ fixedCosts: z.number().describe("Total fixed costs for the period (cannot be negative)"),
4387
+ variableCostPerUnit: z.number().describe("Variable cost to produce one unit (cannot be negative)"),
4388
+ pricePerUnit: z.number().describe("Selling price per unit (must be greater than variableCostPerUnit)"),
4389
+ salesVolume: z.number().optional().describe("Optional actual/planned unit sales, to compute profit and margin of safety at that volume")
4390
+ },
4391
+ async ({ fixedCosts, variableCostPerUnit, pricePerUnit, salesVolume }) => {
4392
+ const result = _calculateBreakEvenMcp(fixedCosts, variableCostPerUnit, pricePerUnit, salesVolume);
4393
+ if ("error" in result) return errText(result);
4394
+ return text(JSON.stringify(result, null, 2));
4395
+ }
4396
+ );
4397
+ function _calculateStringDistanceMcp(a, b, mode, caseSensitive) {
4398
+ const MAX_LEN = 5e3;
4399
+ if (a.length > MAX_LEN || b.length > MAX_LEN) return { error: `Strings must be at most ${MAX_LEN} characters` };
4400
+ const s1 = caseSensitive ? a : a.toLowerCase();
4401
+ const s2 = caseSensitive ? b : b.toLowerCase();
4402
+ const m = s1.length;
4403
+ const n = s2.length;
4404
+ const maxLength = Math.max(m, n);
4405
+ if (m === 0 || n === 0) {
4406
+ return { a, b, distance: maxLength, similarity: maxLength === 0 ? 1 : 0, maxLength, mode };
4407
+ }
4408
+ const dp = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
4409
+ for (let i = 0; i <= m; i++) dp[i][0] = i;
4410
+ for (let j = 0; j <= n; j++) dp[0][j] = j;
4411
+ for (let i = 1; i <= m; i++) {
4412
+ for (let j = 1; j <= n; j++) {
4413
+ const cost = s1[i - 1] === s2[j - 1] ? 0 : 1;
4414
+ dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
4415
+ if (mode === "damerau" && i > 1 && j > 1 && s1[i - 1] === s2[j - 2] && s1[i - 2] === s2[j - 1]) {
4416
+ dp[i][j] = Math.min(dp[i][j], dp[i - 2][j - 2] + 1);
4417
+ }
4418
+ }
4419
+ }
4420
+ const distance = dp[m][n];
4421
+ const similarity = maxLength === 0 ? 1 : Math.round((1 - distance / maxLength) * 1e4) / 1e4;
4422
+ return { a, b, distance, similarity, maxLength, mode };
4423
+ }
4424
+ server.tool(
4425
+ "calculate_string_distance",
4426
+ 'Compute the Levenshtein edit distance between two strings: the minimum number of single-character insertions, deletions, and substitutions needed to turn a into b, plus a normalized 0-1 similarity ratio. Pass mode "damerau" to also count an adjacent-character transposition as a single edit (optimal-string-alignment variant, not unrestricted Damerau-Levenshtein).',
4427
+ {
4428
+ a: z.string().describe("The first string (max 5000 characters)"),
4429
+ b: z.string().describe("The second string (max 5000 characters)"),
4430
+ mode: z.enum(["levenshtein", "damerau"]).default("levenshtein").describe("levenshtein counts a transposition as 2 edits; damerau counts it as 1"),
4431
+ caseSensitive: z.boolean().default(true)
4432
+ },
4433
+ async ({ a, b, mode, caseSensitive }) => {
4434
+ const result = _calculateStringDistanceMcp(a, b, mode, caseSensitive);
4435
+ if ("error" in result) return errText(result);
4436
+ return text(JSON.stringify(result, null, 2));
4437
+ }
4438
+ );
4127
4439
  var transport = new StdioServerTransport();
4128
4440
  await server.connect(transport);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@utilix-tech/mcp",
3
- "version": "0.24.0",
4
- "description": "MCP server exposing 125 Utilix developer tools to Claude, Cursor, VS Code Copilot, and any MCP-compatible AI assistant.",
3
+ "version": "0.26.0",
4
+ "description": "MCP server exposing 139 Utilix developer tools to Claude, Cursor, VS Code Copilot, and any MCP-compatible AI assistant.",
5
5
  "author": "Utilix <hello@utilix.tech>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://utilix.tech/mcp",