@panguard-ai/panguard-mcp 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Panguard AI Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Panguard MCP - CLI Entry Point
4
+ * Panguard MCP - CLI 入口點
5
+ *
6
+ * Starts the Panguard MCP server on stdio for integration with
7
+ * Claude Desktop, Cursor, or Claude Code.
8
+ * 在 stdio 上啟動 Panguard MCP 伺服器,用於與 Claude Desktop、Cursor 或 Claude Code 整合。
9
+ *
10
+ * @module @panguard-ai/panguard-mcp/cli
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG"}
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Panguard MCP - CLI Entry Point
4
+ * Panguard MCP - CLI 入口點
5
+ *
6
+ * Starts the Panguard MCP server on stdio for integration with
7
+ * Claude Desktop, Cursor, or Claude Code.
8
+ * 在 stdio 上啟動 Panguard MCP 伺服器,用於與 Claude Desktop、Cursor 或 Claude Code 整合。
9
+ *
10
+ * @module @panguard-ai/panguard-mcp/cli
11
+ */
12
+ import { startMCPServer, PANGUARD_MCP_VERSION } from '../server.js';
13
+ import { createLogger } from '@panguard-ai/core';
14
+ const logger = createLogger('panguard-mcp:cli');
15
+ // Print version if --version or -v flag provided
16
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
17
+ process.stdout.write(PANGUARD_MCP_VERSION + '\n');
18
+ process.exit(0);
19
+ }
20
+ // Print help if --help or -h flag provided
21
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
22
+ process.stdout.write(`
23
+ Panguard MCP Server v${PANGUARD_MCP_VERSION}
24
+ Usage: panguard-mcp [options]
25
+
26
+ Options:
27
+ --version, -v Print version and exit
28
+ --help, -h Print this help and exit
29
+
30
+ Description:
31
+ Starts the Panguard MCP server on stdio, allowing Claude Desktop,
32
+ Cursor, or Claude Code to control Panguard security scanning and
33
+ real-time threat monitoring via conversation.
34
+
35
+ 透過 stdio 啟動 Panguard MCP 伺服器,讓 Claude Desktop、Cursor
36
+ 或 Claude Code 透過對話控制 Panguard 安全掃描和即時威脅監控。
37
+
38
+ Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
39
+ {
40
+ "mcpServers": {
41
+ "panguard": {
42
+ "command": "panguard-mcp"
43
+ }
44
+ }
45
+ }
46
+
47
+ Available tools:
48
+ panguard_scan Run system security health check
49
+ panguard_scan_code Scan source code for vulnerabilities (SAST)
50
+ panguard_guard_start Start real-time threat monitoring
51
+ panguard_guard_stop Stop threat monitoring daemon
52
+ panguard_status Get status of all Panguard services
53
+ panguard_alerts Get recent security alerts
54
+ panguard_block_ip Manually block an IP address
55
+ panguard_generate_report Generate PDF compliance report
56
+ panguard_init Initialize Panguard configuration
57
+ panguard_deploy One-click deployment of all Panguard services
58
+ `);
59
+ process.exit(0);
60
+ }
61
+ // Start the MCP server
62
+ startMCPServer().catch((err) => {
63
+ const message = err instanceof Error ? err.message : String(err);
64
+ logger.error('MCP server failed to start: ' + message);
65
+ process.exit(1);
66
+ });
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAEhD,iDAAiD;AACjD,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACtE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,2CAA2C;AAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;uBACA,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC1C,CAAC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,uBAAuB;AACvB,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACtC,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,OAAO,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Panguard MCP - Public API
3
+ * Panguard MCP - 公開 API
4
+ *
5
+ * MCP server for Panguard AI — control security scanning and guard from
6
+ * Claude Desktop, Cursor, or Claude Code via conversation.
7
+ * 用於 Panguard AI 的 MCP 伺服器 — 透過對話從 Claude Desktop、Cursor 或 Claude Code 控制安全掃描和守護。
8
+ *
9
+ * @module @panguard-ai/panguard-mcp
10
+ */
11
+ export { startMCPServer, getAllToolDefinitions, dispatchTool, PANGUARD_MCP_VERSION } from './server.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Panguard MCP - Public API
3
+ * Panguard MCP - 公開 API
4
+ *
5
+ * MCP server for Panguard AI — control security scanning and guard from
6
+ * Claude Desktop, Cursor, or Claude Code via conversation.
7
+ * 用於 Panguard AI 的 MCP 伺服器 — 透過對話從 Claude Desktop、Cursor 或 Claude Code 控制安全掃描和守護。
8
+ *
9
+ * @module @panguard-ai/panguard-mcp
10
+ */
11
+ export { startMCPServer, getAllToolDefinitions, dispatchTool, PANGUARD_MCP_VERSION } from './server.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,356 @@
1
+ /**
2
+ * Panguard MCP - Server
3
+ * Panguard MCP - 伺服器
4
+ *
5
+ * Main MCP server entry: registers all tools and dispatches incoming requests.
6
+ * 主要 MCP 伺服器入口:註冊所有工具並分派傳入請求。
7
+ *
8
+ * @module @panguard-ai/panguard-mcp/server
9
+ */
10
+ /** MCP server version / MCP 伺服器版本 */
11
+ export declare const PANGUARD_MCP_VERSION: string;
12
+ /**
13
+ * Returns the complete list of all MCP tool definitions.
14
+ * 返回所有 MCP 工具定義的完整清單。
15
+ */
16
+ export declare function getAllToolDefinitions(): ({
17
+ name: string;
18
+ description: string;
19
+ inputSchema: {
20
+ type: "object";
21
+ properties: {
22
+ depth: {
23
+ type: string;
24
+ enum: string[];
25
+ description: string;
26
+ default: string;
27
+ };
28
+ lang: {
29
+ type: string;
30
+ enum: string[];
31
+ description: string;
32
+ default: string;
33
+ };
34
+ dir?: undefined;
35
+ dataDir?: undefined;
36
+ mode?: undefined;
37
+ limit?: undefined;
38
+ severity?: undefined;
39
+ ip?: undefined;
40
+ duration?: undefined;
41
+ reason?: undefined;
42
+ output?: undefined;
43
+ path?: undefined;
44
+ generateReport?: undefined;
45
+ };
46
+ required?: undefined;
47
+ };
48
+ } | {
49
+ name: string;
50
+ description: string;
51
+ inputSchema: {
52
+ type: "object";
53
+ properties: {
54
+ dir: {
55
+ type: string;
56
+ description: string;
57
+ default: string;
58
+ };
59
+ lang: {
60
+ type: string;
61
+ enum: string[];
62
+ default: string;
63
+ description?: undefined;
64
+ };
65
+ depth?: undefined;
66
+ dataDir?: undefined;
67
+ mode?: undefined;
68
+ limit?: undefined;
69
+ severity?: undefined;
70
+ ip?: undefined;
71
+ duration?: undefined;
72
+ reason?: undefined;
73
+ output?: undefined;
74
+ path?: undefined;
75
+ generateReport?: undefined;
76
+ };
77
+ required: string[];
78
+ };
79
+ } | {
80
+ name: string;
81
+ description: string;
82
+ inputSchema: {
83
+ type: "object";
84
+ properties: {
85
+ dataDir: {
86
+ type: string;
87
+ description: string;
88
+ };
89
+ mode: {
90
+ type: string;
91
+ enum: string[];
92
+ description: string;
93
+ default?: undefined;
94
+ };
95
+ depth?: undefined;
96
+ lang?: undefined;
97
+ dir?: undefined;
98
+ limit?: undefined;
99
+ severity?: undefined;
100
+ ip?: undefined;
101
+ duration?: undefined;
102
+ reason?: undefined;
103
+ output?: undefined;
104
+ path?: undefined;
105
+ generateReport?: undefined;
106
+ };
107
+ required?: undefined;
108
+ };
109
+ } | {
110
+ name: string;
111
+ description: string;
112
+ inputSchema: {
113
+ type: "object";
114
+ properties: {
115
+ dataDir: {
116
+ type: string;
117
+ description: string;
118
+ };
119
+ depth?: undefined;
120
+ lang?: undefined;
121
+ dir?: undefined;
122
+ mode?: undefined;
123
+ limit?: undefined;
124
+ severity?: undefined;
125
+ ip?: undefined;
126
+ duration?: undefined;
127
+ reason?: undefined;
128
+ output?: undefined;
129
+ path?: undefined;
130
+ generateReport?: undefined;
131
+ };
132
+ required?: undefined;
133
+ };
134
+ } | {
135
+ name: string;
136
+ description: string;
137
+ inputSchema: {
138
+ type: "object";
139
+ properties: {
140
+ limit: {
141
+ type: string;
142
+ description: string;
143
+ default: number;
144
+ };
145
+ severity: {
146
+ type: string;
147
+ enum: string[];
148
+ default: string;
149
+ };
150
+ dataDir: {
151
+ type: string;
152
+ description: string;
153
+ };
154
+ depth?: undefined;
155
+ lang?: undefined;
156
+ dir?: undefined;
157
+ mode?: undefined;
158
+ ip?: undefined;
159
+ duration?: undefined;
160
+ reason?: undefined;
161
+ output?: undefined;
162
+ path?: undefined;
163
+ generateReport?: undefined;
164
+ };
165
+ required?: undefined;
166
+ };
167
+ } | {
168
+ name: string;
169
+ description: string;
170
+ inputSchema: {
171
+ type: "object";
172
+ properties: {
173
+ ip: {
174
+ type: string;
175
+ description: string;
176
+ };
177
+ duration: {
178
+ type: string;
179
+ description: string;
180
+ default: string;
181
+ };
182
+ reason: {
183
+ type: string;
184
+ description: string;
185
+ };
186
+ depth?: undefined;
187
+ lang?: undefined;
188
+ dir?: undefined;
189
+ dataDir?: undefined;
190
+ mode?: undefined;
191
+ limit?: undefined;
192
+ severity?: undefined;
193
+ output?: undefined;
194
+ path?: undefined;
195
+ generateReport?: undefined;
196
+ };
197
+ required: string[];
198
+ };
199
+ } | {
200
+ name: string;
201
+ description: string;
202
+ inputSchema: {
203
+ type: "object";
204
+ properties: {
205
+ output: {
206
+ type: string;
207
+ description: string;
208
+ default: string;
209
+ };
210
+ lang: {
211
+ type: string;
212
+ enum: string[];
213
+ default: string;
214
+ description?: undefined;
215
+ };
216
+ depth: {
217
+ type: string;
218
+ enum: string[];
219
+ default: string;
220
+ description?: undefined;
221
+ };
222
+ dir?: undefined;
223
+ dataDir?: undefined;
224
+ mode?: undefined;
225
+ limit?: undefined;
226
+ severity?: undefined;
227
+ ip?: undefined;
228
+ duration?: undefined;
229
+ reason?: undefined;
230
+ path?: undefined;
231
+ generateReport?: undefined;
232
+ };
233
+ required?: undefined;
234
+ };
235
+ } | {
236
+ name: string;
237
+ description: string;
238
+ inputSchema: {
239
+ type: "object";
240
+ properties: {
241
+ dataDir: {
242
+ type: string;
243
+ description: string;
244
+ };
245
+ lang: {
246
+ type: string;
247
+ enum: string[];
248
+ default: string;
249
+ description?: undefined;
250
+ };
251
+ mode: {
252
+ type: string;
253
+ enum: string[];
254
+ default: string;
255
+ description?: undefined;
256
+ };
257
+ depth?: undefined;
258
+ dir?: undefined;
259
+ limit?: undefined;
260
+ severity?: undefined;
261
+ ip?: undefined;
262
+ duration?: undefined;
263
+ reason?: undefined;
264
+ output?: undefined;
265
+ path?: undefined;
266
+ generateReport?: undefined;
267
+ };
268
+ required?: undefined;
269
+ };
270
+ } | {
271
+ name: string;
272
+ description: string;
273
+ inputSchema: {
274
+ type: "object";
275
+ properties: {
276
+ path: {
277
+ type: string;
278
+ description: string;
279
+ };
280
+ depth?: undefined;
281
+ lang?: undefined;
282
+ dir?: undefined;
283
+ dataDir?: undefined;
284
+ mode?: undefined;
285
+ limit?: undefined;
286
+ severity?: undefined;
287
+ ip?: undefined;
288
+ duration?: undefined;
289
+ reason?: undefined;
290
+ output?: undefined;
291
+ generateReport?: undefined;
292
+ };
293
+ required: string[];
294
+ };
295
+ } | {
296
+ name: string;
297
+ description: string;
298
+ inputSchema: {
299
+ type: "object";
300
+ properties: {
301
+ dataDir: {
302
+ type: string;
303
+ description: string;
304
+ };
305
+ lang: {
306
+ type: string;
307
+ enum: string[];
308
+ default: string;
309
+ description?: undefined;
310
+ };
311
+ mode: {
312
+ type: string;
313
+ enum: string[];
314
+ default: string;
315
+ description?: undefined;
316
+ };
317
+ generateReport: {
318
+ type: string;
319
+ description: string;
320
+ default: boolean;
321
+ };
322
+ depth?: undefined;
323
+ dir?: undefined;
324
+ limit?: undefined;
325
+ severity?: undefined;
326
+ ip?: undefined;
327
+ duration?: undefined;
328
+ reason?: undefined;
329
+ output?: undefined;
330
+ path?: undefined;
331
+ };
332
+ required?: undefined;
333
+ };
334
+ })[];
335
+ /**
336
+ * Dispatch an incoming tool call to the appropriate handler.
337
+ * 將傳入的工具呼叫分派給適當的處理程序。
338
+ *
339
+ * @param name - Tool name / 工具名稱
340
+ * @param args - Tool arguments / 工具參數
341
+ */
342
+ export declare function dispatchTool(name: string, args: Record<string, unknown>): Promise<{
343
+ content: {
344
+ type: "text";
345
+ text: string;
346
+ }[];
347
+ }>;
348
+ /**
349
+ * Create and start the MCP server using stdio transport.
350
+ * 使用 stdio 傳輸建立並啟動 MCP 伺服器。
351
+ *
352
+ * This is the main entry point for the MCP server process.
353
+ * 這是 MCP 伺服器進程的主要入口點。
354
+ */
355
+ export declare function startMCPServer(): Promise<void>;
356
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyBH,qCAAqC;AACrC,eAAO,MAAM,oBAAoB,EAAE,MAAqB,CAAC;AAmPzD;;;GAGG;AACH,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEpC;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAoC7E;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBpD"}