mcp-devutils 1.4.0 → 1.6.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.
Files changed (3) hide show
  1. package/README.md +12 -2
  2. package/index.js +313 -1
  3. package/package.json +14 -3
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mcp-devutils
2
2
 
3
- MCP server with **30 developer utilities** for Claude Desktop, Cursor, and any MCP-compatible AI assistant.
3
+ MCP server with **39 developer utilities** for Claude Desktop, Cursor, and any MCP-compatible AI assistant.
4
4
 
5
5
  ## Install
6
6
 
@@ -15,7 +15,7 @@ MCP server with **30 developer utilities** for Claude Desktop, Cursor, and any M
15
15
  }
16
16
  ```
17
17
 
18
- ## Tools (30)
18
+ ## Tools (39)
19
19
 
20
20
  | Tool | Description |
21
21
  |------|-------------|
@@ -48,6 +48,16 @@ MCP server with **30 developer utilities** for Claude Desktop, Cursor, and any M
48
48
  | `password_strength` | Analyze password entropy and strength |
49
49
  | `data_size` | Convert between bytes/KB/MB/GB/TB (SI + IEC) |
50
50
  | `string_escape` | Escape strings for JSON/CSV/regex/SQL/shell |
51
+ | `nanoid` | Generate compact, URL-safe unique IDs |
52
+ | `csv_json` | Convert between CSV and JSON |
53
+ | `hex_encode` | Hex encode/decode text |
54
+ | `char_info` | Unicode character info (codepoint, UTF-8 bytes, HTML entity) |
55
+ | `byte_count` | Count string bytes in UTF-8/UTF-16/ASCII |
56
+ | `json_diff` | Compare two JSON objects — show added/removed/changed |
57
+ | `jwt_create` | Create HS256 JWT tokens for API testing |
58
+ | `sql_format` | Format SQL queries with proper indentation |
59
+ | `json_query` | Extract values from JSON using dot-notation paths |
60
+ | `epoch_convert` | Convert epoch timestamps across multiple timezones |
51
61
 
52
62
  ## Zero dependencies
53
63
 
package/index.js CHANGED
@@ -5,7 +5,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
5
5
  import crypto from "crypto";
6
6
 
7
7
  const server = new Server(
8
- { name: "mcp-devutils", version: "1.4.0" },
8
+ { name: "mcp-devutils", version: "1.6.0" },
9
9
  { capabilities: { tools: {} } }
10
10
  );
11
11
 
@@ -405,6 +405,125 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
405
405
  },
406
406
  required: ["text", "format"]
407
407
  }
408
+ },
409
+ {
410
+ name: "nanoid",
411
+ description: "Generate compact, URL-safe unique IDs (like UUID but shorter). Customizable length and alphabet.",
412
+ inputSchema: {
413
+ type: "object",
414
+ properties: {
415
+ length: { type: "number", description: "ID length (default: 21)" },
416
+ alphabet: { type: "string", description: "Custom alphabet (default: A-Za-z0-9_-)" },
417
+ count: { type: "number", description: "Number of IDs to generate (default: 1, max: 10)" }
418
+ }
419
+ }
420
+ },
421
+ {
422
+ name: "csv_json",
423
+ description: "Convert between CSV and JSON. CSV→JSON parses CSV text into an array of objects. JSON→CSV converts an array of objects to CSV.",
424
+ inputSchema: {
425
+ type: "object",
426
+ properties: {
427
+ input: { type: "string", description: "CSV text or JSON string to convert" },
428
+ direction: { type: "string", enum: ["csv_to_json", "json_to_csv"], description: "Conversion direction" },
429
+ delimiter: { type: "string", description: "CSV delimiter (default: comma)" }
430
+ },
431
+ required: ["input", "direction"]
432
+ }
433
+ },
434
+ {
435
+ name: "hex_encode",
436
+ description: "Encode text to hexadecimal or decode hex back to text",
437
+ inputSchema: {
438
+ type: "object",
439
+ properties: {
440
+ text: { type: "string", description: "Text to encode or hex string to decode" },
441
+ action: { type: "string", enum: ["encode", "decode"], description: "Action (default: encode)" }
442
+ },
443
+ required: ["text"]
444
+ }
445
+ },
446
+ {
447
+ name: "char_info",
448
+ description: "Get Unicode character info — codepoint, name category, UTF-8 bytes, HTML entity for each character in the input",
449
+ inputSchema: {
450
+ type: "object",
451
+ properties: {
452
+ text: { type: "string", description: "Characters to analyze (1-20 chars)" }
453
+ },
454
+ required: ["text"]
455
+ }
456
+ },
457
+ {
458
+ name: "byte_count",
459
+ description: "Count the byte length of a string in UTF-8, UTF-16, and ASCII. Useful for checking API payload sizes and database field limits.",
460
+ inputSchema: {
461
+ type: "object",
462
+ properties: {
463
+ text: { type: "string", description: "Text to measure" }
464
+ },
465
+ required: ["text"]
466
+ }
467
+ },
468
+ {
469
+ name: "json_diff",
470
+ description: "Compare two JSON objects and show the differences — added, removed, and changed keys. Useful for debugging API responses, config changes, and state diffs.",
471
+ inputSchema: {
472
+ type: "object",
473
+ properties: {
474
+ a: { type: "string", description: "First JSON string" },
475
+ b: { type: "string", description: "Second JSON string" }
476
+ },
477
+ required: ["a", "b"]
478
+ }
479
+ },
480
+ {
481
+ name: "jwt_create",
482
+ description: "Create a JWT token signed with HS256. Useful for testing APIs, mocking auth, and generating test tokens.",
483
+ inputSchema: {
484
+ type: "object",
485
+ properties: {
486
+ payload: { type: "string", description: "JSON string for the JWT payload (e.g. {\"sub\":\"1234\",\"name\":\"Test\"})" },
487
+ secret: { type: "string", description: "Secret key for HS256 signing (default: 'secret')" },
488
+ expiresIn: { type: "number", description: "Expiration in seconds from now (default: 3600)" }
489
+ },
490
+ required: ["payload"]
491
+ }
492
+ },
493
+ {
494
+ name: "sql_format",
495
+ description: "Format a SQL query with proper indentation and keyword capitalization. Supports SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, and JOIN queries.",
496
+ inputSchema: {
497
+ type: "object",
498
+ properties: {
499
+ sql: { type: "string", description: "SQL query to format" },
500
+ uppercase: { type: "boolean", description: "Uppercase SQL keywords (default: true)" }
501
+ },
502
+ required: ["sql"]
503
+ }
504
+ },
505
+ {
506
+ name: "json_query",
507
+ description: "Extract values from a JSON object using dot-notation paths (e.g. 'user.address.city', 'items[0].name', 'data[*].id'). Useful for quickly inspecting nested API responses.",
508
+ inputSchema: {
509
+ type: "object",
510
+ properties: {
511
+ json: { type: "string", description: "JSON string to query" },
512
+ path: { type: "string", description: "Dot-notation path (e.g. 'user.name', 'items[0]', 'data[*].id')" }
513
+ },
514
+ required: ["json", "path"]
515
+ }
516
+ },
517
+ {
518
+ name: "epoch_convert",
519
+ description: "Convert between epoch milliseconds, seconds, and human-readable dates across multiple timezones. Shows UTC, US Eastern, US Pacific, Europe/London, and Asia/Singapore.",
520
+ inputSchema: {
521
+ type: "object",
522
+ properties: {
523
+ value: { type: "string", description: "Epoch seconds, epoch milliseconds, or ISO date string. Leave empty for current time." },
524
+ timezone: { type: "string", description: "Additional IANA timezone to show (e.g. 'Asia/Tokyo')" }
525
+ }
526
+ }
408
527
  }
409
528
  ]
410
529
  };
@@ -1306,6 +1425,199 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1306
1425
  return { content: [{ type: "text", text: result }] };
1307
1426
  }
1308
1427
 
1428
+ case "nanoid": {
1429
+ const len = Math.min(Math.max(args.length || 21, 1), 128);
1430
+ const alphabet = args.alphabet || "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
1431
+ const count = Math.min(Math.max(args.count || 1, 1), 10);
1432
+ const ids = [];
1433
+ for (let i = 0; i < count; i++) {
1434
+ const bytes = crypto.randomBytes(len);
1435
+ let id = "";
1436
+ for (let j = 0; j < len; j++) {
1437
+ id += alphabet[bytes[j] % alphabet.length];
1438
+ }
1439
+ ids.push(id);
1440
+ }
1441
+ return { content: [{ type: "text", text: ids.join("\n") }] };
1442
+ }
1443
+
1444
+ case "csv_json": {
1445
+ const { input, direction, delimiter = "," } = args;
1446
+ if (direction === "csv_to_json") {
1447
+ const lines = input.split("\n").filter(l => l.trim());
1448
+ if (lines.length < 1) throw new Error("CSV must have at least a header row");
1449
+ const headers = lines[0].split(delimiter).map(h => h.trim().replace(/^"|"$/g, ""));
1450
+ const rows = lines.slice(1).map(line => {
1451
+ const vals = line.split(delimiter).map(v => v.trim().replace(/^"|"$/g, ""));
1452
+ const obj = {};
1453
+ headers.forEach((h, i) => { obj[h] = vals[i] || ""; });
1454
+ return obj;
1455
+ });
1456
+ return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] };
1457
+ } else {
1458
+ const arr = JSON.parse(input);
1459
+ if (!Array.isArray(arr) || arr.length === 0) throw new Error("Input must be a non-empty JSON array");
1460
+ const headers = Object.keys(arr[0]);
1461
+ const csvLines = [headers.join(delimiter)];
1462
+ for (const row of arr) {
1463
+ csvLines.push(headers.map(h => {
1464
+ const val = String(row[h] ?? "");
1465
+ return val.includes(delimiter) || val.includes('"') || val.includes("\n")
1466
+ ? `"${val.replace(/"/g, '""')}"` : val;
1467
+ }).join(delimiter));
1468
+ }
1469
+ return { content: [{ type: "text", text: csvLines.join("\n") }] };
1470
+ }
1471
+ }
1472
+
1473
+ case "hex_encode": {
1474
+ const action = args.action || "encode";
1475
+ if (action === "encode") {
1476
+ return { content: [{ type: "text", text: Buffer.from(args.text, "utf-8").toString("hex") }] };
1477
+ } else {
1478
+ const hex = args.text.replace(/\s/g, "");
1479
+ return { content: [{ type: "text", text: Buffer.from(hex, "hex").toString("utf-8") }] };
1480
+ }
1481
+ }
1482
+
1483
+ case "char_info": {
1484
+ const chars = [...args.text].slice(0, 20);
1485
+ const info = chars.map(ch => {
1486
+ const cp = ch.codePointAt(0);
1487
+ const hex = cp.toString(16).toUpperCase().padStart(4, "0");
1488
+ const utf8Bytes = Buffer.from(ch, "utf-8");
1489
+ const htmlEntity = cp < 128 ? `&#${cp};` : `&#x${hex};`;
1490
+ return `'${ch}' U+${hex} decimal: ${cp} UTF-8: ${[...utf8Bytes].map(b => b.toString(16).padStart(2, "0")).join(" ")} HTML: ${htmlEntity}`;
1491
+ });
1492
+ return { content: [{ type: "text", text: info.join("\n") }] };
1493
+ }
1494
+
1495
+ case "byte_count": {
1496
+ const text = args.text;
1497
+ const utf8 = Buffer.byteLength(text, "utf-8");
1498
+ const utf16 = Buffer.byteLength(text, "utf-16le");
1499
+ const ascii = text.length; // JS string length
1500
+ const chars = [...text].length; // actual character count (handles surrogate pairs)
1501
+ return {
1502
+ content: [{ type: "text", text: JSON.stringify({
1503
+ characters: chars,
1504
+ js_length: text.length,
1505
+ utf8_bytes: utf8,
1506
+ utf16_bytes: utf16,
1507
+ ascii_bytes: ascii
1508
+ }, null, 2) }]
1509
+ };
1510
+ }
1511
+
1512
+ case "json_diff": {
1513
+ const objA = JSON.parse(args.a);
1514
+ const objB = JSON.parse(args.b);
1515
+ const diffs = [];
1516
+ const diffObj = (a, b, prefix = "") => {
1517
+ const allKeys = new Set([...Object.keys(a || {}), ...Object.keys(b || {})]);
1518
+ for (const key of allKeys) {
1519
+ const path = prefix ? `${prefix}.${key}` : key;
1520
+ if (!(key in (a || {}))) {
1521
+ diffs.push({ path, type: "added", value: b[key] });
1522
+ } else if (!(key in (b || {}))) {
1523
+ diffs.push({ path, type: "removed", value: a[key] });
1524
+ } else if (typeof a[key] === "object" && typeof b[key] === "object" && a[key] !== null && b[key] !== null && !Array.isArray(a[key]) && !Array.isArray(b[key])) {
1525
+ diffObj(a[key], b[key], path);
1526
+ } else if (JSON.stringify(a[key]) !== JSON.stringify(b[key])) {
1527
+ diffs.push({ path, type: "changed", from: a[key], to: b[key] });
1528
+ }
1529
+ }
1530
+ };
1531
+ diffObj(objA, objB);
1532
+ if (diffs.length === 0) {
1533
+ return { content: [{ type: "text", text: "No differences found." }] };
1534
+ }
1535
+ return { content: [{ type: "text", text: JSON.stringify(diffs, null, 2) }] };
1536
+ }
1537
+
1538
+ case "jwt_create": {
1539
+ const payload = JSON.parse(args.payload);
1540
+ const secret = args.secret || "secret";
1541
+ const expiresIn = args.expiresIn || 3600;
1542
+ const header = { alg: "HS256", typ: "JWT" };
1543
+ const now = Math.floor(Date.now() / 1000);
1544
+ payload.iat = payload.iat || now;
1545
+ payload.exp = payload.exp || now + expiresIn;
1546
+ const b64url = (obj) => Buffer.from(JSON.stringify(obj)).toString("base64url");
1547
+ const headerB64 = b64url(header);
1548
+ const payloadB64 = b64url(payload);
1549
+ const signature = crypto.createHmac("sha256", secret).update(`${headerB64}.${payloadB64}`).digest("base64url");
1550
+ const token = `${headerB64}.${payloadB64}.${signature}`;
1551
+ return { content: [{ type: "text", text: `Token: ${token}\n\nHeader: ${JSON.stringify(header, null, 2)}\nPayload: ${JSON.stringify(payload, null, 2)}\n\nSigned with: HS256\nExpires: ${new Date(payload.exp * 1000).toISOString()}` }] };
1552
+ }
1553
+
1554
+ case "sql_format": {
1555
+ const { sql, uppercase = true } = args;
1556
+ const keywords = ["SELECT", "FROM", "WHERE", "AND", "OR", "ORDER BY", "GROUP BY", "HAVING", "LIMIT", "OFFSET", "JOIN", "LEFT JOIN", "RIGHT JOIN", "INNER JOIN", "OUTER JOIN", "FULL JOIN", "CROSS JOIN", "ON", "INSERT INTO", "VALUES", "UPDATE", "SET", "DELETE FROM", "CREATE TABLE", "ALTER TABLE", "DROP TABLE", "AS", "IN", "NOT", "NULL", "IS", "BETWEEN", "LIKE", "EXISTS", "UNION", "UNION ALL", "DISTINCT", "CASE", "WHEN", "THEN", "ELSE", "END"];
1557
+ let formatted = sql.replace(/\s+/g, " ").trim();
1558
+ const newlineBefore = ["SELECT", "FROM", "WHERE", "ORDER BY", "GROUP BY", "HAVING", "LIMIT", "JOIN", "LEFT JOIN", "RIGHT JOIN", "INNER JOIN", "OUTER JOIN", "FULL JOIN", "CROSS JOIN", "INSERT INTO", "VALUES", "UPDATE", "SET", "DELETE FROM", "CREATE TABLE", "UNION", "UNION ALL"];
1559
+ for (const kw of newlineBefore) {
1560
+ const regex = new RegExp(`\\b${kw}\\b`, "gi");
1561
+ const replacement = uppercase ? kw : kw.toLowerCase();
1562
+ formatted = formatted.replace(regex, `\n${replacement}`);
1563
+ }
1564
+ const indentAfter = ["AND", "OR"];
1565
+ for (const kw of indentAfter) {
1566
+ const regex = new RegExp(`\\b${kw}\\b`, "gi");
1567
+ const replacement = uppercase ? kw : kw.toLowerCase();
1568
+ formatted = formatted.replace(regex, `\n ${replacement}`);
1569
+ }
1570
+ if (uppercase) {
1571
+ for (const kw of ["ON", "AS", "IN", "NOT", "NULL", "IS", "BETWEEN", "LIKE", "EXISTS", "DISTINCT", "CASE", "WHEN", "THEN", "ELSE", "END"]) {
1572
+ const regex = new RegExp(`\\b${kw}\\b`, "gi");
1573
+ formatted = formatted.replace(regex, kw);
1574
+ }
1575
+ }
1576
+ formatted = formatted.trim();
1577
+ return { content: [{ type: "text", text: formatted }] };
1578
+ }
1579
+
1580
+ case "json_query": {
1581
+ const obj = JSON.parse(args.json);
1582
+ const { path } = args;
1583
+ const parts = path.replace(/\[(\d+)\]/g, ".$1").replace(/\[\*\]/g, ".*").split(".");
1584
+ const resolve = (current, parts) => {
1585
+ if (parts.length === 0) return current;
1586
+ const [head, ...rest] = parts;
1587
+ if (head === "*" && Array.isArray(current)) {
1588
+ return current.map(item => resolve(item, rest));
1589
+ }
1590
+ if (current === null || current === undefined) return undefined;
1591
+ const next = Array.isArray(current) ? current[parseInt(head)] : current[head];
1592
+ return resolve(next, rest);
1593
+ };
1594
+ const result = resolve(obj, parts);
1595
+ return { content: [{ type: "text", text: result === undefined ? "undefined (path not found)" : JSON.stringify(result, null, 2) }] };
1596
+ }
1597
+
1598
+ case "epoch_convert": {
1599
+ const { value, timezone } = args || {};
1600
+ const zones = ["UTC", "America/New_York", "America/Los_Angeles", "Europe/London", "Asia/Singapore"];
1601
+ if (timezone && !zones.includes(timezone)) zones.push(timezone);
1602
+ let date;
1603
+ if (!value) {
1604
+ date = new Date();
1605
+ } else if (/^\d+$/.test(value.trim())) {
1606
+ const num = parseInt(value.trim());
1607
+ date = new Date(num > 1e12 ? num : num * 1000);
1608
+ } else {
1609
+ date = new Date(value);
1610
+ }
1611
+ if (isNaN(date.getTime())) throw new Error(`Invalid date/time: ${value}`);
1612
+ const lines = [`Epoch seconds: ${Math.floor(date.getTime() / 1000)}`, `Epoch milliseconds: ${date.getTime()}`, `ISO 8601: ${date.toISOString()}`, ""];
1613
+ for (const tz of zones) {
1614
+ try {
1615
+ lines.push(`${tz}: ${date.toLocaleString("en-US", { timeZone: tz, dateStyle: "full", timeStyle: "long" })}`);
1616
+ } catch { lines.push(`${tz}: (unsupported timezone)`); }
1617
+ }
1618
+ return { content: [{ type: "text", text: lines.join("\n") }] };
1619
+ }
1620
+
1309
1621
  default:
