Repository navigation
Expand file tree
/
Copy pathcursor-mcp-config.js
More file actions
50 lines (44 loc) · 1.68 KB
/
Copy pathcursor-mcp-config.js
File metadata and controls
50 lines (44 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env node
/**
* Single Cursor MCP entry for all combined dummy vulnerabilities (all-vulnerabilities-server.js).
*
* Usage:
* node scripts/cursor-mcp-config.js # print JSON to stdout (merge into ~/.cursor/mcp.json)
* node scripts/cursor-mcp-config.js --write # write ./.cursor/mcp.json (absolute path to this repo)
*/
import { mkdirSync, writeFileSync, existsSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(__dirname, '..');
const serverEntry = path.join(repoRoot, 'servers', 'all-vulnerabilities-server.js');
const SERVER_KEY = 'mcp-shark-dummy-all-vulnerabilities';
const config = {
mcpServers: {
[SERVER_KEY]: {
command: 'node',
args: [serverEntry],
},
},
};
const json = `${JSON.stringify(config, null, 2)}\n`;
const write = process.argv.includes('--write');
if (write) {
const outDir = path.join(repoRoot, '.cursor');
const outFile = path.join(outDir, 'mcp.json');
if (existsSync(outFile) && !process.argv.includes('--force')) {
console.error(`Refusing to overwrite ${outFile} (pass --force to replace).`);
process.exit(1);
}
mkdirSync(outDir, { recursive: true });
writeFileSync(outFile, json, 'utf8');
console.error(`Wrote ${outFile}`);
console.error(
'Restart Cursor or reload MCP. Scan with: npx mcp-shark scan --ide Cursor (or open this repo and use Project scan for .cursor/mcp.json).'
);
} else {
process.stdout.write(json);
console.error(
'\nMerge the `mcpServers` entry above into ~/.cursor/mcp.json (or run with --write to create .cursor/mcp.json in this repo).'
);
}