@utilix-tech/mcp 0.26.0 → 0.27.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 +4 -0
- package/README.md +5 -3
- package/dist/index.js +120 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.27.0
|
|
6
|
+
- Add `compute_jwk_thumbprint` tool: RFC 7638 canonical thumbprint of a single JWK, hashed with SHA-256/384/512.
|
|
7
|
+
- Add `calculate_video_bitrate` tool: resulting file size from a video/audio bitrate and duration, or the required bitrate to hit a target file size.
|
|
8
|
+
|
|
5
9
|
## 0.26.0
|
|
6
10
|
- 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
11
|
- Add `calculate_string_distance` tool: Levenshtein edit distance and normalized similarity between two strings, with an optional Damerau (transposition) mode.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/mcp
|
|
2
2
|
|
|
3
|
-
MCP server exposing
|
|
3
|
+
MCP server exposing 141 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
|
|
|
@@ -153,7 +153,7 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
|
|
|
153
153
|
| `convert_timezone` | Convert a date/time between timezones |
|
|
154
154
|
| `convert_iso8601_duration` | Parse an ISO 8601 duration into components and total seconds, or format seconds into a duration string |
|
|
155
155
|
|
|
156
|
-
### Units (
|
|
156
|
+
### Units (19 tools)
|
|
157
157
|
| Tool | Description |
|
|
158
158
|
|------|-------------|
|
|
159
159
|
| `convert_bytes` | Convert between B, KB, MB, GB, TB, KiB, MiB, GiB, TiB |
|
|
@@ -174,12 +174,14 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
|
|
|
174
174
|
| `calculate_discount` | Solve a sale price, amount saved, or discount percent from any one of them, or stack successive discounts in order |
|
|
175
175
|
| `convert_subtitles` | Convert subtitles between SubRip (.srt) and WebVTT (.vtt), with an optional time shift to resync every cue |
|
|
176
176
|
| `calculate_break_even` | Compute the break-even unit count and revenue from fixed costs, variable cost per unit, and price per unit |
|
|
177
|
+
| `calculate_video_bitrate` | Calculate a video's file size from a bitrate and duration, or the bitrate needed to hit a target file size |
|
|
177
178
|
|
|
178
|
-
### API / Network (
|
|
179
|
+
### API / Network (11 tools)
|
|
179
180
|
| Tool | Description |
|
|
180
181
|
|------|-------------|
|
|
181
182
|
| `decode_jwt` | Decode a JWT: header, payload, and expiry |
|
|
182
183
|
| `parse_jwks` | Parse a JWKS (or a single bare JWK): type, use, algorithm, key ID, and size per key |
|
|
184
|
+
| `compute_jwk_thumbprint` | Compute the RFC 7638 canonical thumbprint of a single JWK (SHA-256/384/512) |
|
|
183
185
|
| `build_curl` | Build a cURL command from method, URL, headers, and body |
|
|
184
186
|
| `curl_to_code` | Convert a cURL command to fetch, axios, Python, Go, PHP, or Ruby |
|
|
185
187
|
| `cors_headers` | Generate CORS response headers for a configuration |
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
+
import { createHash } from "crypto";
|
|
7
8
|
import {
|
|
8
9
|
parseJson,
|
|
9
10
|
minifyJson,
|
|
@@ -2826,6 +2827,61 @@ server.tool("parse_jwks", "Parse a JSON Web Key Set (or a single bare JWK) and s
|
|
|
2826
2827
|
if ("error" in result) return errText(result);
|
|
2827
2828
|
return text(JSON.stringify(result, null, 2));
|
|
2828
2829
|
});
|
|
2830
|
+
var _JWK_THUMBPRINT_MEMBERS = {
|
|
2831
|
+
oct: ["k", "kty"],
|
|
2832
|
+
RSA: ["e", "kty", "n"],
|
|
2833
|
+
EC: ["crv", "kty", "x", "y"],
|
|
2834
|
+
OKP: ["crv", "kty", "x"]
|
|
2835
|
+
};
|
|
2836
|
+
var _JWK_THUMBPRINT_NODE_HASH = {
|
|
2837
|
+
"SHA-256": "sha256",
|
|
2838
|
+
"SHA-384": "sha384",
|
|
2839
|
+
"SHA-512": "sha512"
|
|
2840
|
+
};
|
|
2841
|
+
function _computeJwkThumbprint(input, hashAlg) {
|
|
2842
|
+
const trimmed = input.trim();
|
|
2843
|
+
if (!trimmed) return { error: "No input provided" };
|
|
2844
|
+
const nodeHash = _JWK_THUMBPRINT_NODE_HASH[hashAlg];
|
|
2845
|
+
if (!nodeHash) return { error: 'hashAlg must be one of "SHA-256", "SHA-384", "SHA-512"' };
|
|
2846
|
+
let jwk;
|
|
2847
|
+
try {
|
|
2848
|
+
jwk = JSON.parse(trimmed);
|
|
2849
|
+
} catch (e) {
|
|
2850
|
+
return { error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` };
|
|
2851
|
+
}
|
|
2852
|
+
if (jwk === null || typeof jwk !== "object" || Array.isArray(jwk)) {
|
|
2853
|
+
return { error: "Input must be a single JWK object, not a JWKS set or array" };
|
|
2854
|
+
}
|
|
2855
|
+
const obj = jwk;
|
|
2856
|
+
const kty = obj.kty;
|
|
2857
|
+
if (typeof kty !== "string") return { error: 'JWK must have a "kty" (key type) member' };
|
|
2858
|
+
const members = _JWK_THUMBPRINT_MEMBERS[kty];
|
|
2859
|
+
if (!members) return { error: `Unsupported key type "${kty}": supported types are RSA, EC, oct, OKP` };
|
|
2860
|
+
const canonical = {};
|
|
2861
|
+
for (const m of members) {
|
|
2862
|
+
const v = obj[m];
|
|
2863
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
2864
|
+
return { error: `JWK is missing required member "${m}" for key type "${kty}"` };
|
|
2865
|
+
}
|
|
2866
|
+
canonical[m] = v;
|
|
2867
|
+
}
|
|
2868
|
+
const canonicalJson = "{" + members.map((m) => `${JSON.stringify(m)}:${JSON.stringify(canonical[m])}`).join(",") + "}";
|
|
2869
|
+
const thumbprint = createHash(nodeHash).update(canonicalJson, "utf8").digest("base64url");
|
|
2870
|
+
return { kty, hashAlg, members, canonicalJson, thumbprint };
|
|
2871
|
+
}
|
|
2872
|
+
server.tool(
|
|
2873
|
+
"compute_jwk_thumbprint",
|
|
2874
|
+
"Compute the RFC 7638 thumbprint of a single JWK: canonicalize its required members into lexicographically-ordered, whitespace-free JSON and hash it. A fingerprint for identifying/matching a key, not a signature or verification. Accepts a bare JWK only, not a JWKS set.",
|
|
2875
|
+
{
|
|
2876
|
+
input: z.string().describe("A single JWK object (not a JWKS set)"),
|
|
2877
|
+
hashAlg: z.enum(["SHA-256", "SHA-384", "SHA-512"]).default("SHA-256")
|
|
2878
|
+
},
|
|
2879
|
+
async ({ input, hashAlg }) => {
|
|
2880
|
+
const result = _computeJwkThumbprint(input, hashAlg);
|
|
2881
|
+
if ("error" in result) return errText(result);
|
|
2882
|
+
return text(JSON.stringify(result, null, 2));
|
|
2883
|
+
}
|
|
2884
|
+
);
|
|
2829
2885
|
var _WAV_AUDIO_FORMAT_LABELS = { 1: "PCM", 3: "IEEE float", 6: "A-law", 7: "mu-law", 65534: "Extensible" };
|
|
2830
2886
|
function _readWavAscii4(bytes, offset) {
|
|
2831
2887
|
return String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);
|
|
@@ -4436,5 +4492,69 @@ server.tool(
|
|
|
4436
4492
|
return text(JSON.stringify(result, null, 2));
|
|
4437
4493
|
}
|
|
4438
4494
|
);
|
|
4495
|
+
function _calculateVideoBitrateMcp(mode, durationSeconds, videoBitrateKbps, audioBitrateKbps, targetSizeMB) {
|
|
4496
|
+
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
|
|
4497
|
+
return { error: "durationSeconds must be a positive number" };
|
|
4498
|
+
}
|
|
4499
|
+
if (!Number.isFinite(audioBitrateKbps) || audioBitrateKbps < 0) {
|
|
4500
|
+
return { error: "audioBitrateKbps must be zero or a positive number" };
|
|
4501
|
+
}
|
|
4502
|
+
const round2 = (n) => Math.round(n * 100) / 100;
|
|
4503
|
+
if (mode === "size-from-bitrate") {
|
|
4504
|
+
if (typeof videoBitrateKbps !== "number" || !Number.isFinite(videoBitrateKbps) || videoBitrateKbps <= 0) {
|
|
4505
|
+
return { error: 'videoBitrateKbps must be a positive number for mode "size-from-bitrate"' };
|
|
4506
|
+
}
|
|
4507
|
+
const totalBitrateKbps = videoBitrateKbps + audioBitrateKbps;
|
|
4508
|
+
const fileSizeBytes = totalBitrateKbps * 1e3 * durationSeconds / 8;
|
|
4509
|
+
return {
|
|
4510
|
+
mode,
|
|
4511
|
+
durationSeconds,
|
|
4512
|
+
videoBitrateKbps: round2(videoBitrateKbps),
|
|
4513
|
+
audioBitrateKbps: round2(audioBitrateKbps),
|
|
4514
|
+
totalBitrateKbps: round2(totalBitrateKbps),
|
|
4515
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
4516
|
+
fileSizeMB: round2(fileSizeBytes / 1e6),
|
|
4517
|
+
fileSizeMiB: round2(fileSizeBytes / 1048576)
|
|
4518
|
+
};
|
|
4519
|
+
}
|
|
4520
|
+
if (mode === "bitrate-from-size") {
|
|
4521
|
+
if (typeof targetSizeMB !== "number" || !Number.isFinite(targetSizeMB) || targetSizeMB <= 0) {
|
|
4522
|
+
return { error: 'targetSizeMB must be a positive number for mode "bitrate-from-size"' };
|
|
4523
|
+
}
|
|
4524
|
+
const fileSizeBytes = targetSizeMB * 1e6;
|
|
4525
|
+
const totalBitrateKbps = fileSizeBytes * 8 / (1e3 * durationSeconds);
|
|
4526
|
+
const videoKbps = totalBitrateKbps - audioBitrateKbps;
|
|
4527
|
+
if (videoKbps <= 0) {
|
|
4528
|
+
return { error: "audioBitrateKbps exceeds the total bitrate available at this target size and duration; lower the audio bitrate or raise the target size" };
|
|
4529
|
+
}
|
|
4530
|
+
return {
|
|
4531
|
+
mode,
|
|
4532
|
+
durationSeconds,
|
|
4533
|
+
videoBitrateKbps: round2(videoKbps),
|
|
4534
|
+
audioBitrateKbps: round2(audioBitrateKbps),
|
|
4535
|
+
totalBitrateKbps: round2(totalBitrateKbps),
|
|
4536
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
4537
|
+
fileSizeMB: round2(targetSizeMB),
|
|
4538
|
+
fileSizeMiB: round2(fileSizeBytes / 1048576)
|
|
4539
|
+
};
|
|
4540
|
+
}
|
|
4541
|
+
return { error: 'mode must be "size-from-bitrate" or "bitrate-from-size"' };
|
|
4542
|
+
}
|
|
4543
|
+
server.tool(
|
|
4544
|
+
"calculate_video_bitrate",
|
|
4545
|
+
"Calculate the video file size from a target bitrate and duration, or the required bitrate to hit a target file size, with an optional separate audio bitrate. Pure arithmetic (file size bytes = total bitrate bits/sec * duration seconds / 8); no container parsing or encoding is performed.",
|
|
4546
|
+
{
|
|
4547
|
+
mode: z.enum(["size-from-bitrate", "bitrate-from-size"]).describe("size-from-bitrate requires videoBitrateKbps; bitrate-from-size requires targetSizeMB"),
|
|
4548
|
+
durationSeconds: z.number().describe("Video duration in seconds (must be positive)"),
|
|
4549
|
+
videoBitrateKbps: z.number().optional().describe('Required for mode "size-from-bitrate"'),
|
|
4550
|
+
audioBitrateKbps: z.number().default(0).describe("Optional for either mode"),
|
|
4551
|
+
targetSizeMB: z.number().optional().describe('Required for mode "bitrate-from-size"; decimal MB (1 MB = 1,000,000 bytes)')
|
|
4552
|
+
},
|
|
4553
|
+
async ({ mode, durationSeconds, videoBitrateKbps, audioBitrateKbps, targetSizeMB }) => {
|
|
4554
|
+
const result = _calculateVideoBitrateMcp(mode, durationSeconds, videoBitrateKbps, audioBitrateKbps, targetSizeMB);
|
|
4555
|
+
if ("error" in result) return errText(result);
|
|
4556
|
+
return text(JSON.stringify(result, null, 2));
|
|
4557
|
+
}
|
|
4558
|
+
);
|
|
4439
4559
|
var transport = new StdioServerTransport();
|
|
4440
4560
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
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",
|