mcp-for-i 0.1.13 → 0.3.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 (72) hide show
  1. package/README.md +27 -0
  2. package/dist/config/store.js +229 -109
  3. package/dist/controlplane/auth.js +128 -0
  4. package/dist/controlplane/clientIntegrationService.js +83 -4
  5. package/dist/controlplane/commands.js +52 -11
  6. package/dist/controlplane/connectionService.js +110 -5
  7. package/dist/controlplane/connectionTest.js +329 -0
  8. package/dist/controlplane/errors.js +12 -0
  9. package/dist/controlplane/runtimeService.js +98 -26
  10. package/dist/controlplane/server.js +178 -11
  11. package/dist/controlplane/serverShared.js +25 -6
  12. package/dist/controlplane/serviceManager.js +147 -100
  13. package/dist/controlplane/ui.js +1783 -920
  14. package/dist/ibmi/CompileTools.js +29 -1
  15. package/dist/ibmi/IBMiContent.js +435 -63
  16. package/dist/ibmi/IbmDocs.js +685 -0
  17. package/dist/ibmi/LocalLanguageActions.js +129 -3
  18. package/dist/ibmi/Search.js +158 -52
  19. package/dist/ibmi/Tools.js +7 -10
  20. package/dist/ibmi/client.js +220 -31
  21. package/dist/ibmi/evfevent.js +256 -0
  22. package/dist/ibmi/knownHosts.js +190 -0
  23. package/dist/ibmi/libraryList.js +93 -0
  24. package/dist/ibmi/sourceInspect.js +815 -0
  25. package/dist/ibmi/sqlJob.js +888 -0
  26. package/dist/ibmi/sqlParse.js +317 -0
  27. package/dist/ibmi/tn5250/certTrust.js +59 -0
  28. package/dist/ibmi/tn5250/client.js +334 -0
  29. package/dist/ibmi/tn5250/datastream.js +109 -0
  30. package/dist/ibmi/tn5250/ebcdic.js +93 -0
  31. package/dist/ibmi/tn5250/ebcdicTables.js +27 -0
  32. package/dist/ibmi/tn5250/index.js +6 -0
  33. package/dist/ibmi/tn5250/screen.js +1033 -0
  34. package/dist/ibmi/tn5250/telnet.js +186 -0
  35. package/dist/ibmi/variables.js +18 -7
  36. package/dist/index.js +79 -24
  37. package/dist/mcp/annotations.js +155 -0
  38. package/dist/mcp/audit.js +490 -133
  39. package/dist/mcp/confirm.js +48 -0
  40. package/dist/mcp/context.js +43 -5
  41. package/dist/mcp/deployMethods.js +192 -0
  42. package/dist/mcp/logger.js +5 -10
  43. package/dist/mcp/modules/bulkMembers.js +476 -0
  44. package/dist/mcp/modules/changedLines.js +189 -0
  45. package/dist/mcp/modules/compare.js +198 -0
  46. package/dist/mcp/modules/compile.js +515 -0
  47. package/dist/mcp/modules/ifsOps.js +123 -0
  48. package/dist/mcp/modules/index.js +38 -0
  49. package/dist/mcp/modules/inspect.js +811 -0
  50. package/dist/mcp/modules/libl.js +246 -0
  51. package/dist/mcp/modules/members.js +171 -0
  52. package/dist/mcp/modules/objects.js +339 -0
  53. package/dist/mcp/modules/system.js +266 -0
  54. package/dist/mcp/modules/tn5250.js +800 -0
  55. package/dist/mcp/modules/tn5250App.js +194 -0
  56. package/dist/mcp/modules/tn5250Font.js +8 -0
  57. package/dist/mcp/modules/tn5250Live.js +221 -0
  58. package/dist/mcp/modules/tn5250LivePage.js +480 -0
  59. package/dist/mcp/policy.js +412 -0
  60. package/dist/mcp/tools.js +1719 -698
  61. package/dist/security/credentialStore.js +62 -13
  62. package/dist/security/localPaths.js +138 -0
  63. package/dist/security/redact.js +79 -0
  64. package/dist/util/atomicWrite.js +101 -0
  65. package/dist/util/fileLock.js +206 -0
  66. package/docs/capabilities.md +264 -220
  67. package/docs/configuration.md +193 -60
  68. package/docs/examples.md +109 -73
  69. package/docs/overview.md +15 -15
  70. package/docs/security.md +101 -16
  71. package/docs/tools.md +367 -188
  72. package/package.json +5 -2
@@ -58,7 +58,7 @@ export var CompileTools;
58
58
  commandResult = await connection.sendQsh({
59
59
  command: [
60
60
  ...(options.noLibList ? [] : buildLiblistCommands(connection, ileSetup)),
61
- ...commands.map(cmd => `system \"${IBMiClient.escapeForShell(cmd)}\"`)
61
+ ...commands.map(cmd => `system ${quoteForShell(cmd)}`)
62
62
  ].join(` && `),
63
63
  directory: cwd
64
64
  });
@@ -75,6 +75,27 @@ export var CompileTools;
75
75
  };
76
76
  }
77
77
  CompileTools.runCommand = runCommand;
78
+ /**
79
+ * Validate a streamfile path used as an action target. The path is
80
+ * substituted into CL and shell commands, so quotes, shell metacharacters
81
+ * and control characters are refused.
82
+ */
83
+ function validateStreamfilePath(value) {
84
+ const target = String(value ?? "");
85
+ if (!target.trim())
86
+ throw new Error("targetPath is required for streamfile actions");
87
+ if (!target.startsWith("/"))
88
+ throw new Error("targetPath must be an absolute IFS path");
89
+ if (/[\u0000-\u001f\u007f]/.test(target))
90
+ throw new Error("targetPath must not contain control characters");
91
+ if (/['"`$\\;|&<>]/.test(target)) {
92
+ throw new Error("targetPath must not contain quotes, backticks, '$', backslash, ';', '|', '&', '<' or '>'");
93
+ }
94
+ if (target.split("/").some(segment => segment === ".."))
95
+ throw new Error("targetPath must not contain '..'");
96
+ return target;
97
+ }
98
+ CompileTools.validateStreamfilePath = validateStreamfilePath;
78
99
  function buildLibraryList(config) {
79
100
  return config.libraryList
80
101
  .slice(0)
@@ -107,3 +128,10 @@ function assertLibraryName(connection, value, context) {
107
128
  }
108
129
  return normalized;
109
130
  }
131
+ /**
132
+ * Quote a value as a single POSIX shell word. Inside single quotes nothing is
133
+ * expanded, so `"`, backticks and `$` cannot break out of `system '...'`.
134
+ */
135
+ export function quoteForShell(value) {
136
+ return `'${String(value).replace(/'/g, `'\\''`)}'`;
137
+ }