@utilix-tech/mcp 0.10.0 → 0.11.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,9 @@
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.11.0
6
+ - Added robots.txt Validator (`validate_robots_txt`) and Credit Card Number Validator (`validate_card_number`).
7
+
5
8
  ## 0.10.0
6
9
  - Added Sitemap.xml Validator (`validate_sitemap`).
7
10
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @utilix-tech/mcp
2
2
 
3
- MCP server exposing 107 developer utility tools to Claude, Cursor, VS Code Copilot, and any [Model Context Protocol](https://modelcontextprotocol.io) compatible AI assistant.
3
+ MCP server exposing 109 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
 
@@ -145,13 +145,14 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
145
145
  | `date_diff` | Calculate the difference between two dates |
146
146
  | `convert_timezone` | Convert a date/time between timezones |
147
147
 
148
- ### Units (2 tools)
148
+ ### Units (3 tools)
149
149
  | Tool | Description |
150
150
  |------|-------------|
151
151
  | `convert_bytes` | Convert between B, KB, MB, GB, TB, KiB, MiB, GiB, TiB |
152
152
  | `px_to_units` | Convert pixels to rem, em, pt, and vw |
153
+ | `validate_card_number` | Validate a credit card number via the Luhn checksum and detect its network |
153
154
 
154
- ### API / Network (7 tools)
155
+ ### API / Network (8 tools)
155
156
  | Tool | Description |
156
157
  |------|-------------|
157
158
  | `decode_jwt` | Decode a JWT: header, payload, and expiry |
@@ -161,6 +162,7 @@ claude mcp add utilix -- npx -y @utilix-tech/mcp
161
162
  | `cors_headers` | Generate CORS response headers for a configuration |
162
163
  | `parse_har` | Parse a DevTools .har network export into requests and summary stats |
163
164
  | `validate_sitemap` | Validate a sitemap.xml or sitemap index against the sitemaps.org protocol |
165
+ | `validate_robots_txt` | Validate a robots.txt file: User-agent groups, rules, and directive syntax |
164
166
 
165
167
  ### Color (4 tools)
166
168
  | Tool | Description |
package/dist/index.js CHANGED
@@ -1579,6 +1579,169 @@ server.tool(
1579
1579
  return text(JSON.stringify(result, null, 2));
1580
1580
  }
1581
1581
  );
