@ibm/ibmi-mcp-server 0.1.2 → 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.
- package/README.md +2178 -46
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +57 -24
- package/dist/config/index.js.map +1 -1
- package/dist/config/resolver.d.ts.map +1 -1
- package/dist/config/resolver.js.map +1 -1
- package/dist/ibmi-mcp-server/auth/httpAuthEndpoint.js +1 -1
- package/dist/ibmi-mcp-server/services/connectionPool.js +2 -2
- package/dist/ibmi-mcp-server/tools/executeSql.tool.d.ts +80 -0
- package/dist/ibmi-mcp-server/tools/executeSql.tool.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/tools/executeSql.tool.js +356 -0
- package/dist/ibmi-mcp-server/tools/executeSql.tool.js.map +1 -0
- package/dist/ibmi-mcp-server/tools/generateSql.tool.d.ts +36 -0
- package/dist/ibmi-mcp-server/tools/generateSql.tool.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/tools/generateSql.tool.js +281 -0
- package/dist/ibmi-mcp-server/tools/generateSql.tool.js.map +1 -0
- package/dist/ibmi-mcp-server/tools/index.d.ts +85 -0
- package/dist/ibmi-mcp-server/tools/index.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/tools/index.js +21 -0
- package/dist/ibmi-mcp-server/tools/index.js.map +1 -0
- package/dist/ibmi-mcp-server/utils/config/configParser.d.ts +9 -0
- package/dist/ibmi-mcp-server/utils/config/configParser.d.ts.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/configParser.js +58 -0
- package/dist/ibmi-mcp-server/utils/config/configParser.js.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.js +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.js.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolDefinitions.d.ts +4 -4
- package/dist/ibmi-mcp-server/utils/config/toolDefinitions.d.ts.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolDefinitions.js +7 -8
- package/dist/ibmi-mcp-server/utils/config/toolDefinitions.js.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolFactory.d.ts +0 -8
- package/dist/ibmi-mcp-server/utils/config/toolFactory.d.ts.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolFactory.js +0 -31
- package/dist/ibmi-mcp-server/utils/config/toolFactory.js.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolsetManager.d.ts +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolsetManager.d.ts.map +1 -1
- package/dist/ibmi-mcp-server/utils/config/toolsetManager.js +2 -2
- package/dist/ibmi-mcp-server/utils/config/toolsetManager.js.map +1 -1
- package/dist/ibmi-mcp-server/utils/language/document.d.ts +26 -0
- package/dist/ibmi-mcp-server/utils/language/document.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/utils/language/document.js +318 -0
- package/dist/ibmi-mcp-server/utils/language/document.js.map +1 -0
- package/dist/ibmi-mcp-server/utils/language/statement.d.ts +43 -0
- package/dist/ibmi-mcp-server/utils/language/statement.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/utils/language/statement.js +796 -0
- package/dist/ibmi-mcp-server/utils/language/statement.js.map +1 -0
- package/dist/ibmi-mcp-server/utils/language/tokens.d.ts +32 -0
- package/dist/ibmi-mcp-server/utils/language/tokens.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/utils/language/tokens.js +532 -0
- package/dist/ibmi-mcp-server/utils/language/tokens.js.map +1 -0
- package/dist/ibmi-mcp-server/utils/language/types.d.ts +138 -0
- package/dist/ibmi-mcp-server/utils/language/types.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/utils/language/types.js +93 -0
- package/dist/ibmi-mcp-server/utils/language/types.js.map +1 -0
- package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.d.ts +48 -0
- package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.js +93 -0
- package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.js.map +1 -0
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.d.ts +35 -59
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.d.ts.map +1 -1
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.js +108 -288
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.js.map +1 -1
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.d.ts +54 -0
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.d.ts.map +1 -0
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.js +91 -0
- package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.js.map +1 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/index.d.ts +13 -2
- package/dist/mcp-server/tools/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/index.js +29 -9
- package/dist/mcp-server/tools/index.js.map +1 -1
- package/dist/mcp-server/tools/utils/index.d.ts +7 -0
- package/dist/mcp-server/tools/utils/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/index.js +7 -0
- package/dist/mcp-server/tools/utils/index.js.map +1 -0
- package/dist/mcp-server/tools/utils/tool-factory.d.ts +129 -0
- package/dist/mcp-server/tools/utils/tool-factory.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/tool-factory.js +179 -0
- package/dist/mcp-server/tools/utils/tool-factory.js.map +1 -0
- package/dist/mcp-server/tools/utils/types.d.ts +117 -0
- package/dist/mcp-server/tools/utils/types.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/types.js +11 -0
- package/dist/mcp-server/tools/utils/types.js.map +1 -0
- package/dist/mcp-server/transports/core/cleanupTransformStream.d.ts +26 -0
- package/dist/mcp-server/transports/core/cleanupTransformStream.d.ts.map +1 -0
- package/dist/mcp-server/transports/core/cleanupTransformStream.js +60 -0
- package/dist/mcp-server/transports/core/cleanupTransformStream.js.map +1 -0
- package/dist/mcp-server/transports/core/statefulTransportManager.d.ts +1 -1
- package/dist/mcp-server/transports/core/statefulTransportManager.d.ts.map +1 -1
- package/dist/mcp-server/transports/core/statefulTransportManager.js +50 -40
- package/dist/mcp-server/transports/core/statefulTransportManager.js.map +1 -1
- package/dist/mcp-server/transports/core/statelessTransportManager.d.ts +2 -13
- package/dist/mcp-server/transports/core/statelessTransportManager.d.ts.map +1 -1
- package/dist/mcp-server/transports/core/statelessTransportManager.js +35 -62
- package/dist/mcp-server/transports/core/statelessTransportManager.js.map +1 -1
- package/dist/mcp-server/transports/core/transportRequest.d.ts +1 -2
- package/dist/mcp-server/transports/core/transportRequest.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/mcpTransportMiddleware.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/mcpTransportMiddleware.js +1 -3
- package/dist/mcp-server/transports/http/mcpTransportMiddleware.js.map +1 -1
- package/dist/utils/internal/logger.d.ts +5 -0
- package/dist/utils/internal/logger.d.ts.map +1 -1
- package/dist/utils/internal/logger.js +65 -36
- package/dist/utils/internal/logger.js.map +1 -1
- package/package.json +29 -23
- package/dist/ibmi-mcp-server/tools/executeSql/index.d.ts +0 -9
- package/dist/ibmi-mcp-server/tools/executeSql/index.d.ts.map +0 -1
- package/dist/ibmi-mcp-server/tools/executeSql/index.js +0 -9
- package/dist/ibmi-mcp-server/tools/executeSql/index.js.map +0 -1
- package/dist/ibmi-mcp-server/tools/executeSql/logic.d.ts +0 -51
- package/dist/ibmi-mcp-server/tools/executeSql/logic.d.ts.map +0 -1
- package/dist/ibmi-mcp-server/tools/executeSql/logic.js +0 -179
- package/dist/ibmi-mcp-server/tools/executeSql/logic.js.map +0 -1
- package/dist/ibmi-mcp-server/tools/executeSql/registration.d.ts +0 -52
- package/dist/ibmi-mcp-server/tools/executeSql/registration.d.ts.map +0 -1
- package/dist/ibmi-mcp-server/tools/executeSql/registration.js +0 -161
- package/dist/ibmi-mcp-server/tools/executeSql/registration.js.map +0 -1
- package/dist/ibmi-mcp-server/tools/generateSql/index.d.ts +0 -13
- package/dist/ibmi-mcp-server/tools/generateSql/index.d.ts.map +0 -1
- package/dist/ibmi-mcp-server/tools/generateSql/index.js +0 -13
- package/dist/ibmi-mcp-server/tools/generateSql/index.js.map +0 -1
- package/dist/ibmi-mcp-server/tools/generateSql/logic.d.ts +0 -64
- package/dist/ibmi-mcp-server/tools/generateSql/logic.d.ts.map +0 -1
- package/dist/ibmi-mcp-server/tools/generateSql/logic.js +0 -190
- package/dist/ibmi-mcp-server/tools/generateSql/logic.js.map +0 -1
- package/dist/ibmi-mcp-server/tools/generateSql/registration.d.ts +0 -18
- package/dist/ibmi-mcp-server/tools/generateSql/registration.d.ts.map +0 -1
- package/dist/ibmi-mcp-server/tools/generateSql/registration.js +0 -64
- package/dist/ibmi-mcp-server/tools/generateSql/registration.js.map +0 -1
- package/dist/mcp-server/tools/catFactFetcher/index.d.ts +0 -8
- package/dist/mcp-server/tools/catFactFetcher/index.d.ts.map +0 -1
- package/dist/mcp-server/tools/catFactFetcher/index.js +0 -8
- package/dist/mcp-server/tools/catFactFetcher/index.js.map +0 -1
- package/dist/mcp-server/tools/catFactFetcher/logic.d.ts +0 -52
- package/dist/mcp-server/tools/catFactFetcher/logic.d.ts.map +0 -1
- package/dist/mcp-server/tools/catFactFetcher/logic.js +0 -95
- package/dist/mcp-server/tools/catFactFetcher/logic.js.map +0 -1
- package/dist/mcp-server/tools/catFactFetcher/registration.d.ts +0 -9
- package/dist/mcp-server/tools/catFactFetcher/registration.d.ts.map +0 -1
- package/dist/mcp-server/tools/catFactFetcher/registration.js +0 -43
- package/dist/mcp-server/tools/catFactFetcher/registration.js.map +0 -1
- package/dist/mcp-server/tools/echoTool/index.d.ts +0 -13
- package/dist/mcp-server/tools/echoTool/index.d.ts.map +0 -1
- package/dist/mcp-server/tools/echoTool/index.js +0 -13
- package/dist/mcp-server/tools/echoTool/index.js.map +0 -1
- package/dist/mcp-server/tools/echoTool/logic.d.ts +0 -69
- package/dist/mcp-server/tools/echoTool/logic.d.ts.map +0 -1
- package/dist/mcp-server/tools/echoTool/logic.js +0 -119
- package/dist/mcp-server/tools/echoTool/logic.js.map +0 -1
- package/dist/mcp-server/tools/echoTool/registration.d.ts +0 -9
- package/dist/mcp-server/tools/echoTool/registration.d.ts.map +0 -1
- package/dist/mcp-server/tools/echoTool/registration.js +0 -45
- package/dist/mcp-server/tools/echoTool/registration.js.map +0 -1
- package/dist/mcp-server/tools/imageTest/index.d.ts +0 -7
- package/dist/mcp-server/tools/imageTest/index.d.ts.map +0 -1
- package/dist/mcp-server/tools/imageTest/index.js +0 -7
- package/dist/mcp-server/tools/imageTest/index.js.map +0 -1
- package/dist/mcp-server/tools/imageTest/logic.d.ts +0 -27
- package/dist/mcp-server/tools/imageTest/logic.d.ts.map +0 -1
- package/dist/mcp-server/tools/imageTest/logic.js +0 -44
- package/dist/mcp-server/tools/imageTest/logic.js.map +0 -1
- package/dist/mcp-server/tools/imageTest/registration.d.ts +0 -9
- package/dist/mcp-server/tools/imageTest/registration.d.ts.map +0 -1
- package/dist/mcp-server/tools/imageTest/registration.js +0 -49
- package/dist/mcp-server/tools/imageTest/registration.js.map +0 -1
- package/dist/mcp-server/tools/utils/tool-utils.d.ts +0 -43
- package/dist/mcp-server/tools/utils/tool-utils.d.ts.map +0 -1
- package/dist/mcp-server/tools/utils/tool-utils.js +0 -44
- package/dist/mcp-server/tools/utils/tool-utils.js.map +0 -1
- package/dist/mcp-server/transports/core/headerUtils.d.ts +0 -27
- package/dist/mcp-server/transports/core/headerUtils.d.ts.map +0 -1
- package/dist/mcp-server/transports/core/headerUtils.js +0 -53
- package/dist/mcp-server/transports/core/headerUtils.js.map +0 -1
- package/dist/mcp-server/transports/core/honoNodeBridge.d.ts +0 -77
- package/dist/mcp-server/transports/core/honoNodeBridge.d.ts.map +0 -1
- package/dist/mcp-server/transports/core/honoNodeBridge.js +0 -150
- package/dist/mcp-server/transports/core/honoNodeBridge.js.map +0 -1
- package/dist/services/duck-db/duckDBConnectionManager.d.ts +0 -55
- package/dist/services/duck-db/duckDBConnectionManager.d.ts.map +0 -1
- package/dist/services/duck-db/duckDBConnectionManager.js +0 -184
- package/dist/services/duck-db/duckDBConnectionManager.js.map +0 -1
- package/dist/services/duck-db/duckDBQueryExecutor.d.ts +0 -18
- package/dist/services/duck-db/duckDBQueryExecutor.d.ts.map +0 -1
- package/dist/services/duck-db/duckDBQueryExecutor.js +0 -115
- package/dist/services/duck-db/duckDBQueryExecutor.js.map +0 -1
- package/dist/services/duck-db/duckDBService.d.ts +0 -27
- package/dist/services/duck-db/duckDBService.d.ts.map +0 -1
- package/dist/services/duck-db/duckDBService.js +0 -151
- package/dist/services/duck-db/duckDBService.js.map +0 -1
- package/dist/services/duck-db/types.d.ts +0 -135
- package/dist/services/duck-db/types.d.ts.map +0 -1
- package/dist/services/duck-db/types.js +0 -6
- package/dist/services/duck-db/types.js.map +0 -1
- package/dist/services/llm-providers/openRouterProvider.d.ts +0 -36
- package/dist/services/llm-providers/openRouterProvider.d.ts.map +0 -1
- package/dist/services/llm-providers/openRouterProvider.js +0 -235
- package/dist/services/llm-providers/openRouterProvider.js.map +0 -1
- package/dist/services/supabase/supabaseClient.d.ts +0 -25
- package/dist/services/supabase/supabaseClient.d.ts.map +0 -1
- package/dist/services/supabase/supabaseClient.js +0 -68
- package/dist/services/supabase/supabaseClient.js.map +0 -1
- package/dist/storage/duckdbExample.d.ts +0 -8
- package/dist/storage/duckdbExample.d.ts.map +0 -1
- package/dist/storage/duckdbExample.js +0 -197
- package/dist/storage/duckdbExample.js.map +0 -1
|
@@ -30,8 +30,15 @@ function createPinoLogger() {
|
|
|
30
30
|
const logLevel = mcpToPinoLevel[config.logLevel] || "info";
|
|
31
31
|
// Build a transport target list so we can combine console + file outputs.
|
|
32
32
|
const targets = [];
|
|
33
|
-
//
|
|
34
|
-
|
|
33
|
+
// CRITICAL: STDIO transport MUST NOT output colored logs to stdout.
|
|
34
|
+
// The MCP specification requires clean JSON-RPC on stdout with no ANSI codes.
|
|
35
|
+
// Respect NO_COLOR environment variable (https://no-color.org/)
|
|
36
|
+
const noColorEnv = process.env.NO_COLOR === "1" || process.env.FORCE_COLOR === "0";
|
|
37
|
+
const useColoredOutput = !isProd && process.stdout.isTTY && !isStdioTransport && !noColorEnv;
|
|
38
|
+
// Console output: colored pretty-print or plain JSON to stderr
|
|
39
|
+
// NEVER output to stdout in any mode (reserved for JSON-RPC in STDIO)
|
|
40
|
+
if (useColoredOutput) {
|
|
41
|
+
// Colored pretty-printing for dev with HTTP transport
|
|
35
42
|
targets.push({
|
|
36
43
|
target: "pino-pretty",
|
|
37
44
|
options: {
|
|
@@ -43,6 +50,17 @@ function createPinoLogger() {
|
|
|
43
50
|
level: "debug",
|
|
44
51
|
});
|
|
45
52
|
}
|
|
53
|
+
else if (!isStdioTransport) {
|
|
54
|
+
// Plain JSON to stderr when colors disabled (NO_COLOR, prod, etc.)
|
|
55
|
+
// Skip for STDIO transport to keep stderr quieter (logs go to files only)
|
|
56
|
+
targets.push({
|
|
57
|
+
target: "pino/file",
|
|
58
|
+
options: {
|
|
59
|
+
destination: process.stderr.fd,
|
|
60
|
+
},
|
|
61
|
+
level: logLevel,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
46
64
|
// File logging: required for stdio/prod; optional for others when logs dir is available.
|
|
47
65
|
if (isStdioTransport || isProd) {
|
|
48
66
|
if (!resolvedLogsDir) {
|
|
@@ -50,7 +68,7 @@ function createPinoLogger() {
|
|
|
50
68
|
}
|
|
51
69
|
}
|
|
52
70
|
if (resolvedLogsDir) {
|
|
53
|
-
// Combined rotating log file (JSON)
|
|
71
|
+
// Combined rotating log file (JSON)
|
|
54
72
|
targets.push({
|
|
55
73
|
target: "pino-roll",
|
|
56
74
|
options: {
|
|
@@ -58,11 +76,11 @@ function createPinoLogger() {
|
|
|
58
76
|
frequency: "daily",
|
|
59
77
|
mkdir: true,
|
|
60
78
|
size: "10m",
|
|
61
|
-
|
|
79
|
+
limit: { count: 5 },
|
|
62
80
|
},
|
|
63
81
|
level: "info",
|
|
64
82
|
});
|
|
65
|
-
// Level-specific rolling files
|
|
83
|
+
// Level-specific rolling files
|
|
66
84
|
targets.push({
|
|
67
85
|
target: "pino-roll",
|
|
68
86
|
options: {
|
|
@@ -70,7 +88,7 @@ function createPinoLogger() {
|
|
|
70
88
|
frequency: "daily",
|
|
71
89
|
mkdir: true,
|
|
72
90
|
size: "10m",
|
|
73
|
-
|
|
91
|
+
limit: { count: 5 },
|
|
74
92
|
},
|
|
75
93
|
level: "error",
|
|
76
94
|
}, {
|
|
@@ -80,7 +98,7 @@ function createPinoLogger() {
|
|
|
80
98
|
frequency: "daily",
|
|
81
99
|
mkdir: true,
|
|
82
100
|
size: "10m",
|
|
83
|
-
|
|
101
|
+
limit: { count: 5 },
|
|
84
102
|
},
|
|
85
103
|
level: "warn",
|
|
86
104
|
}, {
|
|
@@ -90,7 +108,7 @@ function createPinoLogger() {
|
|
|
90
108
|
frequency: "daily",
|
|
91
109
|
mkdir: true,
|
|
92
110
|
size: "10m",
|
|
93
|
-
|
|
111
|
+
limit: { count: 5 },
|
|
94
112
|
},
|
|
95
113
|
level: "info",
|
|
96
114
|
}, {
|
|
@@ -100,7 +118,7 @@ function createPinoLogger() {
|
|
|
100
118
|
frequency: "daily",
|
|
101
119
|
mkdir: true,
|
|
102
120
|
size: "10m",
|
|
103
|
-
|
|
121
|
+
limit: { count: 5 },
|
|
104
122
|
},
|
|
105
123
|
level: "debug",
|
|
106
124
|
});
|
|
@@ -142,35 +160,46 @@ function createPinoLogger() {
|
|
|
142
160
|
});
|
|
143
161
|
return pinoInstance;
|
|
144
162
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
let mainLogger = createPinoLogger();
|
|
164
|
+
let interactionLogger = createInteractionLogger();
|
|
165
|
+
/**
|
|
166
|
+
* Create the interaction logger based on current config
|
|
167
|
+
*/
|
|
168
|
+
function createInteractionLogger() {
|
|
169
|
+
if (config.logsPath) {
|
|
170
|
+
const interactionLogLevel = mcpToPinoLevel[config.logLevel] || "info";
|
|
171
|
+
return pino({
|
|
172
|
+
name: `${config.mcpServerName || "mcp-server"}-interactions`,
|
|
173
|
+
level: interactionLogLevel,
|
|
174
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
175
|
+
transport: {
|
|
176
|
+
targets: [
|
|
177
|
+
{
|
|
178
|
+
target: "pino-roll",
|
|
179
|
+
options: {
|
|
180
|
+
file: path.join(config.logsPath, "interactions.log"),
|
|
181
|
+
frequency: "daily",
|
|
182
|
+
mkdir: true,
|
|
183
|
+
size: "10m",
|
|
184
|
+
limit: { count: 5 },
|
|
185
|
+
},
|
|
186
|
+
level: "info",
|
|
165
187
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
return mainLogger.child({ name: "interaction-logger" });
|
|
194
|
+
}
|
|
171
195
|
}
|
|
172
|
-
|
|
173
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Reinitialize the logger with updated configuration
|
|
198
|
+
* Call this after CLI arguments are applied to config
|
|
199
|
+
*/
|
|
200
|
+
export function reinitializeLogger() {
|
|
201
|
+
mainLogger = createPinoLogger();
|
|
202
|
+
interactionLogger = createInteractionLogger();
|
|
174
203
|
}
|
|
175
204
|
// Wrapper function to preserve the original MCP log levels and handle notifications.
|
|
176
205
|
const logWrapper = (level) => (obj, msg) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/internal/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAGN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAatD,sEAAsE;AACtE,yCAAyC;AACzC,MAAM,cAAc,GAA8C;IAChE,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACf,CAAC;AAoBF,IAAI,qBAAwD,CAAC;AAE7D,SAAS,gBAAgB;IACvB,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,KAAK,YAAY,CAAC;IACnD,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,KAAK,OAAO,CAAC;IAC7D,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC;IACxC,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,QAAuB,CAAC,IAAI,MAAM,CAAC;IAE1E,0EAA0E;IAC1E,MAAM,OAAO,GAA6B,EAAE,CAAC;IAE7C,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/internal/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAGN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC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IAC9D,CAAC;AACH,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAC1B,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC;IAC5B,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAC1B,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAC1B,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAC1B,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,uCAAuC;IAEnE,cAAc,EAAE,CAAC,eAAuB,EAAE,IAA6B,EAAE,EAAE;QACzE,iBAAiB,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,wBAAwB,EAAE,CAAC,MAAyC,EAAE,EAAE;QACtE,qBAAqB,GAAG,MAAM,CAAC;IACjC,CAAC;IAED,QAAQ,EAAE,CAAC,QAAqB,EAAE,EAAE;QAClC,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,UAAU,CAAC,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,IAAI,CACb,mCAAmC,QAAQ,gCAAgC,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,wFAAwF;IACxF,IAAI,EAAE,UAAU;CACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibm/ibmi-mcp-server",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A production-grade
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A production-grade MCP server for IBM i",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typecheck": "tsc --noEmit",
|
|
42
42
|
"tree": "tsx scripts/tree.ts",
|
|
43
43
|
"fetch-spec": "tsx scripts/fetch-openapi-spec.ts",
|
|
44
|
-
"format": "prettier --write \"**/*.{ts,js,json,
|
|
44
|
+
"format": "prettier --write \"**/*.{ts,js,json,html,css}\"",
|
|
45
45
|
"inspector": "npx @modelcontextprotocol/inspector --config mcp.json --server default-server",
|
|
46
46
|
"mcpjam": "npx @mcpjam/cli",
|
|
47
47
|
"db:duckdb-example": "MCP_LOG_LEVEL=debug tsc && node dist/storage/duckdbExample.js",
|
|
@@ -58,45 +58,51 @@
|
|
|
58
58
|
"release:minor": "standard-version --release-as minor",
|
|
59
59
|
"release:major": "standard-version --release-as major",
|
|
60
60
|
"release:patch": "standard-version --release-as patch",
|
|
61
|
-
"release:first": "standard-version --first-release"
|
|
61
|
+
"release:first": "standard-version --first-release",
|
|
62
|
+
"deploy:debug": "./scripts/debug-deploy.sh",
|
|
63
|
+
"deploy:debug:fast": "./scripts/debug-deploy.sh --skip-validation --skip-build",
|
|
64
|
+
"deploy:debug:safe": "./scripts/debug-deploy.sh --skip-modules",
|
|
65
|
+
"release:prepare": "./scripts/release-prepare.sh",
|
|
66
|
+
"release:prepare:patch": "./scripts/release-prepare.sh patch",
|
|
67
|
+
"release:prepare:minor": "./scripts/release-prepare.sh minor",
|
|
68
|
+
"release:prepare:major": "./scripts/release-prepare.sh major",
|
|
69
|
+
"release:finalize": "./scripts/release-finalize.sh",
|
|
70
|
+
"release:undo": "./scripts/release-undo.sh"
|
|
62
71
|
},
|
|
63
72
|
"dependencies": {
|
|
64
|
-
"@duckdb/node-api": "^1.3.2-alpha.26",
|
|
65
73
|
"@hono/node-server": "^1.17.1",
|
|
66
74
|
"@ibm/mapepire-js": "^0.6.0",
|
|
67
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
68
|
-
"@
|
|
75
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
76
|
+
"@opentelemetry/api": "^1.9.0",
|
|
77
|
+
"@opentelemetry/auto-instrumentations-node": "^0.62.1",
|
|
78
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.203.0",
|
|
79
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
|
|
80
|
+
"@opentelemetry/resources": "^2.0.1",
|
|
81
|
+
"@opentelemetry/sdk-metrics": "^2.0.1",
|
|
82
|
+
"@opentelemetry/sdk-node": "^0.203.0",
|
|
83
|
+
"@opentelemetry/sdk-trace-node": "^2.0.1",
|
|
84
|
+
"@opentelemetry/semantic-conventions": "^1.36.0",
|
|
69
85
|
"axios": "^1.11.0",
|
|
70
86
|
"chrono-node": "^2.8.0",
|
|
71
87
|
"dotenv": "^16.6.1",
|
|
88
|
+
"glob": "^10.5.0",
|
|
72
89
|
"hono": "^4.8.9",
|
|
73
90
|
"ignore": "^7.0.5",
|
|
74
91
|
"jose": "^6.0.13",
|
|
75
92
|
"js-yaml": "^4.1.0",
|
|
76
93
|
"node-cron": "^4.2.1",
|
|
77
|
-
"node-sql-parser": "^5.3.12",
|
|
78
94
|
"openai": "^5.15.0",
|
|
79
95
|
"partial-json": "^0.1.7",
|
|
80
96
|
"pino": "^9.9.0",
|
|
97
|
+
"pino-pretty": "^13.0.0",
|
|
98
|
+
"pino-roll": "^1.1.0",
|
|
81
99
|
"reflect-metadata": "^0.2.2",
|
|
82
100
|
"sanitize-html": "^2.17.0",
|
|
83
101
|
"tiktoken": "^1.0.22",
|
|
84
|
-
"ts-node": "^
|
|
102
|
+
"ts-node": "^1.7.1",
|
|
85
103
|
"validator": "^13.15.23",
|
|
86
|
-
"vite": "^6.3.5",
|
|
87
104
|
"zod": "^3.25.76",
|
|
88
|
-
"zod-to-json-schema": "^3.24.6"
|
|
89
|
-
"@opentelemetry/api": "^1.9.0",
|
|
90
|
-
"@opentelemetry/auto-instrumentations-node": "^0.62.1",
|
|
91
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.203.0",
|
|
92
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
|
|
93
|
-
"@opentelemetry/resources": "^2.0.1",
|
|
94
|
-
"@opentelemetry/sdk-metrics": "^2.0.1",
|
|
95
|
-
"@opentelemetry/sdk-node": "^0.203.0",
|
|
96
|
-
"@opentelemetry/sdk-trace-node": "^2.0.1",
|
|
97
|
-
"@opentelemetry/semantic-conventions": "^1.36.0",
|
|
98
|
-
"pino-pretty": "^13.0.0",
|
|
99
|
-
"pino-roll": "^1.1.0"
|
|
105
|
+
"zod-to-json-schema": "^3.24.6"
|
|
100
106
|
},
|
|
101
107
|
"devDependencies": {
|
|
102
108
|
"@anatine/zod-mock": "^3.14.0",
|
|
@@ -105,7 +111,6 @@
|
|
|
105
111
|
"@types/js-yaml": "^4.0.9",
|
|
106
112
|
"@types/node": "^24.3.0",
|
|
107
113
|
"@types/node-cron": "^3.0.11",
|
|
108
|
-
"@types/node-sql-parser": "^1.0.0",
|
|
109
114
|
"@types/sanitize-html": "^2.16.0",
|
|
110
115
|
"@types/validator": "13.15.2",
|
|
111
116
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -122,6 +127,7 @@
|
|
|
122
127
|
"typedoc": "^0.28.10",
|
|
123
128
|
"typescript": "^5.8.3",
|
|
124
129
|
"typescript-eslint": "^8.40.0",
|
|
130
|
+
"vite": "^6.3.5",
|
|
125
131
|
"vite-tsconfig-paths": "^5.1.4",
|
|
126
132
|
"vitest": "^3.2.4"
|
|
127
133
|
},
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Barrel file for the execute SQL tool
|
|
3
|
-
* This module exports the registration function and configuration utilities
|
|
4
|
-
* for the dynamic SQL execution tool.
|
|
5
|
-
*
|
|
6
|
-
* @module src/mcp-server/tools/executeSql/index
|
|
7
|
-
*/
|
|
8
|
-
export { registerExecuteSqlTool, setExecuteSqlConfig, getExecuteSqlConfig, isExecuteSqlEnabled, type ExecuteSqlToolConfig, } from "./registration.js";
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/executeSql/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Barrel file for the execute SQL tool
|
|
3
|
-
* This module exports the registration function and configuration utilities
|
|
4
|
-
* for the dynamic SQL execution tool.
|
|
5
|
-
*
|
|
6
|
-
* @module src/mcp-server/tools/executeSql/index
|
|
7
|
-
*/
|
|
8
|
-
export { registerExecuteSqlTool, setExecuteSqlConfig, getExecuteSqlConfig, isExecuteSqlEnabled, } from "./registration.js";
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/executeSql/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Defines the core logic, schemas, and types for the `execute_sql` tool.
|
|
3
|
-
* This module provides dynamic SQL execution capabilities for the IBM i database.
|
|
4
|
-
* Unlike YAML tools with predefined statements, this tool accepts arbitrary SQL at runtime.
|
|
5
|
-
* @module src/mcp-server/tools/executeSql/logic
|
|
6
|
-
* @see {@link src/mcp-server/tools/executeSql/registration.ts} for the handler and registration logic.
|
|
7
|
-
*/
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
/**
|
|
10
|
-
* Zod schema defining the input parameters for the `execute_sql` tool.
|
|
11
|
-
* CRITICAL: The descriptions are sent to the LLM and must be clear.
|
|
12
|
-
*/
|
|
13
|
-
export declare const ExecuteSqlInputSchema: z.ZodObject<{
|
|
14
|
-
sql: z.ZodString;
|
|
15
|
-
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
sql: string;
|
|
17
|
-
}, {
|
|
18
|
-
sql: string;
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* Zod schema for the successful response of the `execute_sql` tool.
|
|
22
|
-
*/
|
|
23
|
-
export declare const ExecuteSqlResponseSchema: z.ZodObject<{
|
|
24
|
-
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
25
|
-
rowCount: z.ZodNumber;
|
|
26
|
-
executionTimeMs: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
data: Record<string, unknown>[];
|
|
30
|
-
rowCount: number;
|
|
31
|
-
metadata?: Record<string, unknown> | undefined;
|
|
32
|
-
executionTimeMs?: number | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
data: Record<string, unknown>[];
|
|
35
|
-
rowCount: number;
|
|
36
|
-
metadata?: Record<string, unknown> | undefined;
|
|
37
|
-
executionTimeMs?: number | undefined;
|
|
38
|
-
}>;
|
|
39
|
-
export type ExecuteSqlInput = z.infer<typeof ExecuteSqlInputSchema>;
|
|
40
|
-
export type ExecuteSqlResponse = z.infer<typeof ExecuteSqlResponseSchema>;
|
|
41
|
-
/**
|
|
42
|
-
* Processes the core logic for the `execute_sql` tool.
|
|
43
|
-
* This function executes arbitrary SQL statements against the IBM i database.
|
|
44
|
-
* Only read-only operations are allowed for security.
|
|
45
|
-
*
|
|
46
|
-
* @param params - The validated input parameters containing the SQL statement
|
|
47
|
-
* @returns A promise resolving with the structured response data
|
|
48
|
-
* @throws {McpError} If the SQL execution encounters an unrecoverable issue
|
|
49
|
-
*/
|
|
50
|
-
export declare function executeSqlLogic(params: ExecuteSqlInput): Promise<ExecuteSqlResponse>;
|
|
51
|
-
//# sourceMappingURL=logic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/executeSql/logic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6BxB;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;EAShC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;EAiBnC,CAAC;AAGH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAsE1E;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAwF7B"}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Defines the core logic, schemas, and types for the `execute_sql` tool.
|
|
3
|
-
* This module provides dynamic SQL execution capabilities for the IBM i database.
|
|
4
|
-
* Unlike YAML tools with predefined statements, this tool accepts arbitrary SQL at runtime.
|
|
5
|
-
* @module src/mcp-server/tools/executeSql/logic
|
|
6
|
-
* @see {@link src/mcp-server/tools/executeSql/registration.ts} for the handler and registration logic.
|
|
7
|
-
*/
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
import { JsonRpcErrorCode, McpError } from "../../../types-global/errors.js";
|
|
10
|
-
import { getRequestContext } from "../../../utils/index.js";
|
|
11
|
-
import { logger } from "../../../utils/internal/logger.js";
|
|
12
|
-
import { IBMiConnectionPool } from "../../services/connectionPool.js";
|
|
13
|
-
/**
|
|
14
|
-
* Restricted SQL keywords that are not allowed in execute-sql tool
|
|
15
|
-
* This provides basic protection against destructive operations
|
|
16
|
-
*/
|
|
17
|
-
const RESTRICTED_KEYWORDS = [
|
|
18
|
-
"DROP",
|
|
19
|
-
"DELETE",
|
|
20
|
-
"TRUNCATE",
|
|
21
|
-
"ALTER",
|
|
22
|
-
"CREATE",
|
|
23
|
-
"INSERT",
|
|
24
|
-
"UPDATE",
|
|
25
|
-
"GRANT",
|
|
26
|
-
"REVOKE",
|
|
27
|
-
"COMMIT",
|
|
28
|
-
"ROLLBACK",
|
|
29
|
-
];
|
|
30
|
-
/**
|
|
31
|
-
* Maximum allowed SQL statement length to prevent abuse
|
|
32
|
-
*/
|
|
33
|
-
const MAX_SQL_LENGTH = 10000;
|
|
34
|
-
/**
|
|
35
|
-
* Zod schema defining the input parameters for the `execute_sql` tool.
|
|
36
|
-
* CRITICAL: The descriptions are sent to the LLM and must be clear.
|
|
37
|
-
*/
|
|
38
|
-
export const ExecuteSqlInputSchema = z.object({
|
|
39
|
-
sql: z
|
|
40
|
-
.string()
|
|
41
|
-
.min(1, "SQL statement cannot be empty.")
|
|
42
|
-
.max(MAX_SQL_LENGTH, `SQL statement cannot exceed ${MAX_SQL_LENGTH} characters.`)
|
|
43
|
-
.describe("The SQL statement to execute against the IBM i database."),
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* Zod schema for the successful response of the `execute_sql` tool.
|
|
47
|
-
*/
|
|
48
|
-
export const ExecuteSqlResponseSchema = z.object({
|
|
49
|
-
data: z
|
|
50
|
-
.array(z.record(z.unknown()))
|
|
51
|
-
.describe("Array of result rows returned by the SQL query."),
|
|
52
|
-
rowCount: z
|
|
53
|
-
.number()
|
|
54
|
-
.int()
|
|
55
|
-
.min(0)
|
|
56
|
-
.describe("Number of rows returned by the query."),
|
|
57
|
-
executionTimeMs: z
|
|
58
|
-
.number()
|
|
59
|
-
.optional()
|
|
60
|
-
.describe("Query execution time in milliseconds."),
|
|
61
|
-
metadata: z
|
|
62
|
-
.record(z.unknown())
|
|
63
|
-
.optional()
|
|
64
|
-
.describe("Additional metadata about the query execution."),
|
|
65
|
-
});
|
|
66
|
-
/**
|
|
67
|
-
* Validates SQL statement for security and safety
|
|
68
|
-
* @param sql - SQL statement to validate
|
|
69
|
-
* @throws {McpError} If the SQL statement contains restricted keywords or patterns
|
|
70
|
-
* @private
|
|
71
|
-
*/
|
|
72
|
-
function validateSqlSecurity(sql) {
|
|
73
|
-
const context = getRequestContext();
|
|
74
|
-
const normalizedSql = sql.trim().toUpperCase();
|
|
75
|
-
// Check for restricted keywords at the beginning of statements
|
|
76
|
-
for (const keyword of RESTRICTED_KEYWORDS) {
|
|
77
|
-
if (normalizedSql.startsWith(keyword)) {
|
|
78
|
-
logger.warning({
|
|
79
|
-
...context,
|
|
80
|
-
keyword,
|
|
81
|
-
sqlPrefix: sql.substring(0, 50),
|
|
82
|
-
}, "Restricted SQL keyword detected");
|
|
83
|
-
throw new McpError(JsonRpcErrorCode.ValidationError, `SQL statement cannot start with restricted keyword: ${keyword}. Only SELECT and read-only operations are allowed.`, { keyword, sqlPrefix: sql.substring(0, 50) });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
// Check for potentially dangerous patterns
|
|
87
|
-
const dangerousPatterns = [
|
|
88
|
-
/;\s*(DROP|DELETE|TRUNCATE|ALTER|CREATE|INSERT|UPDATE)\s+/i,
|
|
89
|
-
/UNION\s+SELECT.*INTO\s+/i,
|
|
90
|
-
/EXEC\s*\(/i,
|
|
91
|
-
/(CALL|EXECUTE)\s+/i,
|
|
92
|
-
];
|
|
93
|
-
for (const pattern of dangerousPatterns) {
|
|
94
|
-
if (pattern.test(sql)) {
|
|
95
|
-
logger.warning({
|
|
96
|
-
...context,
|
|
97
|
-
pattern: pattern.source,
|
|
98
|
-
sqlPrefix: sql.substring(0, 100),
|
|
99
|
-
}, "Potentially dangerous SQL pattern detected");
|
|
100
|
-
throw new McpError(JsonRpcErrorCode.ValidationError, "SQL statement contains potentially dangerous patterns. Only safe, read-only queries are allowed.", {
|
|
101
|
-
pattern: pattern.source,
|
|
102
|
-
sqlPrefix: sql.substring(0, 100),
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
logger.debug({
|
|
107
|
-
...context,
|
|
108
|
-
sqlLength: sql.length,
|
|
109
|
-
sqlPrefix: sql.substring(0, 50),
|
|
110
|
-
}, "SQL security validation passed");
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Processes the core logic for the `execute_sql` tool.
|
|
114
|
-
* This function executes arbitrary SQL statements against the IBM i database.
|
|
115
|
-
* Only read-only operations are allowed for security.
|
|
116
|
-
*
|
|
117
|
-
* @param params - The validated input parameters containing the SQL statement
|
|
118
|
-
* @returns A promise resolving with the structured response data
|
|
119
|
-
* @throws {McpError} If the SQL execution encounters an unrecoverable issue
|
|
120
|
-
*/
|
|
121
|
-
export async function executeSqlLogic(params) {
|
|
122
|
-
const context = getRequestContext();
|
|
123
|
-
logger.debug({
|
|
124
|
-
...context,
|
|
125
|
-
sqlLength: params.sql.length,
|
|
126
|
-
sqlPrefix: params.sql.substring(0, 50),
|
|
127
|
-
}, "Processing execute SQL logic");
|
|
128
|
-
// Validate SQL security before execution
|
|
129
|
-
validateSqlSecurity(params.sql);
|
|
130
|
-
const startTime = Date.now();
|
|
131
|
-
try {
|
|
132
|
-
// Execute the SQL query using the existing connection pool
|
|
133
|
-
const result = await IBMiConnectionPool.executeQuery(params.sql, [], // No parameters for dynamic SQL
|
|
134
|
-
context);
|
|
135
|
-
const executionTime = Date.now() - startTime;
|
|
136
|
-
if (!result.success) {
|
|
137
|
-
throw new McpError(JsonRpcErrorCode.DatabaseError, "SQL query execution failed", {
|
|
138
|
-
sql: params.sql.substring(0, 100),
|
|
139
|
-
sqlReturnCode: result.sql_rc,
|
|
140
|
-
executionTime,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
const response = {
|
|
144
|
-
data: result.data || [],
|
|
145
|
-
rowCount: result.data?.length || 0,
|
|
146
|
-
executionTimeMs: executionTime,
|
|
147
|
-
};
|
|
148
|
-
// Add metadata if available from the query result
|
|
149
|
-
if (result.metadata) {
|
|
150
|
-
response.metadata = result.metadata;
|
|
151
|
-
}
|
|
152
|
-
logger.debug({
|
|
153
|
-
...context,
|
|
154
|
-
rowCount: response.rowCount,
|
|
155
|
-
executionTime: response.executionTimeMs,
|
|
156
|
-
sqlPrefix: params.sql.substring(0, 50),
|
|
157
|
-
}, "SQL query executed successfully");
|
|
158
|
-
return response;
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
const executionTime = Date.now() - startTime;
|
|
162
|
-
logger.error({
|
|
163
|
-
...context,
|
|
164
|
-
error: error instanceof Error ? error.message : String(error),
|
|
165
|
-
executionTime,
|
|
166
|
-
sqlPrefix: params.sql.substring(0, 100),
|
|
167
|
-
}, "SQL execution failed");
|
|
168
|
-
// Re-throw McpErrors as-is, wrap other errors
|
|
169
|
-
if (error instanceof McpError) {
|
|
170
|
-
throw error;
|
|
171
|
-
}
|
|
172
|
-
throw new McpError(JsonRpcErrorCode.DatabaseError, `SQL execution failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
173
|
-
sql: params.sql.substring(0, 100),
|
|
174
|
-
executionTime,
|
|
175
|
-
originalError: error instanceof Error ? error.name : "Unknown",
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=logic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logic.js","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/executeSql/logic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAA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;YACE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;YACjC,aAAa;YACb,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAC/D,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Handles registration and error handling for the `execute_sql` tool.
|
|
3
|
-
* This module acts as the "handler" layer, connecting the pure business logic to the
|
|
4
|
-
* MCP server and ensuring all outcomes (success or failure) are handled gracefully.
|
|
5
|
-
* @module src/mcp-server/tools/executeSql/registration
|
|
6
|
-
* @see {@link src/mcp-server/tools/executeSql/logic.ts} for the core business logic and schemas.
|
|
7
|
-
*/
|
|
8
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
|
-
/**
|
|
10
|
-
* Configuration interface for the execute SQL tool
|
|
11
|
-
* This allows the tool to be enabled/disabled and configured via YAML
|
|
12
|
-
*/
|
|
13
|
-
export interface ExecuteSqlToolConfig {
|
|
14
|
-
/** Whether the tool is enabled */
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
/** Tool description override */
|
|
17
|
-
description?: string;
|
|
18
|
-
/** Security configuration */
|
|
19
|
-
security?: {
|
|
20
|
-
/** Whether to enforce read-only mode (default: true) */
|
|
21
|
-
readOnly?: boolean;
|
|
22
|
-
/** Maximum query length (default: 10000) */
|
|
23
|
-
maxQueryLength?: number;
|
|
24
|
-
/** Additional forbidden keywords */
|
|
25
|
-
forbiddenKeywords?: string[];
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Set the configuration for the execute SQL tool
|
|
30
|
-
* This is called by the YAML configuration system
|
|
31
|
-
* @param config - Tool configuration
|
|
32
|
-
*/
|
|
33
|
-
export declare function setExecuteSqlConfig(config: Partial<ExecuteSqlToolConfig>): void;
|
|
34
|
-
/**
|
|
35
|
-
* Get the current configuration for the execute SQL tool
|
|
36
|
-
* @returns Current tool configuration
|
|
37
|
-
*/
|
|
38
|
-
export declare function getExecuteSqlConfig(): ExecuteSqlToolConfig;
|
|
39
|
-
/**
|
|
40
|
-
* Check if the execute SQL tool is enabled
|
|
41
|
-
* @returns True if the tool is enabled
|
|
42
|
-
*/
|
|
43
|
-
export declare function isExecuteSqlEnabled(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Registers the 'execute_sql' tool and its handler with the provided MCP server instance.
|
|
46
|
-
* This function uses ErrorHandler.tryCatch to ensure that any failure during the
|
|
47
|
-
* registration process itself is caught and logged, preventing server startup failures.
|
|
48
|
-
*
|
|
49
|
-
* @param server - The MCP server instance to register the tool with.
|
|
50
|
-
*/
|
|
51
|
-
export declare const registerExecuteSqlTool: (server: McpServer) => Promise<void>;
|
|
52
|
-
//# sourceMappingURL=registration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/executeSql/registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmCpE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE;QACT,wDAAwD;QACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,4CAA4C;QAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,oCAAoC;QACpC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH;AAmBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACpC,IAAI,CAoBN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,oBAAoB,CAE1D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,KAChB,OAAO,CAAC,IAAI,CAmGd,CAAC"}
|