@utilix-tech/mcp 0.69.0 → 0.70.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,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.70.0
6
+ - Add `generate_hotp`, `generate_totp` tools: generate an HOTP code (RFC 4226) for a counter value, or the current TOTP code (RFC 6238) plus seconds until rotation, from a base32-encoded shared secret, supporting SHA-1/SHA-256/SHA-512 and 6-8 digit codes.
7
+ - Add `calculate_tax_equivalent_yield` tool: convert between a tax-free municipal bond yield and its taxable equivalent given a marginal federal (plus optional state) tax rate, in both directions.
8
+
5
9
  ## 0.69.0
6
10
  - Add `parse_commit_trailers` tool: parse a commit message's trailer block (Co-authored-by, Signed-off-by, Fixes, Reviewed-by, etc.) per git's RFC 822-style trailer convention, returning each trailer's key and value plus the body with the trailer block removed.
7
11
  - Add `extract_markdown_footnotes` tool: extract every Markdown-Extra-style footnote reference and definition from a document, flagging references with no matching definition and definitions that are never referenced.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @utilix-tech/mcp
2
2
 
3
- MCP server exposing 233 developer utility tools to Claude, Cursor, VS Code Copilot, and any [Model Context Protocol](https://modelcontextprotocol.io) compatible AI assistant.
3
+ MCP server exposing 236 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
 
@@ -179,6 +179,7 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
179
179
  | `calculate_time_value` | Convert between present and future value (time value of money) in either direction |
180
180
  | `calculate_percentage_change` | Compute the percentage change between two numbers, with absolute change, direction, and multiplier |
181
181
  | `convert_apr_apy` | Convert between a nominal APR and effective APY for a given compounding frequency, in both directions |
182
+ | `calculate_tax_equivalent_yield` | Convert between a tax-free municipal bond yield and its taxable equivalent given a marginal federal (plus optional state) tax rate, in both directions |
182
183
  | `calculate_margin_markup` | Given any two of cost, price, margin percent, and markup percent, solve for the other two plus gross profit |
183
184
  | `calculate_discount` | Solve a sale price, amount saved, or discount percent from any one of them, or stack successive discounts in order |
184
185
  | `convert_subtitles` | Convert subtitles between SubRip (.srt) and WebVTT (.vtt), with an optional time shift to resync every cue |
@@ -211,6 +212,8 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
211
212
  | `decode_jwt` | Decode a JWT: header, payload, and expiry |
212
213
  | `parse_jwks` | Parse a JWKS (or a single bare JWK): type, use, algorithm, key ID, and size per key |
213
214
  | `compute_jwk_thumbprint` | Compute the RFC 7638 canonical thumbprint of a single JWK (SHA-256/384/512) |
215
+ | `generate_hotp` | Generate an HOTP code (RFC 4226) for a counter value from a base32-encoded shared secret |
216
+ | `generate_totp` | Generate the current TOTP code (RFC 6238) from a base32-encoded shared secret, plus seconds until rotation |
214
217
  | `build_curl` | Build a cURL command from method, URL, headers, and body |
215
218
  | `curl_to_code` | Convert a cURL command to fetch, axios, Python, Go, PHP, or Ruby |
216
219
  | `cors_headers` | Generate CORS response headers for a configuration |
package/dist/index.js CHANGED
@@ -4,7 +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, randomBytes } from "crypto";
7
+ import { createHash, createHmac, randomBytes } from "crypto";
8
8
  import * as yaml from "js-yaml";
9
9
  import {
10
10
  parseJson,
@@ -11120,5 +11120,149 @@ server.tool(
11120
11120
  return text(JSON.stringify(result, null, 2));
11121
11121
  }
11122
11122
  );
