agent-security-scanner-mcp 3.10.0 → 3.10.2
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/package.json +1 -1
- package/src/cli/doctor.js +13 -0
- package/src/cli/init.js +56 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-security-scanner-mcp",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"mcpName": "io.github.sinewaveai/agent-security-scanner-mcp",
|
|
5
5
|
"description": "Security scanner MCP server for AI coding agents. Prompt injection firewall, package hallucination detection (4.3M+ packages), 1000+ vulnerability rules with AST & taint analysis, auto-fix. For Claude Code, Cursor, Windsurf, Cline, OpenClaw.",
|
|
6
6
|
"main": "index.js",
|
package/src/cli/doctor.js
CHANGED
|
@@ -3,6 +3,7 @@ import { readFileSync, existsSync, writeFileSync, copyFileSync, mkdirSync } from
|
|
|
3
3
|
import { dirname, join } from "path";
|
|
4
4
|
import { homedir, platform } from "os";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
|
+
import { getDaemonClient } from '../daemon-client.js';
|
|
6
7
|
|
|
7
8
|
// Handle both ESM and CJS bundling (Smithery bundles to CJS)
|
|
8
9
|
let __dirname;
|
|
@@ -158,6 +159,18 @@ export async function runDoctor(args) {
|
|
|
158
159
|
console.log(` \u26a0 daemon.py not found (daemon mode unavailable, sync fallback will be used)`);
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
// 3c. Daemon live health check
|
|
163
|
+
if (existsSync(daemonPath) && pythonCmd) {
|
|
164
|
+
try {
|
|
165
|
+
const client = getDaemonClient();
|
|
166
|
+
const health = await client.health();
|
|
167
|
+
console.log(` \u2713 Daemon responding (pid=${health.pid}, cache=${health.cache_size}, uptime=${health.uptime.toFixed(1)}s)`);
|
|
168
|
+
await client.shutdown();
|
|
169
|
+
} catch (e) {
|
|
170
|
+
console.log(` \u26a0 Daemon health check failed: ${e.message}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
161
174
|
// 4. Python can import yaml (analyzer dependency check)
|
|
162
175
|
if (pythonCmd && existsSync(analyzerPath)) {
|
|
163
176
|
const yamlCheck = checkCommand(pythonCmd, ['-c', 'import yaml; print("ok")']);
|
package/src/cli/init.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFileSync, existsSync, writeFileSync, copyFileSync, mkdirSync } from "fs";
|
|
2
|
+
import { spawnSync } from "child_process";
|
|
2
3
|
import { dirname, join } from "path";
|
|
3
4
|
import { homedir, platform } from "os";
|
|
4
5
|
import { createInterface } from "readline";
|
|
@@ -79,6 +80,10 @@ const CLIENT_CONFIGS = {
|
|
|
79
80
|
isSkillBased: true, // OpenClaw uses skills, not MCP config
|
|
80
81
|
skillPath: () => join(homedir(), '.openclaw', 'workspace', 'skills', 'security-scanner'),
|
|
81
82
|
configPath: () => join(homedir(), '.openclaw', 'workspace', 'skills', 'security-scanner', 'SKILL.md')
|
|
83
|
+
},
|
|
84
|
+
'codex': {
|
|
85
|
+
name: 'Codex',
|
|
86
|
+
isCLIBased: true // Codex uses 'codex mcp add' CLI, not a JSON config
|
|
82
87
|
}
|
|
83
88
|
};
|
|
84
89
|
|
|
@@ -237,6 +242,51 @@ async function installOpenClawSkill(client, flags) {
|
|
|
237
242
|
console.log(` - Or ask: "scan this prompt for security issues"\n`);
|
|
238
243
|
}
|
|
239
244
|
|
|
245
|
+
// Installer for Codex (CLI-based, uses 'codex mcp add')
|
|
246
|
+
async function installCodexMCP(flags, serverName) {
|
|
247
|
+
console.log(`\n Client: Codex`);
|
|
248
|
+
console.log(` Config: ~/.codex/config.toml (managed by codex CLI)`);
|
|
249
|
+
console.log(` OS: ${platform()} (${process.arch})\n`);
|
|
250
|
+
|
|
251
|
+
// Check codex CLI is available
|
|
252
|
+
const which = spawnSync('which', ['codex'], { encoding: 'utf-8' });
|
|
253
|
+
if (which.status !== 0) {
|
|
254
|
+
console.error(` ERROR: 'codex' CLI not found in PATH.`);
|
|
255
|
+
console.error(` Install it first: https://github.com/openai/codex\n`);
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (flags.dryRun) {
|
|
260
|
+
console.log(` [dry-run] Would run:`);
|
|
261
|
+
console.log(` codex mcp add ${serverName} -- npx -y agent-security-scanner-mcp`);
|
|
262
|
+
console.log(` No changes made.\n`);
|
|
263
|
+
process.exit(0);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
console.log(` Running: codex mcp add ${serverName} -- npx -y agent-security-scanner-mcp\n`);
|
|
267
|
+
|
|
268
|
+
const result = spawnSync(
|
|
269
|
+
'codex',
|
|
270
|
+
['mcp', 'add', serverName, '--', 'npx', '-y', 'agent-security-scanner-mcp'],
|
|
271
|
+
{ encoding: 'utf-8', stdio: 'inherit' }
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
if (result.status !== 0) {
|
|
275
|
+
console.error(`\n ERROR: 'codex mcp add' failed (exit ${result.status}).`);
|
|
276
|
+
console.error(` You can add it manually to ~/.codex/config.toml:\n`);
|
|
277
|
+
console.error(` [mcp_servers.${serverName}]`);
|
|
278
|
+
console.error(` command = "npx"`);
|
|
279
|
+
console.error(` args = ["-y", "agent-security-scanner-mcp"]\n`);
|
|
280
|
+
process.exit(1);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
console.log(`\n Codex MCP server '${serverName}' registered successfully!`);
|
|
284
|
+
console.log(`\n Next steps:`);
|
|
285
|
+
console.log(` 1. Start a Codex session`);
|
|
286
|
+
console.log(` 2. Run /mcp to verify 'agentic-security' is listed`);
|
|
287
|
+
console.log(` 3. Quick test: ask Codex to run scan_security on any code file\n`);
|
|
288
|
+
}
|
|
289
|
+
|
|
240
290
|
export async function runInit(args) {
|
|
241
291
|
const flags = parseInitFlags(args);
|
|
242
292
|
let clientName = flags.client;
|
|
@@ -264,6 +314,12 @@ export async function runInit(args) {
|
|
|
264
314
|
return;
|
|
265
315
|
}
|
|
266
316
|
|
|
317
|
+
// Special handling for Codex (CLI-based, uses 'codex mcp add')
|
|
318
|
+
if (client.isCLIBased) {
|
|
319
|
+
await installCodexMCP(flags, flags.name);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
267
323
|
const configPath = flags.path || client.configPath();
|
|
268
324
|
const serverName = flags.name;
|
|
269
325
|
const entry = client.buildEntry();
|