troxy-cli 1.3.2 → 1.3.4
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/init.js +18 -2
- package/src/mcp-server.js +11 -1
package/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -89,8 +89,15 @@ export async function runInit({ key } = {}) {
|
|
|
89
89
|
return fs.existsSync(p);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// Detect OpenClaw via CLI
|
|
93
|
+
let hasOpenClaw = false;
|
|
94
|
+
try {
|
|
95
|
+
execSync('openclaw --version', { stdio: 'ignore' });
|
|
96
|
+
hasOpenClaw = true;
|
|
97
|
+
} catch {}
|
|
98
|
+
|
|
99
|
+
if (detected.length === 0 && !hasOpenClaw) {
|
|
100
|
+
console.log('\n No MCP clients detected (Claude Desktop, Cursor, Windsurf, OpenClaw).');
|
|
94
101
|
console.log(' Troxy MCP server config:\n');
|
|
95
102
|
console.log(JSON.stringify(mcpEntry(key), null, 4));
|
|
96
103
|
console.log('\n Add the above to your MCP client\'s config under "mcpServers".\n');
|
|
@@ -105,6 +112,15 @@ export async function runInit({ key } = {}) {
|
|
|
105
112
|
console.log(` • ${client.name} ✗ (${err.message})`);
|
|
106
113
|
}
|
|
107
114
|
}
|
|
115
|
+
if (hasOpenClaw) {
|
|
116
|
+
try {
|
|
117
|
+
const entry = JSON.stringify({ command: 'npx', args: ['troxy-cli', 'mcp'], env: { TROXY_API_KEY: key } });
|
|
118
|
+
execSync(`openclaw mcp set troxy '${entry}'`, { stdio: 'ignore' });
|
|
119
|
+
console.log(` • OpenClaw ✓`);
|
|
120
|
+
} catch (err) {
|
|
121
|
+
console.log(` • OpenClaw ✗ (${err.message})`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
108
124
|
console.log('\n Restart your MCP client to activate Troxy.');
|
|
109
125
|
}
|
|
110
126
|
|
package/src/mcp-server.js
CHANGED
|
@@ -20,7 +20,17 @@ export async function runMcp() {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const server = new Server(
|
|
23
|
-
{
|
|
23
|
+
{
|
|
24
|
+
name: 'troxy',
|
|
25
|
+
version: '0.1.0',
|
|
26
|
+
instructions:
|
|
27
|
+
'You are connected to Troxy, a payment control system. ' +
|
|
28
|
+
'You MUST call the evaluate_payment tool before completing any purchase, payment, or financial transaction. ' +
|
|
29
|
+
'Never submit a payment form, confirm a checkout, or transfer funds without first receiving an ALLOW decision from evaluate_payment. ' +
|
|
30
|
+
'If the decision is BLOCK, abort the transaction and inform the user. ' +
|
|
31
|
+
'If the decision is ESCALATE, wait for human approval before proceeding. ' +
|
|
32
|
+
'If the decision is NOTIFY, proceed but the user will be notified.',
|
|
33
|
+
},
|
|
24
34
|
{ capabilities: { tools: {} } },
|
|
25
35
|
);
|
|
26
36
|
|