fullcourtdefense-cli 1.1.10 → 1.1.12
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 +40 -0
- package/dist/commands/mcpGateway.d.ts +11 -0
- package/dist/commands/mcpGateway.js +132 -25
- package/dist/index.js +60 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,9 @@ fullcourtdefense init
|
|
|
49
49
|
- `fullcourtdefense scan --local --type mcp ...` — launches a local stdio MCP server, calls tools, and sends tool responses to Shield.
|
|
50
50
|
- `fullcourtdefense scan --local --type rag ...` — scans local RAG files/directories or a live RAG HTTP service.
|
|
51
51
|
- `fullcourtdefense scan --local --type endpoint ...` — scans an internal HTTP/OpenAI-compatible endpoint.
|
|
52
|
+
- `fullcourtdefense install-cursor-mcp-gateway ...` — registers the protected MCP gateway in Cursor.
|
|
53
|
+
- `fullcourtdefense install-claude-code-mcp-gateway ...` — registers the protected MCP gateway in Claude Code.
|
|
54
|
+
- `fullcourtdefense install-claude-desktop-mcp-gateway ...` — registers the protected MCP gateway in Claude Desktop.
|
|
52
55
|
- `fullcourtdefense credits` — checks hosted scan credits for CI/CD API-key scans.
|
|
53
56
|
- `fullcourtdefense init` — creates a starter config file.
|
|
54
57
|
|
|
@@ -163,6 +166,9 @@ Local scans run from the customer machine or VPN and only send captured text out
|
|
|
163
166
|
| `--mcp-api-key-header <header>` | HTTP/SSE MCP API-key auth | API key header name. | `X-API-Key` |
|
|
164
167
|
| `--mcp-api-key <key>` | HTTP/SSE MCP API-key auth | API key value. | prompt |
|
|
165
168
|
| `--progress <mode>` | MCP | Console progress: `verbose`, `compact`, or `silent`. | `verbose` |
|
|
169
|
+
| `--server-name <name>` | MCP gateway installers | MCP server name to write into the client config. | `agentguard-gateway` |
|
|
170
|
+
| `--scope <scope>` | Claude Code gateway installer | Claude Code MCP scope: `local`, `project`, or `user`. | `local` |
|
|
171
|
+
| `--config-path <path>` | Claude Desktop gateway installer | Override path to `claude_desktop_config.json`. | OS default |
|
|
166
172
|
|
|
167
173
|
### RAG
|
|
168
174
|
|
|
@@ -294,6 +300,40 @@ Secured HTTP MCP:
|
|
|
294
300
|
fullcourtdefense scan --local --type mcp --mcp-url "https://mcp.internal.company.com/mcp" --mcp-auth-type bearer --mcp-token "mcp_token_..." --mcp-tool all --mode full --format report
|
|
295
301
|
```
|
|
296
302
|
|
|
303
|
+
### MCP Gateway Install Examples
|
|
304
|
+
|
|
305
|
+
Use the MCP gateway when you want Cursor, Claude Code, or Claude Desktop tool calls checked against AgentGuard runtime/action policies before they reach the real MCP server.
|
|
306
|
+
|
|
307
|
+
Cursor project install:
|
|
308
|
+
|
|
309
|
+
```powershell
|
|
310
|
+
fullcourtdefense install-cursor-mcp-gateway --project true --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Claude Code local install, private to you in the current project:
|
|
314
|
+
|
|
315
|
+
```powershell
|
|
316
|
+
fullcourtdefense install-claude-code-mcp-gateway --scope local --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Claude Code project install, shared through `.mcp.json`:
|
|
320
|
+
|
|
321
|
+
```powershell
|
|
322
|
+
fullcourtdefense install-claude-code-mcp-gateway --scope project --shield-id "sh_..." --mcp-command npm --mcp-args "run mcp"
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Claude Desktop install:
|
|
326
|
+
|
|
327
|
+
```powershell
|
|
328
|
+
fullcourtdefense install-claude-desktop-mcp-gateway --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Direct gateway run for debugging:
|
|
332
|
+
|
|
333
|
+
```powershell
|
|
334
|
+
fullcourtdefense mcp-gateway --agent-client claude-code --shield-id "sh_..." --mcp-command npm --mcp-args "run mcp"
|
|
335
|
+
```
|
|
336
|
+
|
|
297
337
|
### RAG Examples
|
|
298
338
|
|
|
299
339
|
Scan local documents before ingestion:
|
|
@@ -3,6 +3,7 @@ export interface McpGatewayArgs {
|
|
|
3
3
|
mcpCommand?: string;
|
|
4
4
|
mcpArgs?: string;
|
|
5
5
|
agentName?: string;
|
|
6
|
+
agentClient?: string;
|
|
6
7
|
developerName?: string;
|
|
7
8
|
shieldId?: string;
|
|
8
9
|
shieldKey?: string;
|
|
@@ -20,5 +21,15 @@ export interface InstallCursorMcpGatewayArgs extends McpGatewayArgs {
|
|
|
20
21
|
project?: string;
|
|
21
22
|
serverName?: string;
|
|
22
23
|
}
|
|
24
|
+
export interface InstallClaudeCodeMcpGatewayArgs extends McpGatewayArgs {
|
|
25
|
+
scope?: string;
|
|
26
|
+
serverName?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface InstallClaudeDesktopMcpGatewayArgs extends McpGatewayArgs {
|
|
29
|
+
configPath?: string;
|
|
30
|
+
serverName?: string;
|
|
31
|
+
}
|
|
23
32
|
export declare function mcpGatewayCommand(args: McpGatewayArgs, config: BotGuardConfig): Promise<void>;
|
|
24
33
|
export declare function installCursorMcpGatewayCommand(args: InstallCursorMcpGatewayArgs, config: BotGuardConfig): Promise<void>;
|
|
34
|
+
export declare function installClaudeCodeMcpGatewayCommand(args: InstallClaudeCodeMcpGatewayArgs, config: BotGuardConfig): Promise<void>;
|
|
35
|
+
export declare function installClaudeDesktopMcpGatewayCommand(args: InstallClaudeDesktopMcpGatewayArgs, config: BotGuardConfig): Promise<void>;
|
|
@@ -35,6 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.mcpGatewayCommand = mcpGatewayCommand;
|
|
37
37
|
exports.installCursorMcpGatewayCommand = installCursorMcpGatewayCommand;
|
|
38
|
+
exports.installClaudeCodeMcpGatewayCommand = installClaudeCodeMcpGatewayCommand;
|
|
39
|
+
exports.installClaudeDesktopMcpGatewayCommand = installClaudeDesktopMcpGatewayCommand;
|
|
38
40
|
const fs = __importStar(require("fs"));
|
|
39
41
|
const os = __importStar(require("os"));
|
|
40
42
|
const path = __importStar(require("path"));
|
|
@@ -73,19 +75,26 @@ function loadHomeShield() {
|
|
|
73
75
|
}
|
|
74
76
|
return {};
|
|
75
77
|
}
|
|
76
|
-
function
|
|
78
|
+
function normalizeAgentClient(value, fallback) {
|
|
79
|
+
if (value === 'cursor' || value === 'claude-code' || value === 'claude-desktop')
|
|
80
|
+
return value;
|
|
81
|
+
return fallback;
|
|
82
|
+
}
|
|
83
|
+
function resolveGatewayConfig(args, config, defaults = {}) {
|
|
77
84
|
const home = loadHomeShield();
|
|
78
85
|
const shieldId = args.shieldId || process.env.FCD_SHIELD_ID || process.env.FULLCOURTDEFENSE_SHIELD_ID || process.env.AGENTGUARD_SHIELD_ID || config.shieldId || home.shieldId;
|
|
79
86
|
if (!shieldId)
|
|
80
87
|
throw new Error('Missing Shield ID. Pass --shield-id or run fullcourtdefense configure.');
|
|
88
|
+
const agentClient = normalizeAgentClient(args.agentClient || process.env.FCD_AGENT_CLIENT, defaults.agentClient || 'cursor');
|
|
81
89
|
return {
|
|
82
90
|
shieldId,
|
|
83
91
|
shieldKey: args.shieldKey || process.env.FCD_SHIELD_KEY || process.env.FULLCOURTDEFENSE_SHIELD_KEY || process.env.AGENTGUARD_SHIELD_KEY || config.shieldKey || home.shieldKey,
|
|
84
92
|
apiUrl: (args.apiUrl || process.env.FCD_API_URL || process.env.FULLCOURTDEFENSE_API_URL || config.apiUrl || home.apiUrl || DEFAULT_API_URL).replace(/\/$/, ''),
|
|
85
|
-
agentName: args.agentName || process.env.FCD_AGENT_NAME || 'cursor-local-agent',
|
|
93
|
+
agentName: args.agentName || process.env.FCD_AGENT_NAME || defaults.agentName || 'cursor-local-agent',
|
|
94
|
+
agentClient,
|
|
86
95
|
developerName: args.developerName || process.env.FCD_DEVELOPER_NAME || process.env.USER_EMAIL || safeUserName(),
|
|
87
96
|
environment: args.environment || process.env.FCD_ENVIRONMENT || 'developer-workstation',
|
|
88
|
-
userObjective: args.userObjective || process.env.FCD_USER_OBJECTIVE || 'Developer requested this action from Cursor.',
|
|
97
|
+
userObjective: args.userObjective || process.env.FCD_USER_OBJECTIVE || defaults.userObjective || 'Developer requested this action from Cursor.',
|
|
89
98
|
authority: args.authority || process.env.FCD_AUTHORITY || 'developer',
|
|
90
99
|
approvalMode: args.approvalMode === 'block' ? 'block' : 'wait',
|
|
91
100
|
approvalTimeoutMs: Number(args.approvalTimeoutMs) > 0 ? Number(args.approvalTimeoutMs) : 300000,
|
|
@@ -94,7 +103,7 @@ function resolveGatewayConfig(args, config) {
|
|
|
94
103
|
failClosed: args.failClosed !== 'false',
|
|
95
104
|
};
|
|
96
105
|
}
|
|
97
|
-
function machineMetadata(developerName) {
|
|
106
|
+
function machineMetadata(developerName, agentClient = 'cursor') {
|
|
98
107
|
return {
|
|
99
108
|
developerName: developerName || safeUserName(),
|
|
100
109
|
machineName: os.hostname(),
|
|
@@ -103,7 +112,7 @@ function machineMetadata(developerName) {
|
|
|
103
112
|
ipAddress: firstPrivateIp(),
|
|
104
113
|
cwd: process.cwd(),
|
|
105
114
|
workspacePath: process.env.WORKSPACE_PATH || process.cwd(),
|
|
106
|
-
agentClient
|
|
115
|
+
agentClient,
|
|
107
116
|
gateway: 'agentguard-mcp-gateway',
|
|
108
117
|
};
|
|
109
118
|
}
|
|
@@ -125,8 +134,8 @@ function safeUserName() {
|
|
|
125
134
|
return 'unknown';
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
|
-
function summarizeToolArgs(args, developerName) {
|
|
129
|
-
const out = { ...machineMetadata(developerName) };
|
|
137
|
+
function summarizeToolArgs(args, developerName, agentClient = 'cursor') {
|
|
138
|
+
const out = { ...machineMetadata(developerName, agentClient) };
|
|
130
139
|
for (const [key, value] of Object.entries(args || {})) {
|
|
131
140
|
if (/token|secret|password|credential|key/i.test(key)) {
|
|
132
141
|
out[key] = '[redacted]';
|
|
@@ -286,9 +295,9 @@ class AgentGuardApi {
|
|
|
286
295
|
toolName: input.toolName,
|
|
287
296
|
operation: input.operation,
|
|
288
297
|
toolArgs: input.toolArgs,
|
|
289
|
-
argsSummary: summarizeToolArgs(input.toolArgs, this.config.developerName),
|
|
298
|
+
argsSummary: summarizeToolArgs(input.toolArgs, this.config.developerName, this.config.agentClient),
|
|
290
299
|
developerName: this.config.developerName,
|
|
291
|
-
...machineMetadata(this.config.developerName),
|
|
300
|
+
...machineMetadata(this.config.developerName, this.config.agentClient),
|
|
292
301
|
environment: this.config.environment,
|
|
293
302
|
userObjective: this.config.userObjective,
|
|
294
303
|
authority: this.config.authority,
|
|
@@ -306,7 +315,7 @@ class AgentGuardApi {
|
|
|
306
315
|
toolName: input.toolName,
|
|
307
316
|
operation: input.operation,
|
|
308
317
|
toolArgs: input.toolArgs,
|
|
309
|
-
argsSummary: summarizeToolArgs(input.toolArgs, this.config.developerName),
|
|
318
|
+
argsSummary: summarizeToolArgs(input.toolArgs, this.config.developerName, this.config.agentClient),
|
|
310
319
|
environment: this.config.environment,
|
|
311
320
|
userObjective: this.config.userObjective,
|
|
312
321
|
authority: this.config.authority,
|
|
@@ -546,25 +555,20 @@ function readJson(file) {
|
|
|
546
555
|
return { mcpServers: {} };
|
|
547
556
|
}
|
|
548
557
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
const nodeExe = process.execPath;
|
|
554
|
-
const scriptPath = path.resolve(process.argv[1] || path.join(__dirname, '..', 'index.js'));
|
|
555
|
-
const serverName = args.serverName || MANAGED_SERVER_NAME;
|
|
556
|
-
const downstreamCommand = args.mcpCommand || process.env.FCD_MCP_COMMAND;
|
|
557
|
-
if (!downstreamCommand)
|
|
558
|
-
throw new Error('Pass --mcp-command for the real MCP server you want to protect.');
|
|
558
|
+
function gatewayScriptPath() {
|
|
559
|
+
return path.resolve(process.argv[1] || path.join(__dirname, '..', 'index.js'));
|
|
560
|
+
}
|
|
561
|
+
function buildGatewayCommandArgs(gatewayConfig, downstreamCommand, downstreamArgs, options = {}) {
|
|
559
562
|
const commandArgs = [
|
|
560
|
-
|
|
563
|
+
gatewayScriptPath(),
|
|
561
564
|
'mcp-gateway',
|
|
562
565
|
'--mcp-command', downstreamCommand,
|
|
563
|
-
'--mcp-args', JSON.stringify(
|
|
566
|
+
'--mcp-args', JSON.stringify(downstreamArgs),
|
|
564
567
|
'--agent-name', gatewayConfig.agentName,
|
|
568
|
+
'--agent-client', gatewayConfig.agentClient,
|
|
565
569
|
'--developer-name', gatewayConfig.developerName,
|
|
566
570
|
'--shield-id', gatewayConfig.shieldId,
|
|
567
|
-
'--user-objective', gatewayConfig.userObjective || 'Developer requested this action
|
|
571
|
+
'--user-objective', gatewayConfig.userObjective || 'Developer requested this MCP action.',
|
|
568
572
|
'--authority', gatewayConfig.authority || 'developer',
|
|
569
573
|
'--approval-mode', gatewayConfig.approvalMode,
|
|
570
574
|
'--approval-timeout-ms', String(gatewayConfig.approvalTimeoutMs),
|
|
@@ -572,12 +576,15 @@ async function installCursorMcpGatewayCommand(args, config) {
|
|
|
572
576
|
'--scan-response', String(gatewayConfig.scanResponse),
|
|
573
577
|
'--fail-closed', String(gatewayConfig.failClosed),
|
|
574
578
|
];
|
|
575
|
-
if (gatewayConfig.shieldKey)
|
|
579
|
+
if (gatewayConfig.shieldKey && options.includeShieldKey !== false)
|
|
576
580
|
commandArgs.push('--shield-key', gatewayConfig.shieldKey);
|
|
577
581
|
if (gatewayConfig.apiUrl)
|
|
578
582
|
commandArgs.push('--api-url', gatewayConfig.apiUrl);
|
|
579
583
|
if (gatewayConfig.environment)
|
|
580
584
|
commandArgs.push('--environment', gatewayConfig.environment);
|
|
585
|
+
return commandArgs;
|
|
586
|
+
}
|
|
587
|
+
function writeMcpServerConfig(file, serverName, nodeExe, commandArgs) {
|
|
581
588
|
const json = readJson(file);
|
|
582
589
|
json.mcpServers[serverName] = {
|
|
583
590
|
command: nodeExe,
|
|
@@ -585,9 +592,109 @@ async function installCursorMcpGatewayCommand(args, config) {
|
|
|
585
592
|
};
|
|
586
593
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
587
594
|
fs.writeFileSync(file, `${JSON.stringify(json, null, 2)}\n`, 'utf8');
|
|
595
|
+
}
|
|
596
|
+
function claudeDesktopMcpPath() {
|
|
597
|
+
const home = os.homedir();
|
|
598
|
+
if (process.platform === 'win32') {
|
|
599
|
+
const appData = process.env.APPDATA || path.join(home, 'AppData', 'Roaming');
|
|
600
|
+
return path.join(appData, 'Claude', 'claude_desktop_config.json');
|
|
601
|
+
}
|
|
602
|
+
if (process.platform === 'darwin') {
|
|
603
|
+
return path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
604
|
+
}
|
|
605
|
+
const xdg = process.env.XDG_CONFIG_HOME || path.join(home, '.config');
|
|
606
|
+
return path.join(xdg, 'Claude', 'claude_desktop_config.json');
|
|
607
|
+
}
|
|
608
|
+
function normalizeClaudeCodeScope(scope) {
|
|
609
|
+
if (scope === 'project' || scope === 'user' || scope === 'local')
|
|
610
|
+
return scope;
|
|
611
|
+
return 'local';
|
|
612
|
+
}
|
|
613
|
+
async function installCursorMcpGatewayCommand(args, config) {
|
|
614
|
+
const gatewayConfig = resolveGatewayConfig(args, config, {
|
|
615
|
+
agentClient: 'cursor',
|
|
616
|
+
agentName: 'cursor-local-agent',
|
|
617
|
+
userObjective: 'Developer requested this action from Cursor.',
|
|
618
|
+
});
|
|
619
|
+
const projectScope = args.project === 'true';
|
|
620
|
+
const file = cursorMcpPath(projectScope);
|
|
621
|
+
const nodeExe = process.execPath;
|
|
622
|
+
const serverName = args.serverName || MANAGED_SERVER_NAME;
|
|
623
|
+
const downstreamCommand = args.mcpCommand || process.env.FCD_MCP_COMMAND;
|
|
624
|
+
if (!downstreamCommand)
|
|
625
|
+
throw new Error('Pass --mcp-command for the real MCP server you want to protect.');
|
|
626
|
+
const downstreamArgs = parseArgsList(args.mcpArgs || process.env.FCD_MCP_ARGS);
|
|
627
|
+
const commandArgs = buildGatewayCommandArgs(gatewayConfig, downstreamCommand, downstreamArgs);
|
|
628
|
+
writeMcpServerConfig(file, serverName, nodeExe, commandArgs);
|
|
588
629
|
console.log(`AgentGuard MCP Gateway installed for Cursor (${projectScope ? 'project' : 'global'}).`);
|
|
589
630
|
console.log(`Config: ${file}`);
|
|
590
631
|
console.log(`Server: ${serverName}`);
|
|
591
|
-
console.log(`Downstream: ${downstreamCommand} ${
|
|
632
|
+
console.log(`Downstream: ${downstreamCommand} ${downstreamArgs.join(' ')}`);
|
|
592
633
|
console.log('Restart Cursor or reload MCP servers to use the protected tools.');
|
|
593
634
|
}
|
|
635
|
+
async function installClaudeCodeMcpGatewayCommand(args, config) {
|
|
636
|
+
const gatewayConfig = resolveGatewayConfig(args, config, {
|
|
637
|
+
agentClient: 'claude-code',
|
|
638
|
+
agentName: 'claude-code-local-agent',
|
|
639
|
+
userObjective: 'Developer requested this action from Claude Code.',
|
|
640
|
+
});
|
|
641
|
+
const scope = normalizeClaudeCodeScope(args.scope);
|
|
642
|
+
const nodeExe = process.execPath;
|
|
643
|
+
const serverName = args.serverName || MANAGED_SERVER_NAME;
|
|
644
|
+
const downstreamCommand = args.mcpCommand || process.env.FCD_MCP_COMMAND;
|
|
645
|
+
if (!downstreamCommand)
|
|
646
|
+
throw new Error('Pass --mcp-command for the real MCP server you want to protect.');
|
|
647
|
+
const downstreamArgs = parseArgsList(args.mcpArgs || process.env.FCD_MCP_ARGS);
|
|
648
|
+
const includeShieldKey = scope !== 'project' || Boolean(args.shieldKey);
|
|
649
|
+
const commandArgs = buildGatewayCommandArgs(gatewayConfig, downstreamCommand, downstreamArgs, { includeShieldKey });
|
|
650
|
+
const claudeArgs = ['mcp', 'add', '--scope', scope, '--transport', 'stdio', serverName, '--', nodeExe, ...commandArgs];
|
|
651
|
+
const result = (0, child_process_1.spawnSync)('claude', claudeArgs, {
|
|
652
|
+
stdio: 'inherit',
|
|
653
|
+
shell: process.platform === 'win32',
|
|
654
|
+
});
|
|
655
|
+
if (result.status === 0) {
|
|
656
|
+
console.log(`AgentGuard MCP Gateway installed for Claude Code (${scope}).`);
|
|
657
|
+
console.log(`Server: ${serverName}`);
|
|
658
|
+
console.log(`Downstream: ${downstreamCommand} ${downstreamArgs.join(' ')}`);
|
|
659
|
+
if (!includeShieldKey && gatewayConfig.shieldKey) {
|
|
660
|
+
console.log('Note: Shield key was loaded from local config/env and omitted from project .mcp.json. Runtime will use the developer machine config/env.');
|
|
661
|
+
}
|
|
662
|
+
console.log('Run "claude mcp list" or restart Claude Code to verify the protected tools.');
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (scope === 'project') {
|
|
666
|
+
const file = path.join(process.cwd(), '.mcp.json');
|
|
667
|
+
writeMcpServerConfig(file, serverName, nodeExe, commandArgs);
|
|
668
|
+
console.log('Claude Code CLI was not available, so project config was written directly.');
|
|
669
|
+
console.log(`Config: ${file}`);
|
|
670
|
+
console.log(`Server: ${serverName}`);
|
|
671
|
+
console.log(`Downstream: ${downstreamCommand} ${downstreamArgs.join(' ')}`);
|
|
672
|
+
if (!includeShieldKey && gatewayConfig.shieldKey) {
|
|
673
|
+
console.log('Note: Shield key was loaded from local config/env and omitted from project .mcp.json. Runtime will use the developer machine config/env.');
|
|
674
|
+
}
|
|
675
|
+
console.log('Restart Claude Code and approve the project MCP server when prompted.');
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
throw new Error('Claude Code CLI was not available. Install Claude Code or rerun with --scope project to write .mcp.json directly.');
|
|
679
|
+
}
|
|
680
|
+
async function installClaudeDesktopMcpGatewayCommand(args, config) {
|
|
681
|
+
const gatewayConfig = resolveGatewayConfig(args, config, {
|
|
682
|
+
agentClient: 'claude-desktop',
|
|
683
|
+
agentName: 'claude-desktop-local-agent',
|
|
684
|
+
userObjective: 'Developer requested this action from Claude Desktop.',
|
|
685
|
+
});
|
|
686
|
+
const file = args.configPath ? path.resolve(args.configPath) : claudeDesktopMcpPath();
|
|
687
|
+
const nodeExe = process.execPath;
|
|
688
|
+
const serverName = args.serverName || MANAGED_SERVER_NAME;
|
|
689
|
+
const downstreamCommand = args.mcpCommand || process.env.FCD_MCP_COMMAND;
|
|
690
|
+
if (!downstreamCommand)
|
|
691
|
+
throw new Error('Pass --mcp-command for the real MCP server you want to protect.');
|
|
692
|
+
const downstreamArgs = parseArgsList(args.mcpArgs || process.env.FCD_MCP_ARGS);
|
|
693
|
+
const commandArgs = buildGatewayCommandArgs(gatewayConfig, downstreamCommand, downstreamArgs);
|
|
694
|
+
writeMcpServerConfig(file, serverName, nodeExe, commandArgs);
|
|
695
|
+
console.log('AgentGuard MCP Gateway installed for Claude Desktop.');
|
|
696
|
+
console.log(`Config: ${file}`);
|
|
697
|
+
console.log(`Server: ${serverName}`);
|
|
698
|
+
console.log(`Downstream: ${downstreamCommand} ${downstreamArgs.join(' ')}`);
|
|
699
|
+
console.log('Restart Claude Desktop to load the protected tools.');
|
|
700
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const discover_1 = require("./commands/discover");
|
|
|
11
11
|
const hook_1 = require("./commands/hook");
|
|
12
12
|
const installCursorHook_1 = require("./commands/installCursorHook");
|
|
13
13
|
const mcpGateway_1 = require("./commands/mcpGateway");
|
|
14
|
-
const VERSION = '1.1.
|
|
14
|
+
const VERSION = '1.1.12';
|
|
15
15
|
function parseArgs(argv) {
|
|
16
16
|
const flags = {};
|
|
17
17
|
let command = '';
|
|
@@ -78,6 +78,10 @@ function printHelp() {
|
|
|
78
78
|
policies before forwarding tool calls to a real MCP server.
|
|
79
79
|
install-cursor-mcp-gateway
|
|
80
80
|
Adds the AgentGuard MCP Gateway to Cursor's mcp.json.
|
|
81
|
+
install-claude-code-mcp-gateway
|
|
82
|
+
Adds the AgentGuard MCP Gateway to Claude Code using claude mcp add.
|
|
83
|
+
install-claude-desktop-mcp-gateway
|
|
84
|
+
Adds the AgentGuard MCP Gateway to Claude Desktop config.
|
|
81
85
|
hook Internal: invoked by Cursor per agent event (reads stdin JSON,
|
|
82
86
|
returns an allow/deny verdict). Not run by hand.
|
|
83
87
|
credits Shows hosted scan credits for CI/CD API-key scans.
|
|
@@ -143,6 +147,9 @@ function printHelp() {
|
|
|
143
147
|
--mcp-command <cmd> MCP server command, for example node or npx.cmd
|
|
144
148
|
--mcp-args <args> MCP server args/path, for example ./server.js
|
|
145
149
|
--mcp-tool <tool> MCP tool to test, or all
|
|
150
|
+
--server-name <name> MCP gateway server name for client installers
|
|
151
|
+
--scope <scope> Claude Code MCP scope: local, project, or user
|
|
152
|
+
--config-path <path> Claude Desktop config override path
|
|
146
153
|
--mcp-auth-type <type> HTTP MCP auth: none, bearer, basic, api-key
|
|
147
154
|
--mcp-token <token> HTTP MCP bearer token
|
|
148
155
|
--mcp-username <user> HTTP MCP basic username
|
|
@@ -190,6 +197,9 @@ function printHelp() {
|
|
|
190
197
|
$ fullcourtdefense install-cursor-hook --project true # this repo only
|
|
191
198
|
$ fullcourtdefense uninstall-cursor-hook
|
|
192
199
|
$ fullcourtdefense install-cursor-mcp-gateway --project true --shield-id <id> --shield-key <key> --mcp-command npm --mcp-args "run mcp"
|
|
200
|
+
$ fullcourtdefense install-claude-code-mcp-gateway --scope local --shield-id <id> --shield-key <key> --mcp-command npm --mcp-args "run mcp"
|
|
201
|
+
$ fullcourtdefense install-claude-code-mcp-gateway --scope project --shield-id <id> --mcp-command npm --mcp-args "run mcp"
|
|
202
|
+
$ fullcourtdefense install-claude-desktop-mcp-gateway --shield-id <id> --shield-key <key> --mcp-command npm --mcp-args "run mcp"
|
|
193
203
|
$ fullcourtdefense mcp-gateway --shield-id <id> --mcp-command npm --mcp-args "run mcp"
|
|
194
204
|
$ fullcourtdefense configure
|
|
195
205
|
$ fullcourtdefense doctor
|
|
@@ -339,6 +349,8 @@ async function main() {
|
|
|
339
349
|
mcpCommand: flags['mcp-command'],
|
|
340
350
|
mcpArgs: flags['mcp-args'],
|
|
341
351
|
agentName: flags['agent-name'],
|
|
352
|
+
agentClient: flags['agent-client'],
|
|
353
|
+
developerName: flags['developer-name'],
|
|
342
354
|
shieldId: flags['shield-id'],
|
|
343
355
|
shieldKey: flags['shield-key'],
|
|
344
356
|
apiUrl: flags['api-url'],
|
|
@@ -361,6 +373,7 @@ async function main() {
|
|
|
361
373
|
mcpCommand: flags['mcp-command'],
|
|
362
374
|
mcpArgs: flags['mcp-args'],
|
|
363
375
|
agentName: flags['agent-name'],
|
|
376
|
+
developerName: flags['developer-name'],
|
|
364
377
|
shieldId: flags['shield-id'],
|
|
365
378
|
shieldKey: flags['shield-key'],
|
|
366
379
|
apiUrl: flags['api-url'],
|
|
@@ -376,6 +389,52 @@ async function main() {
|
|
|
376
389
|
await (0, mcpGateway_1.installCursorMcpGatewayCommand)(args, config);
|
|
377
390
|
break;
|
|
378
391
|
}
|
|
392
|
+
case 'install-claude-code-mcp-gateway': {
|
|
393
|
+
const args = {
|
|
394
|
+
scope: flags.scope,
|
|
395
|
+
serverName: flags['server-name'],
|
|
396
|
+
mcpCommand: flags['mcp-command'],
|
|
397
|
+
mcpArgs: flags['mcp-args'],
|
|
398
|
+
agentName: flags['agent-name'],
|
|
399
|
+
developerName: flags['developer-name'],
|
|
400
|
+
shieldId: flags['shield-id'],
|
|
401
|
+
shieldKey: flags['shield-key'],
|
|
402
|
+
apiUrl: flags['api-url'],
|
|
403
|
+
environment: flags.environment,
|
|
404
|
+
userObjective: flags['user-objective'],
|
|
405
|
+
authority: flags.authority,
|
|
406
|
+
approvalMode: flags['approval-mode'],
|
|
407
|
+
approvalTimeoutMs: flags['approval-timeout-ms'],
|
|
408
|
+
approvalPollMs: flags['approval-poll-ms'],
|
|
409
|
+
scanResponse: flags['scan-response'],
|
|
410
|
+
failClosed: flags['fail-closed'],
|
|
411
|
+
};
|
|
412
|
+
await (0, mcpGateway_1.installClaudeCodeMcpGatewayCommand)(args, config);
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
case 'install-claude-desktop-mcp-gateway': {
|
|
416
|
+
const args = {
|
|
417
|
+
configPath: flags['config-path'],
|
|
418
|
+
serverName: flags['server-name'],
|
|
419
|
+
mcpCommand: flags['mcp-command'],
|
|
420
|
+
mcpArgs: flags['mcp-args'],
|
|
421
|
+
agentName: flags['agent-name'],
|
|
422
|
+
developerName: flags['developer-name'],
|
|
423
|
+
shieldId: flags['shield-id'],
|
|
424
|
+
shieldKey: flags['shield-key'],
|
|
425
|
+
apiUrl: flags['api-url'],
|
|
426
|
+
environment: flags.environment,
|
|
427
|
+
userObjective: flags['user-objective'],
|
|
428
|
+
authority: flags.authority,
|
|
429
|
+
approvalMode: flags['approval-mode'],
|
|
430
|
+
approvalTimeoutMs: flags['approval-timeout-ms'],
|
|
431
|
+
approvalPollMs: flags['approval-poll-ms'],
|
|
432
|
+
scanResponse: flags['scan-response'],
|
|
433
|
+
failClosed: flags['fail-closed'],
|
|
434
|
+
};
|
|
435
|
+
await (0, mcpGateway_1.installClaudeDesktopMcpGatewayCommand)(args, config);
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
379
438
|
case 'init': {
|
|
380
439
|
await (0, init_1.initCommand)();
|
|
381
440
|
break;
|