it-tools-mcp 3.0.23 → 3.1.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 (127) hide show
  1. package/README.dockerhub.md +30 -17
  2. package/README.md +81 -33
  3. package/build/index.js +47 -15
  4. package/build/tools/ansible/ansible-inventory-generator/index.js +212 -0
  5. package/build/tools/ansible/ansible-playbook-validator/index.js +128 -0
  6. package/build/tools/ansible/ansible-reference/index.js +393 -0
  7. package/build/tools/ansible/ansible-vault-decrypt/index.js +137 -0
  8. package/build/tools/ansible/ansible-vault-encrypt/index.js +79 -0
  9. package/build/tools/color/color-hex-to-rgb/index.js +29 -0
  10. package/build/tools/{color.js → color/color-rgb-to-hex/index.js} +1 -27
  11. package/build/tools/crypto/basic-auth-generator/index.js +45 -0
  12. package/build/tools/crypto/bcrypt-hash/index.js +67 -0
  13. package/build/tools/crypto/bip39-generate/index.js +53 -0
  14. package/build/tools/crypto/hash-md5/index.js +19 -0
  15. package/build/tools/crypto/hash-sha1/index.js +19 -0
  16. package/build/tools/crypto/hash-sha256/index.js +19 -0
  17. package/build/tools/crypto/hash-sha512/index.js +19 -0
  18. package/build/tools/crypto/hmac-generator/index.js +37 -0
  19. package/build/tools/crypto/jwt-decode/index.js +41 -0
  20. package/build/tools/crypto/otp-code-generator/index.js +67 -0
  21. package/build/tools/crypto/password-generate/index.js +54 -0
  22. package/build/tools/crypto/token-generator/index.js +75 -0
  23. package/build/tools/dataFormat/html-to-markdown/index.js +34 -0
  24. package/build/tools/dataFormat/json-diff/index.js +94 -0
  25. package/build/tools/dataFormat/json-format/index.js +100 -0
  26. package/build/tools/dataFormat/json-minify/index.js +29 -0
  27. package/build/tools/dataFormat/json-to-csv/index.js +34 -0
  28. package/build/tools/dataFormat/json-to-toml/index.js +30 -0
  29. package/build/tools/dataFormat/markdown-to-html/index.js +32 -0
  30. package/build/tools/dataFormat/phone-format/index.js +35 -0
  31. package/build/tools/dataFormat/sql-format/index.js +37 -0
  32. package/build/tools/dataFormat/toml-to-json/index.js +29 -0
  33. package/build/tools/dataFormat/xml-format/index.js +44 -0
  34. package/build/tools/dataFormat/yaml-format/index.js +58 -0
  35. package/build/tools/{development.js → development/crontab-generate/index.js} +1 -129
  36. package/build/tools/development/html-prettifier/index.js +47 -0
  37. package/build/tools/development/javascript-prettifier/index.js +74 -0
  38. package/build/tools/development/list-converter/index.js +62 -0
  39. package/build/tools/development/markdown-toc-generator/index.js +53 -0
  40. package/build/tools/development/regex-tester/index.js +69 -0
  41. package/build/tools/docker/docker-compose-to-docker-run/index.js +138 -0
  42. package/build/tools/docker/docker-compose-validator/index.js +125 -0
  43. package/build/tools/docker/docker-reference/index.js +188 -0
  44. package/build/tools/docker/docker-run-to-docker-compose/index.js +117 -0
  45. package/build/tools/docker/traefik-compose-generator/index.js +98 -0
  46. package/build/tools/encoding/base64-decode/index.js +28 -0
  47. package/build/tools/encoding/base64-encode/index.js +16 -0
  48. package/build/tools/encoding/html-decode/index.js +21 -0
  49. package/build/tools/encoding/html-encode/index.js +21 -0
  50. package/build/tools/encoding/html-entities-extended/index.js +72 -0
  51. package/build/tools/encoding/text-to-binary/index.js +51 -0
  52. package/build/tools/encoding/url-decode/index.js +28 -0
  53. package/build/tools/encoding/url-encode/index.js +16 -0
  54. package/build/tools/forensic/file-type-identifier/index.js +90 -0
  55. package/build/tools/forensic/safelink-decoder/index.js +54 -0
  56. package/build/tools/forensic/url-fanger/index.js +52 -0
  57. package/build/tools/idGenerators/qr-generate/index.js +76 -0
  58. package/build/tools/idGenerators/svg-placeholder-generator/index.js +59 -0
  59. package/build/tools/idGenerators/ulid-generate/index.js +34 -0
  60. package/build/tools/idGenerators/uuid-generate/index.js +14 -0
  61. package/build/tools/math/math-evaluate/index.js +33 -0
  62. package/build/tools/math/number-base-converter/index.js +46 -0
  63. package/build/tools/math/percentage-calculator/index.js +50 -0
  64. package/build/tools/math/roman-numeral-converter/index.js +76 -0
  65. package/build/tools/math/temperature-converter/index.js +59 -0
  66. package/build/tools/math/unix-timestamp-converter/index.js +55 -0
  67. package/build/tools/network/cat/index.js +15 -0
  68. package/build/tools/network/cidr-to-ip-range/index.js +108 -0
  69. package/build/tools/network/curl/index.js +35 -0
  70. package/build/tools/network/dig/index.js +19 -0
  71. package/build/tools/network/grep/index.js +18 -0
  72. package/build/tools/network/head/index.js +17 -0
  73. package/build/tools/network/iban-validate/index.js +83 -0
  74. package/build/tools/network/ip-range-to-cidr/index.js +88 -0
  75. package/build/tools/network/ip-subnet-calculator/index.js +102 -0
  76. package/build/tools/network/ipv4-subnet-calc/index.js +112 -0
  77. package/build/tools/network/ipv6-subnet-calculator/index.js +104 -0
  78. package/build/tools/network/ipv6-ula-generator/index.js +65 -0
  79. package/build/tools/network/mac-address-generate/index.js +68 -0
  80. package/build/tools/network/nslookup/index.js +18 -0
  81. package/build/tools/network/ping/index.js +20 -0
  82. package/build/tools/network/ps/index.js +22 -0
  83. package/build/tools/network/random-port/index.js +53 -0
  84. package/build/tools/network/scp/index.js +134 -0
  85. package/build/tools/network/ssh/index.js +83 -0
  86. package/build/tools/network/tail/index.js +16 -0
  87. package/build/tools/network/telnet/index.js +45 -0
  88. package/build/tools/network/top/index.js +14 -0
  89. package/build/tools/network/url-parse/index.js +52 -0
  90. package/build/tools/physics/angle-converter/index.js +73 -0
  91. package/build/tools/physics/energy-converter/index.js +72 -0
  92. package/build/tools/physics/power-converter/index.js +71 -0
  93. package/build/tools/text/ascii-art-text/index.js +112 -0
  94. package/build/tools/text/distinct-words/index.js +30 -0
  95. package/build/tools/text/emoji-search/index.js +76 -0
  96. package/build/tools/text/lorem-ipsum-generator/index.js +87 -0
  97. package/build/tools/text/numeronym-generator/index.js +37 -0
  98. package/build/tools/text/slugify-string/index.js +44 -0
  99. package/build/tools/text/string-obfuscator/index.js +49 -0
  100. package/build/tools/text/text-camelcase/index.js +20 -0
  101. package/build/tools/text/text-capitalize/index.js +16 -0
  102. package/build/tools/text/text-diff/index.js +72 -0
  103. package/build/tools/text/text-kebabcase/index.js +20 -0
  104. package/build/tools/text/text-lowercase/index.js +15 -0
  105. package/build/tools/text/text-pascalcase/index.js +18 -0
  106. package/build/tools/text/text-snakecase/index.js +20 -0
  107. package/build/tools/text/text-stats/index.js +29 -0
  108. package/build/tools/text/text-to-nato-alphabet/index.js +57 -0
  109. package/build/tools/text/text-to-unicode/index.js +50 -0
  110. package/build/tools/text/text-to-unicode-names/index.js +34 -0
  111. package/build/tools/text/text-uppercase/index.js +15 -0
  112. package/build/tools/utility/css-prettifier/index.js +70 -0
  113. package/build/tools/utility/device-info/index.js +44 -0
  114. package/build/tools/utility/email-normalizer/index.js +73 -0
  115. package/build/tools/utility/http-status-codes/index.js +173 -0
  116. package/build/tools/utility/mime-types/index.js +121 -0
  117. package/build/tools/utility/port-numbers/index.js +106 -0
  118. package/build/tools/utility/rem-px-converter/index.js +63 -0
  119. package/package.json +3 -3
  120. package/build/tools/crypto.js +0 -445
  121. package/build/tools/dataFormat.js +0 -535
  122. package/build/tools/encoding.js +0 -240
  123. package/build/tools/idGenerators.js +0 -180
  124. package/build/tools/math.js +0 -310
  125. package/build/tools/network.js +0 -931
  126. package/build/tools/text.js +0 -678
  127. package/build/tools/utility.js +0 -407
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ export function registerHtmlEntitiesExtended(server) {
3
+ server.tool("html-entities-extended", "Extended HTML entity encoding/decoding", {
4
+ text: z.string().describe("Text to encode or decode"),
5
+ operation: z.enum(["encode", "decode"]).describe("Operation to perform"),
6
+ }, async ({ text, operation }) => {
7
+ try {
8
+ if (operation === "encode") {
9
+ const encoded = text
10
+ .replace(/&/g, '&')
11
+ .replace(/</g, '&lt;')
12
+ .replace(/>/g, '&gt;')
13
+ .replace(/"/g, '&quot;')
14
+ .replace(/'/g, '&#39;')
15
+ .replace(/©/g, '&copy;')
16
+ .replace(/®/g, '&reg;')
17
+ .replace(/™/g, '&trade;')
18
+ .replace(/€/g, '&euro;')
19
+ .replace(/£/g, '&pound;')
20
+ .replace(/¥/g, '&yen;')
21
+ .replace(/§/g, '&sect;')
22
+ .replace(/¶/g, '&para;')
23
+ .replace(/†/g, '&dagger;')
24
+ .replace(/‡/g, '&Dagger;');
25
+ return {
26
+ content: [
27
+ {
28
+ type: "text",
29
+ text: `HTML entities encoded: ${encoded}`,
30
+ },
31
+ ],
32
+ };
33
+ }
34
+ else {
35
+ const decoded = text
36
+ .replace(/&amp;/g, '&')
37
+ .replace(/&lt;/g, '<')
38
+ .replace(/&gt;/g, '>')
39
+ .replace(/&quot;/g, '"')
40
+ .replace(/&#39;/g, "'")
41
+ .replace(/&copy;/g, '©')
42
+ .replace(/&reg;/g, '®')
43
+ .replace(/&trade;/g, '™')
44
+ .replace(/&euro;/g, '€')
45
+ .replace(/&pound;/g, '£')
46
+ .replace(/&yen;/g, '¥')
47
+ .replace(/&sect;/g, '§')
48
+ .replace(/&para;/g, '¶')
49
+ .replace(/&dagger;/g, '†')
50
+ .replace(/&Dagger;/g, '‡');
51
+ return {
52
+ content: [
53
+ {
54
+ type: "text",
55
+ text: `HTML entities decoded: ${decoded}`,
56
+ },
57
+ ],
58
+ };
59
+ }
60
+ }
61
+ catch (error) {
62
+ return {
63
+ content: [
64
+ {
65
+ type: "text",
66
+ text: `Error processing HTML entities: ${error instanceof Error ? error.message : 'Unknown error'}`,
67
+ },
68
+ ],
69
+ };
70
+ }
71
+ });
72
+ }
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+ export function registerTextToBinary(server) {
3
+ server.tool("text-to-binary", "Convert text to binary and vice versa", {
4
+ input: z.string().describe("Text to convert to binary, or binary to convert to text"),
5
+ operation: z.enum(["encode", "decode"]).describe("Operation: encode text to binary or decode binary to text"),
6
+ }, async ({ input, operation }) => {
7
+ try {
8
+ if (operation === "encode") {
9
+ const binary = input
10
+ .split('')
11
+ .map(char => char.charCodeAt(0).toString(2).padStart(8, '0'))
12
+ .join(' ');
13
+ return {
14
+ content: [
15
+ {
16
+ type: "text",
17
+ text: `Text: ${input}
18
+ Binary: ${binary}`,
19
+ },
20
+ ],
21
+ };
22
+ }
23
+ else {
24
+ // Decode binary to text
25
+ const binaryGroups = input.replace(/\s+/g, ' ').trim().split(' ');
26
+ const text = binaryGroups
27
+ .map(binary => String.fromCharCode(parseInt(binary, 2)))
28
+ .join('');
29
+ return {
30
+ content: [
31
+ {
32
+ type: "text",
33
+ text: `Binary: ${input}
34
+ Text: ${text}`,
35
+ },
36
+ ],
37
+ };
38
+ }
39
+ }
40
+ catch (error) {
41
+ return {
42
+ content: [
43
+ {
44
+ type: "text",
45
+ text: `Error converting text/binary: ${error instanceof Error ? error.message : 'Unknown error'}`,
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ });
51
+ }
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ export function registerUrlDecode(server) {
3
+ server.tool("url-decode", "URL decode text", {
4
+ text: z.string().describe("URL encoded text to decode"),
5
+ }, async ({ text }) => {
6
+ try {
7
+ const decoded = decodeURIComponent(text);
8
+ return {
9
+ content: [
10
+ {
11
+ type: "text",
12
+ text: `URL decoded: ${decoded}`,
13
+ },
14
+ ],
15
+ };
16
+ }
17
+ catch (error) {
18
+ return {
19
+ content: [
20
+ {
21
+ type: "text",
22
+ text: `Error decoding URL: ${error instanceof Error ? error.message : 'Unknown error'}`,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ });
28
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export function registerUrlEncode(server) {
3
+ server.tool("url-encode", "URL encode text", {
4
+ text: z.string().describe("Text to URL encode"),
5
+ }, async ({ text }) => {
6
+ const encoded = encodeURIComponent(text);
7
+ return {
8
+ content: [
9
+ {
10
+ type: "text",
11
+ text: `URL encoded: ${encoded}`,
12
+ },
13
+ ],
14
+ };
15
+ });
16
+ }
@@ -0,0 +1,90 @@
1
+ import { z } from "zod";
2
+ import { Buffer } from 'buffer';
3
+ export function registerFileTypeIdentifier(server) {
4
+ server.tool("file-type-identifier", "Identify file type based on magic numbers/file signatures", {
5
+ data: z.string().describe("Hex data or base64 data of file header"),
6
+ format: z.enum(["hex", "base64"]).describe("Format of the input data")
7
+ }, async ({ data, format }) => {
8
+ try {
9
+ let buffer;
10
+ if (format === "hex") {
11
+ const cleanHex = data.replace(/\s/g, '');
12
+ buffer = Buffer.from(cleanHex, 'hex');
13
+ }
14
+ else {
15
+ buffer = Buffer.from(data, 'base64');
16
+ }
17
+ // Magic number signatures
18
+ const signatures = [
19
+ { pattern: [0xFF, 0xD8, 0xFF], type: "JPEG Image", extension: ".jpg" },
20
+ { pattern: [0x89, 0x50, 0x4E, 0x47], type: "PNG Image", extension: ".png" },
21
+ { pattern: [0x47, 0x49, 0x46, 0x38], type: "GIF Image", extension: ".gif" },
22
+ { pattern: [0x50, 0x4B, 0x03, 0x04], type: "ZIP Archive", extension: ".zip" },
23
+ { pattern: [0x50, 0x4B, 0x05, 0x06], type: "ZIP Archive (empty)", extension: ".zip" },
24
+ { pattern: [0x50, 0x4B, 0x07, 0x08], type: "ZIP Archive (spanned)", extension: ".zip" },
25
+ { pattern: [0x25, 0x50, 0x44, 0x46], type: "PDF Document", extension: ".pdf" },
26
+ { pattern: [0x52, 0x61, 0x72, 0x21], type: "RAR Archive", extension: ".rar" },
27
+ { pattern: [0x7F, 0x45, 0x4C, 0x46], type: "ELF Executable", extension: "" },
28
+ { pattern: [0x4D, 0x5A], type: "Windows Executable", extension: ".exe" },
29
+ { pattern: [0xCA, 0xFE, 0xBA, 0xBE], type: "Java Class File", extension: ".class" },
30
+ { pattern: [0x1F, 0x8B], type: "GZIP Archive", extension: ".gz" },
31
+ { pattern: [0x42, 0x5A, 0x68], type: "BZIP2 Archive", extension: ".bz2" },
32
+ { pattern: [0x37, 0x7A, 0xBC, 0xAF], type: "7-Zip Archive", extension: ".7z" },
33
+ { pattern: [0x52, 0x49, 0x46, 0x46], type: "RIFF Container (WAV/AVI)", extension: ".wav/.avi" },
34
+ { pattern: [0x49, 0x44, 0x33], type: "MP3 Audio", extension: ".mp3" },
35
+ { pattern: [0x66, 0x74, 0x79, 0x70], type: "MP4 Video", extension: ".mp4", offset: 4 },
36
+ ];
37
+ let detectedType = "Unknown";
38
+ let extension = "";
39
+ let matchDetails = "";
40
+ for (const sig of signatures) {
41
+ const offset = sig.offset || 0;
42
+ if (buffer.length >= offset + sig.pattern.length) {
43
+ let matches = true;
44
+ for (let i = 0; i < sig.pattern.length; i++) {
45
+ if (buffer[offset + i] !== sig.pattern[i]) {
46
+ matches = false;
47
+ break;
48
+ }
49
+ }
50
+ if (matches) {
51
+ detectedType = sig.type;
52
+ extension = sig.extension;
53
+ matchDetails = `Matched at offset ${offset}: ${sig.pattern.map(b => b.toString(16).padStart(2, '0')).join(' ')}`;
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ const hexDump = buffer.slice(0, Math.min(32, buffer.length))
59
+ .toString('hex')
60
+ .toUpperCase()
61
+ .replace(/.{2}/g, '$& ')
62
+ .trim();
63
+ return {
64
+ content: [{
65
+ type: "text",
66
+ text: `File Type Identification Results:
67
+
68
+ Detected Type: ${detectedType}
69
+ Extension: ${extension || "N/A"}
70
+ Data Size: ${buffer.length} bytes
71
+
72
+ Hex Dump (first 32 bytes):
73
+ ${hexDump}
74
+
75
+ ${matchDetails ? `Match Details: ${matchDetails}` : "No signature match found"}
76
+
77
+ Note: This is based on magic number detection. Some files may have multiple valid interpretations.`
78
+ }]
79
+ };
80
+ }
81
+ catch (error) {
82
+ return {
83
+ content: [{
84
+ type: "text",
85
+ text: `Error identifying file type: ${error instanceof Error ? error.message : 'Unknown error'}`
86
+ }]
87
+ };
88
+ }
89
+ });
90
+ }
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ export function registerSafelinkDecoder(server) {
3
+ server.tool("safelink-decoder", "Decode Microsoft Outlook SafeLink URLs", {
4
+ safelink: z.string().describe("SafeLink URL to decode")
5
+ }, async ({ safelink }) => {
6
+ try {
7
+ const url = new URL(safelink);
8
+ // Check if it's a SafeLink URL
9
+ if (!url.hostname.includes('safelinks.protection.outlook.com')) {
10
+ return {
11
+ content: [{
12
+ type: "text",
13
+ text: "This doesn't appear to be a SafeLink URL."
14
+ }]
15
+ };
16
+ }
17
+ // Extract the actual URL from the 'url' parameter
18
+ const actualUrl = url.searchParams.get('url');
19
+ if (!actualUrl) {
20
+ return {
21
+ content: [{
22
+ type: "text",
23
+ text: "Could not find the original URL in the SafeLink."
24
+ }]
25
+ };
26
+ }
27
+ // Decode the URL
28
+ const decodedUrl = decodeURIComponent(actualUrl);
29
+ return {
30
+ content: [{
31
+ type: "text",
32
+ text: `SafeLink Decoder Results:
33
+
34
+ Original SafeLink: ${safelink}
35
+
36
+ Decoded URL: ${decodedUrl}
37
+
38
+ Additional Parameters:
39
+ - Data: ${url.searchParams.get('data') || 'N/A'}
40
+ - Reserved: ${url.searchParams.get('reserved') || 'N/A'}
41
+ - Source: ${url.searchParams.get('source') || 'N/A'}`
42
+ }]
43
+ };
44
+ }
45
+ catch (error) {
46
+ return {
47
+ content: [{
48
+ type: "text",
49
+ text: `Error decoding SafeLink: ${error instanceof Error ? error.message : 'Unknown error'}`
50
+ }]
51
+ };
52
+ }
53
+ });
54
+ }
@@ -0,0 +1,52 @@
1
+ import { z } from "zod";
2
+ export function registerUrlFanger(server) {
3
+ server.tool("url-fanger", "Defang or refang URLs for safe sharing (security analysis)", {
4
+ text: z.string().describe("Text containing URLs to fang/defang"),
5
+ operation: z.enum(["defang", "refang"]).describe("Whether to defang (make safe) or refang (restore) URLs")
6
+ }, async ({ text, operation }) => {
7
+ try {
8
+ let result = text;
9
+ if (operation === "defang") {
10
+ // Defang URLs to make them safe
11
+ result = result
12
+ .replace(/https?:\/\//g, 'hxxp://') // Replace http/https with hxxp
13
+ .replace(/\./g, '[.]') // Replace dots with [.]
14
+ .replace(/@/g, '[@]') // Replace @ with [@]
15
+ .replace(/:/g, '[:]'); // Replace colons with [:]
16
+ }
17
+ else {
18
+ // Refang URLs to restore them
19
+ result = result
20
+ .replace(/hxxp:\/\//g, 'http://') // Restore http
21
+ .replace(/hxxps:\/\//g, 'https://') // Restore https
22
+ .replace(/\[\.\]/g, '.') // Restore dots
23
+ .replace(/\[@\]/g, '@') // Restore @
24
+ .replace(/\[:\]/g, ':'); // Restore colons
25
+ }
26
+ return {
27
+ content: [{
28
+ type: "text",
29
+ text: `URL ${operation === "defang" ? "Defanging" : "Refanging"} Results:
30
+
31
+ Original:
32
+ ${text}
33
+
34
+ ${operation === "defang" ? "Defanged" : "Refanged"}:
35
+ ${result}
36
+
37
+ Note: ${operation === "defang"
38
+ ? "Defanged URLs are safe to share and won't be clickable."
39
+ : "Refanged URLs have been restored to their original form."}`
40
+ }]
41
+ };
42
+ }
43
+ catch (error) {
44
+ return {
45
+ content: [{
46
+ type: "text",
47
+ text: `Error processing URLs: ${error instanceof Error ? error.message : 'Unknown error'}`
48
+ }]
49
+ };
50
+ }
51
+ });
52
+ }
@@ -0,0 +1,76 @@
1
+ import { z } from "zod";
2
+ export function registerQrGenerate(server) {
3
+ server.tool("qr-generate", "Generate QR code for any text including URLs, WiFi networks, contact info, etc.", {
4
+ text: z.string().describe("Text to encode in QR code (URLs, WiFi: WIFI:T:WPA;S:network;P:password;;, contact info, etc.)"),
5
+ size: z.number().describe("Size multiplier (1-3)").optional(),
6
+ }, async ({ text, size = 1 }) => {
7
+ try {
8
+ const QRCode = (await import("qrcode")).default;
9
+ if (size < 1 || size > 3) {
10
+ return {
11
+ content: [
12
+ {
13
+ type: "text",
14
+ text: "Size must be between 1 and 3.",
15
+ },
16
+ ],
17
+ };
18
+ }
19
+ // Generate QR code as base64 data URL
20
+ console.log(`[DEBUG] Generating QR code for: "${text}" with size: ${size}`);
21
+ const dataUrl = await QRCode.toDataURL(text, {
22
+ type: 'image/png',
23
+ errorCorrectionLevel: 'M',
24
+ width: Math.max(256, size * 128), // Minimum 256px, scales with size parameter
25
+ margin: 2,
26
+ color: {
27
+ dark: '#000000', // Black
28
+ light: '#FFFFFF' // White
29
+ }
30
+ });
31
+ console.log(`[DEBUG] QR code generated successfully`);
32
+ // Extract just the base64 data (remove the data:image/png;base64, prefix)
33
+ const base64Data = dataUrl.split(',')[1];
34
+ const markdown = `![QR Code](data:image/png;base64,${base64Data})`;
35
+ return {
36
+ content: [
37
+ {
38
+ type: "text",
39
+ text: `📱 QR Code for: "${text}"
40
+ \n📊 Data encoded: "${text}" (${text.length} characters)
41
+ 🎯 Error correction: Medium (M)
42
+ 📐 Image size: ${Math.max(256, size * 128)}x${Math.max(256, size * 128)} pixels
43
+ \n✅ This QR code can be scanned with any QR code reader app
44
+ 💡 Generated using the 'qrcode' npm library!
45
+ \n---\n**Markdown for inline display:**\n${markdown}`,
46
+ },
47
+ {
48
+ type: "image",
49
+ data: base64Data,
50
+ mimeType: "image/png"
51
+ }
52
+ ],
53
+ };
54
+ }
55
+ catch (error) {
56
+ console.error(`[DEBUG] QR code generation failed:`, error);
57
+ return {
58
+ content: [
59
+ {
60
+ type: "text",
61
+ text: `Error generating QR code: ${error instanceof Error ? error.message : 'Unknown error'}\n\nDebug info:\n- Text: \"${text}\"\n- Size: ${size}`,
62
+ },
63
+ ],
64
+ };
65
+ }
66
+ // Fallback return in case of unexpected behavior
67
+ return {
68
+ content: [
69
+ {
70
+ type: "text",
71
+ text: "Unknown error: No response generated by qr-generate.",
72
+ },
73
+ ],
74
+ };
75
+ });
76
+ }
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+ export function registerSvgPlaceholderGenerator(server) {
3
+ server.tool("svg-placeholder-generator", "Generate SVG placeholder images", {
4
+ width: z.number().describe("Width in pixels").optional(),
5
+ height: z.number().describe("Height in pixels").optional(),
6
+ backgroundColor: z.string().describe("Background color (hex)").optional(),
7
+ textColor: z.string().describe("Text color (hex)").optional(),
8
+ text: z.string().optional().describe("Custom text (default: dimensions)"),
9
+ }, async ({ width = 300, height = 200, backgroundColor = "#cccccc", textColor = "#666666", text }) => {
10
+ try {
11
+ if (width < 1 || width > 2000 || height < 1 || height > 2000) {
12
+ return {
13
+ content: [
14
+ {
15
+ type: "text",
16
+ text: "Width and height must be between 1 and 2000 pixels.",
17
+ },
18
+ ],
19
+ };
20
+ }
21
+ const displayText = text || `${width}×${height}`;
22
+ const fontSize = Math.min(width, height) / 8;
23
+ const svg = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">
24
+ <rect width="100%" height="100%" fill="${backgroundColor}"/>
25
+ <text x="50%" y="50%" font-family="Arial, sans-serif" font-size="${fontSize}" fill="${textColor}" text-anchor="middle" dy=".3em">${displayText}</text>
26
+ </svg>`;
27
+ const dataUrl = `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}`;
28
+ return {
29
+ content: [
30
+ {
31
+ type: "text",
32
+ text: `SVG Placeholder Generated:
33
+
34
+ Dimensions: ${width}×${height}
35
+ Background: ${backgroundColor}
36
+ Text Color: ${textColor}
37
+ Text: ${displayText}
38
+
39
+ SVG Code:
40
+ ${svg}
41
+
42
+ Data URL:
43
+ ${dataUrl}`,
44
+ },
45
+ ],
46
+ };
47
+ }
48
+ catch (error) {
49
+ return {
50
+ content: [
51
+ {
52
+ type: "text",
53
+ text: `Error generating SVG placeholder: ${error instanceof Error ? error.message : 'Unknown error'}`,
54
+ },
55
+ ],
56
+ };
57
+ }
58
+ });
59
+ }
@@ -0,0 +1,34 @@
1
+ export function registerUlidGenerate(server) {
2
+ server.tool("ulid-generate", "Generate Universally Unique Lexicographically Sortable Identifier", {}, async () => {
3
+ try {
4
+ // Simplified ULID implementation
5
+ const timestamp = Date.now();
6
+ const randomPart = Math.random().toString(36).substring(2, 18);
7
+ const ulid = timestamp.toString(36).toUpperCase() + randomPart.toUpperCase();
8
+ return {
9
+ content: [
10
+ {
11
+ type: "text",
12
+ text: `Generated ULID: ${ulid}
13
+
14
+ Timestamp: ${timestamp}
15
+ Generated at: ${new Date(timestamp).toISOString()}
16
+
17
+ Note: This is a simplified ULID implementation.
18
+ For production use, please use a proper ULID library.`,
19
+ },
20
+ ],
21
+ };
22
+ }
23
+ catch (error) {
24
+ return {
25
+ content: [
26
+ {
27
+ type: "text",
28
+ text: `Error generating ULID: ${error instanceof Error ? error.message : 'Unknown error'}`,
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ });
34
+ }
@@ -0,0 +1,14 @@
1
+ import { randomUUID } from "crypto";
2
+ export function registerUuidGenerate(server) {
3
+ server.tool("uuid-generate", "Generate a random UUID v4", {}, async () => {
4
+ const uuid = randomUUID();
5
+ return {
6
+ content: [
7
+ {
8
+ type: "text",
9
+ text: `Generated UUID: ${uuid}`,
10
+ },
11
+ ],
12
+ };
13
+ });
14
+ }
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ export function registerMathEvaluate(server) {
3
+ server.tool("math-evaluate", "Safely evaluate mathematical expressions", {
4
+ expression: z.string().describe("Mathematical expression to evaluate (e.g., '2 + 3 * 4')")
5
+ }, async ({ expression }) => {
6
+ try {
7
+ // @ts-ignore: Ignore missing type declarations for mathjs
8
+ const { compile } = await import("mathjs");
9
+ const start = Date.now();
10
+ const code = compile(expression);
11
+ const result = code.evaluate();
12
+ const elapsed = Date.now() - start;
13
+ return {
14
+ content: [
15
+ {
16
+ type: "text",
17
+ text: `Expression: ${expression}\nResult: ${result}\n(evaluated in ${elapsed} ms)`
18
+ }
19
+ ]
20
+ };
21
+ }
22
+ catch (error) {
23
+ return {
24
+ content: [
25
+ {
26
+ type: "text",
27
+ text: `Error evaluating expression: ${error instanceof Error ? error.message : 'Unknown error'}`
28
+ }
29
+ ]
30
+ };
31
+ }
32
+ });
33
+ }
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ export function registerNumberBaseConverter(server) {
3
+ server.tool("number-base-converter", "Convert numbers between different bases (binary, octal, decimal, hexadecimal)", {
4
+ number: z.string().describe("Number to convert"),
5
+ fromBase: z.number().describe("Source base (2-36)"),
6
+ toBase: z.number().describe("Target base (2-36)")
7
+ }, async ({ number, fromBase, toBase }) => {
8
+ try {
9
+ if (fromBase < 2 || fromBase > 36 || toBase < 2 || toBase > 36) {
10
+ return {
11
+ content: [
12
+ {
13
+ type: "text",
14
+ text: "Base must be between 2 and 36.",
15
+ },
16
+ ],
17
+ };
18
+ }
19
+ // Parse number from source base to decimal
20
+ const decimal = parseInt(number, fromBase);
21
+ if (isNaN(decimal)) {
22
+ throw new Error("Invalid number for the specified base");
23
+ }
24
+ // Convert decimal to target base
25
+ const result = decimal.toString(toBase);
26
+ return {
27
+ content: [
28
+ {
29
+ type: "text",
30
+ text: `${number} (base ${fromBase}) = ${result} (base ${toBase})\nDecimal equivalent: ${decimal}`
31
+ }
32
+ ]
33
+ };
34
+ }
35
+ catch (error) {
36
+ return {
37
+ content: [
38
+ {
39
+ type: "text",
40
+ text: `Error converting number: ${error instanceof Error ? error.message : 'Unknown error'}`
41
+ }
42
+ ]
43
+ };
44
+ }
45
+ });
46
+ }