11123
+ function _calculateTaxEquivalentYieldMcp(inputYieldPercent, federalTaxRatePercent, stateTaxRatePercent, direction) {
11124
+ if (typeof inputYieldPercent !== "number" || !Number.isFinite(inputYieldPercent) || inputYieldPercent < 0) {
11125
+ return { error: "Yield must be zero or a positive number" };
11126
+ }
11127
+ if (typeof federalTaxRatePercent !== "number" || !Number.isFinite(federalTaxRatePercent) || federalTaxRatePercent < 0 || federalTaxRatePercent >= 100) {
11128
+ return { error: "Federal tax rate must be a percentage between 0 and 100 (exclusive of 100)" };
11129
+ }
11130
+ const stateRate = stateTaxRatePercent ?? 0;
11131
+ if (typeof stateRate !== "number" || !Number.isFinite(stateRate) || stateRate < 0 || stateRate >= 100) {
11132
+ return { error: "State tax rate must be a percentage between 0 and 100 (exclusive of 100)" };
11133
+ }
11134
+ if (direction !== "tax-free-to-taxable" && direction !== "taxable-to-tax-free") {
11135
+ return { error: 'Direction must be "tax-free-to-taxable" or "taxable-to-tax-free"' };
11136
+ }
11137
+ const combinedTaxRatePercent = federalTaxRatePercent + stateRate;
11138
+ if (combinedTaxRatePercent >= 100) {
11139
+ return { error: "Combined federal and state tax rate must be less than 100%" };
11140
+ }
11141
+ const round6 = (n) => Math.round(n * 1e6) / 1e6;
11142
+ const combinedRateDecimal = combinedTaxRatePercent / 100;
11143
+ let taxFreeYield;
11144
+ let taxableYield;
11145
+ if (direction === "tax-free-to-taxable") {
11146
+ taxFreeYield = inputYieldPercent;
11147
+ taxableYield = taxFreeYield / (1 - combinedRateDecimal);
11148
+ } else {
11149
+ taxableYield = inputYieldPercent;
11150
+ taxFreeYield = taxableYield * (1 - combinedRateDecimal);
11151
+ }
11152
+ return {
11153
+ direction,
11154
+ inputYield: round6(inputYieldPercent),
11155
+ federalTaxRatePercent: round6(federalTaxRatePercent),
11156
+ stateTaxRatePercent: round6(stateRate),
11157
+ combinedTaxRatePercent: round6(combinedTaxRatePercent),
11158
+ taxFreeYield: round6(taxFreeYield),
11159
+ taxableYield: round6(taxableYield),
11160
+ yieldDifference: round6(taxableYield - taxFreeYield)
11161
+ };
11162
+ }
11163
+ server.tool(
11164
+ "calculate_tax_equivalent_yield",
11165
+ 'Convert between a tax-free municipal bond yield and the equivalent taxable-bond yield given a marginal federal tax rate (plus an optional state rate, summed into a combined rate). With direction "tax-free-to-taxable", taxableYield = taxFreeYield / (1 - combinedRate); with "taxable-to-tax-free", taxFreeYield = taxableYield * (1 - combinedRate). Pure formula, no live bond pricing.',
11166
+ {
11167
+ inputYield: z.number().min(0).describe('The known yield as a percent: the tax-free yield when direction is "tax-free-to-taxable", or the taxable yield when direction is "taxable-to-tax-free"'),
11168
+ federalTaxRatePercent: z.number().min(0).max(99.999).describe("Marginal federal tax rate as a percent"),
11169
+ stateTaxRatePercent: z.number().min(0).max(99.999).optional().describe("Optional marginal state tax rate as a percent, summed with the federal rate"),
11170
+ direction: z.enum(["tax-free-to-taxable", "taxable-to-tax-free"]).describe("Which yield the input represents and which to compute")
11171
+ },
11172
+ async ({ inputYield, federalTaxRatePercent, stateTaxRatePercent, direction }) => {
11173
+ const result = _calculateTaxEquivalentYieldMcp(inputYield, federalTaxRatePercent, stateTaxRatePercent ?? 0, direction);
11174
+ if ("error" in result) return errText(result);
11175
+ return text(JSON.stringify(result, null, 2));
11176
+ }
11177
+ );
11178
+ var _OTP_ALG_TO_NODE_HASH_MCP = { SHA1: "sha1", SHA256: "sha256", SHA512: "sha512" };
11179
+ function _decodeBase32SecretMcp(secret) {
11180
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
11181
+ const cleaned = (secret ?? "").toUpperCase().replace(/[\s=]/g, "");
11182
+ if (!cleaned) return { error: "Secret must not be empty" };
11183
+ const bytes = [];
11184
+ let buffer = 0;
11185
+ let bitsLeft = 0;
11186
+ for (const char of cleaned) {
11187
+ const val = alphabet.indexOf(char);
11188
+ if (val === -1) return { error: `Invalid base32 character '${char}' in secret` };
11189
+ buffer = buffer << 5 | val;
11190
+ bitsLeft += 5;
11191
+ if (bitsLeft >= 8) {
11192
+ bitsLeft -= 8;
11193
+ bytes.push(buffer >> bitsLeft & 255);
11194
+ }
11195
+ }
11196
+ return Buffer.from(bytes);
11197
+ }
11198
+ function _hotpFromCounterMcp(keyBytes, counter, digits, algorithm) {
11199
+ const counterBuffer = Buffer.alloc(8);
11200
+ counterBuffer.writeUInt32BE(Math.floor(counter / 4294967296), 0);
11201
+ counterBuffer.writeUInt32BE(counter % 4294967296, 4);
11202
+ const hmac = createHmac(_OTP_ALG_TO_NODE_HASH_MCP[algorithm], keyBytes).update(counterBuffer).digest();
11203
+ const offset = hmac[hmac.length - 1] & 15;
11204
+ const binCode = (hmac[offset] & 127) << 24 | (hmac[offset + 1] & 255) << 16 | (hmac[offset + 2] & 255) << 8 | hmac[offset + 3] & 255;
11205
+ return (binCode % 10 ** digits).toString().padStart(digits, "0");
11206
+ }
11207
+ function _generateHotpMcp(secret, counter, digits, algorithm) {
11208
+ if (!Number.isInteger(counter) || counter < 0) {
11209
+ return { error: "Counter must be a non-negative whole number" };
11210
+ }
11211
+ if (!Number.isInteger(digits) || digits < 6 || digits > 8) {
11212
+ return { error: "Digits must be an integer between 6 and 8" };
11213
+ }
11214
+ if (!(algorithm in _OTP_ALG_TO_NODE_HASH_MCP)) {
11215
+ return { error: "Algorithm must be one of SHA1, SHA256, SHA512" };
11216
+ }
11217
+ const keyBytes = _decodeBase32SecretMcp(secret);
11218
+ if ("error" in keyBytes) return keyBytes;
11219
+ return { code: _hotpFromCounterMcp(keyBytes, counter, digits, algorithm), counter, digits, algorithm };
11220
+ }
11221
+ function _generateTotpMcp(secret, digits, algorithm, periodSeconds, timestamp) {
11222
+ const period = periodSeconds ?? 30;
11223
+ const ts = timestamp ?? Math.floor(Date.now() / 1e3);
11224
+ if (!Number.isFinite(period) || period <= 0) {
11225
+ return { error: "Period must be a positive number of seconds" };
11226
+ }
11227
+ if (!Number.isFinite(ts) || ts < 0) {
11228
+ return { error: "Timestamp must be a non-negative number of seconds" };
11229
+ }
11230
+ const counter = Math.floor(ts / period);
11231
+ const hotp = _generateHotpMcp(secret, counter, digits, algorithm);
11232
+ if ("error" in hotp) return hotp;
11233
+ const secondsRemaining = period - ts % period;
11234
+ return { ...hotp, periodSeconds: period, secondsRemaining };
11235
+ }
11236
+ server.tool(
11237
+ "generate_hotp",
11238
+ "Generate an HOTP code (RFC 4226) for a given counter value from a base32-encoded shared secret. Supports 6-8 digit codes and SHA-1/SHA-256/SHA-512 (SHA-1 is the default per the RFC). The secret is never stored, only used for this one HMAC computation.",
11239
+ {
11240
+ secret: z.string().min(1).describe("The base32-encoded shared secret (RFC 4648, case-insensitive, padding optional)"),
11241
+ counter: z.number().int().min(0).describe("The HOTP counter value"),
11242
+ digits: z.number().int().min(6).max(8).optional().describe("Code length, default 6"),
11243
+ algorithm: z.enum(["SHA1", "SHA256", "SHA512"]).optional().describe("HMAC algorithm, default SHA1")
11244
+ },
11245
+ async ({ secret, counter, digits, algorithm }) => {
11246
+ const result = _generateHotpMcp(secret, counter, digits ?? 6, algorithm ?? "SHA1");
11247
+ if ("error" in result) return errText(result);
11248
+ return text(JSON.stringify(result, null, 2));
11249
+ }
11250
+ );
11251
+ server.tool(
11252
+ "generate_totp",
11253
+ "Generate the current TOTP code (RFC 6238) from a base32-encoded shared secret, plus how many seconds remain before it rotates. Defaults (30s period, 6 digits, SHA-1) match what Google Authenticator and most other authenticator apps use. Pass an explicit timestamp for deterministic/testable output.",
11254
+ {
11255
+ secret: z.string().min(1).describe("The base32-encoded shared secret (RFC 4648, case-insensitive, padding optional)"),
11256
+ digits: z.number().int().min(6).max(8).optional().describe("Code length, default 6"),
11257
+ algorithm: z.enum(["SHA1", "SHA256", "SHA512"]).optional().describe("HMAC algorithm, default SHA1"),
11258
+ periodSeconds: z.number().int().min(1).optional().describe("Time-step window in seconds, default 30"),
11259
+ timestamp: z.number().int().min(0).optional().describe("Unix timestamp in seconds to compute the code for; defaults to the current time")
11260
+ },
11261
+ async ({ secret, digits, algorithm, periodSeconds, timestamp }) => {
11262
+ const result = _generateTotpMcp(secret, digits ?? 6, algorithm ?? "SHA1", periodSeconds ?? 30, timestamp);
11263
+ if ("error" in result) return errText(result);
11264
+ return text(JSON.stringify(result, null, 2));
11265
+ }
11266
+ );
11123
11267
  var transport = new StdioServerTransport();
11124
11268
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilix-tech/mcp",
3
- "version": "0.69.0",
3
+ "version": "0.70.0",
4
4
  "description": "MCP server exposing 198 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",