1310
1622
  throw new Error(`Unknown tool: ${name}`);
1311
1623
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcp-devutils",
3
- "version": "1.4.0",
4
- "description": "MCP server with 30 developer utilities - UUID, hash, HMAC, base64, timestamps, JWT decode, random strings, URL encode/decode, JSON format, regex test, cron explain, color convert, semver compare, HTTP status codes, slugify, HTML escape, chmod calculator, text diff, number base converter, lorem ipsum, word count, CIDR calculator, case converter, markdown TOC, env parser, IP info, password strength, data size converter, string escape",
3
+ "version": "1.6.0",
4
+ "description": "MCP server with 39 developer utilities - UUID, nanoid, hash, HMAC, base64, hex encode, timestamps, JWT decode/create, random strings, URL encode/decode, JSON format/diff/query, CSV/JSON convert, regex test, cron explain, color convert, semver compare, HTTP status codes, slugify, HTML escape, chmod calculator, text diff, number base converter, lorem ipsum, word count, byte count, CIDR calculator, case converter, markdown TOC, env parser, IP info, password strength, data size converter, string escape, char info, SQL format, epoch convert",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "bin": {
@@ -41,7 +41,18 @@
41
41
  "ip-address",
42
42
  "password-strength",
43
43
  "data-size",
44
- "string-escape"
44
+ "string-escape",
45
+ "nanoid",
46
+ "csv-json",
47
+ "hex-encode",
48
+ "unicode",
49
+ "byte-count",
50
+ "json-diff",
51
+ "jwt-create",
52
+ "sql-format",
53
+ "json-query",
54
+ "epoch-convert",
55
+ "timezone"
45
56
  ],
46
57
  "author": "Hong Teoh",
47
58
  "license": "MIT",