1582
+ var _KNOWN_ROBOTS_DIRECTIVES = /* @__PURE__ */ new Set(["user-agent", "disallow", "allow", "sitemap", "crawl-delay", "host"]);
1583
+ function _validateRobotsTxt(text2) {
1584
+ if (!text2 || !text2.trim()) return { error: "Input is empty" };
1585
+ const lines = text2.split("\n");
1586
+ const issues = [];
1587
+ const groups = [];
1588
+ const sitemaps = [];
1589
+ let currentGroup = null;
1590
+ for (let i = 0; i < lines.length; i++) {
1591
+ const rawLine = lines[i];
1592
+ const lineNum = i + 1;
1593
+ const commentIdx = rawLine.indexOf("#");
1594
+ const line = (commentIdx >= 0 ? rawLine.slice(0, commentIdx) : rawLine).trim();
1595
+ if (!line) continue;
1596
+ const colonIdx = line.indexOf(":");
1597
+ if (colonIdx === -1) {
1598
+ issues.push({ severity: "error", line: lineNum, message: `Malformed line (missing ':'): "${line}"` });
1599
+ continue;
1600
+ }
1601
+ const directive = line.slice(0, colonIdx).trim().toLowerCase();
1602
+ const value = line.slice(colonIdx + 1).trim();
1603
+ if (!_KNOWN_ROBOTS_DIRECTIVES.has(directive)) {
1604
+ issues.push({ severity: "warning", line: lineNum, message: `Unknown directive "${directive}"` });
1605
+ continue;
1606
+ }
1607
+ if (directive === "sitemap") {
1608
+ if (!/^https?:\/\//i.test(value)) {
1609
+ issues.push({ severity: "error", line: lineNum, message: `Sitemap URL "${value}" must be absolute (start with http:// or https://)` });
1610
+ }
1611
+ sitemaps.push(value);
1612
+ continue;
1613
+ }
1614
+ if (directive === "user-agent") {
1615
+ if (!value) {
1616
+ issues.push({ severity: "error", line: lineNum, message: "User-agent directive is missing a value" });
1617
+ }
1618
+ if (currentGroup && currentGroup.rules.length === 0 && currentGroup.crawlDelay === void 0) {
1619
+ currentGroup.userAgents.push(value);
1620
+ } else {
1621
+ currentGroup = { userAgents: [value], rules: [], line: lineNum };
1622
+ groups.push(currentGroup);
1623
+ }
1624
+ continue;
1625
+ }
1626
+ if (!currentGroup) {
1627
+ issues.push({ severity: "error", line: lineNum, message: `"${directive}" directive found before any User-agent line` });
1628
+ continue;
1629
+ }
1630
+ if (directive === "disallow" || directive === "allow") {
1631
+ if (value !== "" && !value.startsWith("/") && !value.startsWith("*")) {
1632
+ issues.push({ severity: "warning", line: lineNum, message: `${directive === "disallow" ? "Disallow" : "Allow"} value "${value}" should start with "/" (or be empty)` });
1633
+ }
1634
+ if (currentGroup.rules.some((r) => r.type === directive && r.value === value)) {
1635
+ issues.push({ severity: "warning", line: lineNum, message: `Duplicate ${directive} rule for "${value}" in this group` });
1636
+ }
1637
+ currentGroup.rules.push({ type: directive, value, line: lineNum });
1638
+ } else if (directive === "crawl-delay") {
1639
+ const n = Number(value);
1640
+ if (Number.isNaN(n) || n < 0) {
1641
+ issues.push({ severity: "error", line: lineNum, message: `Crawl-delay "${value}" must be a non-negative number` });
1642
+ } else {
1643
+ currentGroup.crawlDelay = n;
1644
+ }
1645
+ }
1646
+ }
1647
+ if (groups.length === 0) {
1648
+ issues.push({ severity: "error", line: 1, message: "No User-agent groups found" });
1649
+ }
1650
+ const seenUA = /* @__PURE__ */ new Map();
1651
+ for (const g of groups) {
1652
+ for (const ua of g.userAgents) {
1653
+ const key = ua.toLowerCase();
1654
+ const firstLine = seenUA.get(key);
1655
+ if (firstLine !== void 0) {
1656
+ issues.push({ severity: "warning", line: g.line, message: `Duplicate User-agent "${ua}" (first seen on line ${firstLine})` });
1657
+ } else {
1658
+ seenUA.set(key, g.line);
1659
+ }
1660
+ }
1661
+ }
1662
+ const valid = !issues.some((i) => i.severity === "error");
1663
+ return { groups, sitemaps, issues, valid };
1664
+ }
1665
+ server.tool(
1666
+ "validate_robots_txt",
1667
+ "Validate a robots.txt file: parse it into User-agent groups and flag structural mistakes \u2014 directives before any User-agent, unknown directives, non-absolute Sitemap URLs, malformed Crawl-delay values, missing leading slashes, and duplicate rules.",
1668
+ { text: z.string().describe("The robots.txt file contents") },
1669
+ async ({ text: robotsTxt }) => {
1670
+ const result = _validateRobotsTxt(robotsTxt);
1671
+ if ("error" in result) return errText(result);
1672
+ return text(JSON.stringify(result, null, 2));
1673
+ }
1674
+ );
1675
+ var _CARD_NETWORK_RULES = [
1676
+ { name: "American Express", lengths: [15], test: (d) => /^3[47]/.test(d) },
1677
+ { name: "Diners Club", lengths: [14], test: (d) => /^3(?:0[0-5]|[68])/.test(d) },
1678
+ {
1679
+ name: "Discover",
1680
+ lengths: [16, 19],
1681
+ test: (d) => /^(?:6011|65|64[4-9])/.test(d) || /^622(?:12[6-9]|1[3-9]\d|[2-8]\d{2}|9[01]\d|92[0-5])/.test(d)
1682
+ },
1683
+ { name: "JCB", lengths: [16], test: (d) => /^35(?:2[89]|[3-8]\d)/.test(d) },
1684
+ {
1685
+ name: "Mastercard",
1686
+ lengths: [16],
1687
+ test: (d) => {
1688
+ const two = parseInt(d.slice(0, 2), 10);
1689
+ const four = parseInt(d.slice(0, 4), 10);
1690
+ return two >= 51 && two <= 55 || four >= 2221 && four <= 2720;
1691
+ }
1692
+ },
1693
+ { name: "Maestro", lengths: [12, 13, 14, 15, 16, 17, 18, 19], test: (d) => /^(?:50|5[6-8]|6304|6390|67)/.test(d) },
1694
+ { name: "UnionPay", lengths: [16, 17, 18, 19], test: (d) => /^62/.test(d) },
1695
+ { name: "Visa", lengths: [13, 16, 19], test: (d) => /^4/.test(d) }
1696
+ ];
1697
+ function _luhnCheck(digits) {
1698
+ let sum = 0;
1699
+ let shouldDouble = false;
1700
+ for (let i = digits.length - 1; i >= 0; i--) {
1701
+ let d = parseInt(digits[i], 10);
1702
+ if (shouldDouble) {
1703
+ d *= 2;
1704
+ if (d > 9) d -= 9;
1705
+ }
1706
+ sum += d;
1707
+ shouldDouble = !shouldDouble;
1708
+ }
1709
+ return sum % 10 === 0;
1710
+ }
1711
+ function _detectCardNetwork(digits) {
1712
+ for (const rule of _CARD_NETWORK_RULES) {
1713
+ if (rule.lengths.includes(digits.length) && rule.test(digits)) return rule.name;
1714
+ }
1715
+ return null;
1716
+ }
1717
+ function _formatCardNumber(digits, network) {
1718
+ if (network === "American Express") {
1719
+ return `${digits.slice(0, 4)} ${digits.slice(4, 10)} ${digits.slice(10)}`.trim();
1720
+ }
1721
+ return digits.match(/.{1,4}/g)?.join(" ") ?? digits;
1722
+ }
1723
+ function _validateCardNumber(input) {
1724
+ if (!input || !input.trim()) return { error: "Input is empty" };
1725
+ const digits = input.replace(/[\s-]/g, "");
1726
+ if (!/^\d+$/.test(digits)) return { error: "Card number must contain only digits, spaces, or hyphens" };
1727
+ if (digits.length < 12 || digits.length > 19) {
1728
+ return { error: `Card number length (${digits.length}) is outside the valid range of 12-19 digits` };
1729
+ }
1730
+ const valid = _luhnCheck(digits);
1731
+ const network = _detectCardNetwork(digits);
1732
+ const formatted = _formatCardNumber(digits, network);
1733
+ return { valid, network, length: digits.length, formatted };
1734
+ }
1735
+ server.tool(
1736
+ "validate_card_number",
1737
+ "Validate a credit card number via the Luhn checksum and detect its network (Visa, Mastercard, American Express, Discover, Diners Club, JCB, Maestro, UnionPay) from its prefix and length. No card data is stored or transmitted.",
1738
+ { number: z.string().describe("The card number, digits with optional spaces or hyphens") },
1739
+ async ({ number }) => {
1740
+ const result = _validateCardNumber(number);
1741
+ if ("error" in result) return errText(result);
1742
+ return text(JSON.stringify(result, null, 2));
1743
+ }
1744
+ );
1582
1745
  server.tool(
1583
1746
  "format_ndjson",
1584
1747
  "Validate newline-delimited JSON (NDJSON/JSON Lines), report per-line errors, and pretty-print each valid line.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilix-tech/mcp",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "MCP server exposing 107 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",