indra-mcp 0.1.0 ā 0.1.3
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/build/index.js +62 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -28,6 +28,68 @@ const edgeUrl = process.env.INDRA_EDGE_URL || 'http://127.0.0.1:8787';
|
|
|
28
28
|
logDebug(`[EDGE] Targeting Edge Worker at: ${edgeUrl}`);
|
|
29
29
|
// Parse --config argument
|
|
30
30
|
const cliArgs = process.argv.slice(2);
|
|
31
|
+
// Check if running setup
|
|
32
|
+
if (cliArgs.includes('setup') || cliArgs.includes('init')) {
|
|
33
|
+
runSetup();
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
function runSetup() {
|
|
37
|
+
const homeDir = os.homedir();
|
|
38
|
+
const indraDir = path.join(homeDir, '.indra');
|
|
39
|
+
console.log('\n==================================================');
|
|
40
|
+
console.log(' Indra MCP Security Broker Setup');
|
|
41
|
+
console.log('==================================================\n');
|
|
42
|
+
// 1. Create directory if missing
|
|
43
|
+
if (!fs.existsSync(indraDir)) {
|
|
44
|
+
console.log(`Creating configuration directory at: ${indraDir}`);
|
|
45
|
+
fs.mkdirSync(indraDir, { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.log(`Configuration directory already exists at: ${indraDir}`);
|
|
49
|
+
}
|
|
50
|
+
// 2. Check for private key file
|
|
51
|
+
const privateKeyPath = path.join(indraDir, 'private.pem');
|
|
52
|
+
if (!fs.existsSync(privateKeyPath)) {
|
|
53
|
+
console.log('\nš [ACTION REQUIRED] Trust Anchor Private Key:');
|
|
54
|
+
console.log(` Please copy the private key downloaded from your Indra Control Plane`);
|
|
55
|
+
console.log(` and save it to: ${privateKeyPath}`);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.log('ā Found Trust Anchor private key at ~/.indra/private.pem');
|
|
59
|
+
}
|
|
60
|
+
// 3. Check/Create default mcp_config.json
|
|
61
|
+
const defaultMcpConfigPath = path.join(indraDir, 'mcp_config.json');
|
|
62
|
+
if (!fs.existsSync(defaultMcpConfigPath)) {
|
|
63
|
+
console.log(`\nš Creating default tools configuration file at: ${defaultMcpConfigPath}`);
|
|
64
|
+
const defaultJson = {
|
|
65
|
+
mcpServers: {
|
|
66
|
+
"mock-echo": {
|
|
67
|
+
"command": "node",
|
|
68
|
+
"args": [
|
|
69
|
+
path.join(indraDir, "mock-tool-server.js")
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
fs.writeFileSync(defaultMcpConfigPath, JSON.stringify(defaultJson, null, 2), 'utf8');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.log('ā Found existing tools configuration at ~/.indra/mcp_config.json');
|
|
78
|
+
}
|
|
79
|
+
console.log('\n==================================================');
|
|
80
|
+
console.log('š [HOW TO CONFIGURE YOUR AGENT CLIENT]');
|
|
81
|
+
console.log('==================================================');
|
|
82
|
+
console.log('To secure your AI agent client (Claude Desktop, Cursor, Cline, etc.),');
|
|
83
|
+
console.log('configure the client to execute the indra-mcp broker with these parameters:\n');
|
|
84
|
+
console.log(' Command:');
|
|
85
|
+
console.log(' indra-mcp');
|
|
86
|
+
console.log(' Arguments:');
|
|
87
|
+
console.log(` --config ${defaultMcpConfigPath}`);
|
|
88
|
+
console.log(' Environment Variables:');
|
|
89
|
+
console.log(' INDRA_EDGE_URL : <Your Edge Worker endpoint URL>');
|
|
90
|
+
console.log(' INDRA_AGENT_NAME : <Descriptive agent name, e.g. "Claude Desktop">');
|
|
91
|
+
console.log('==================================================\n');
|
|
92
|
+
}
|
|
31
93
|
let configPath = '';
|
|
32
94
|
for (let i = 0; i < cliArgs.length; i++) {
|
|
33
95
|
if (cliArgs[i] === '--config' && i + 1 < cliArgs.length) {
|