troxy-cli 1.3.4 → 1.3.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {
package/src/init.js CHANGED
@@ -15,6 +15,7 @@ function prompt(question) {
15
15
  const MCP_CLIENTS = [
16
16
  {
17
17
  name: 'Claude Desktop',
18
+ type: 'standard',
18
19
  path: {
19
20
  darwin: path.join(os.homedir(), 'Library/Application Support/Claude/claude_desktop_config.json'),
20
21
  win32: path.join(process.env.APPDATA || os.homedir(), 'Claude/claude_desktop_config.json'),
@@ -23,6 +24,7 @@ const MCP_CLIENTS = [
23
24
  },
24
25
  {
25
26
  name: 'Cursor',
27
+ type: 'standard',
26
28
  path: {
27
29
  darwin: path.join(os.homedir(), '.cursor/mcp.json'),
28
30
  win32: path.join(os.homedir(), '.cursor/mcp.json'),
@@ -31,12 +33,31 @@ const MCP_CLIENTS = [
31
33
  },
32
34
  {
33
35
  name: 'Windsurf',
36
+ type: 'standard',
34
37
  path: {
35
38
  darwin: path.join(os.homedir(), '.codeium/windsurf/mcp_config.json'),
36
39
  win32: path.join(os.homedir(), '.codeium/windsurf/mcp_config.json'),
37
40
  linux: path.join(os.homedir(), '.codeium/windsurf/mcp_config.json'),
38
41
  },
39
42
  },
43
+ {
44
+ name: 'Zed',
45
+ type: 'zed',
46
+ path: {
47
+ darwin: path.join(os.homedir(), 'Library/Application Support/Zed/settings.json'),
48
+ win32: path.join(process.env.APPDATA || os.homedir(), 'Zed/settings.json'),
49
+ linux: path.join(os.homedir(), '.config/zed/settings.json'),
50
+ },
51
+ },
52
+ {
53
+ name: 'Continue',
54
+ type: 'continue',
55
+ path: {
56
+ darwin: path.join(os.homedir(), '.continue/config.json'),
57
+ win32: path.join(os.homedir(), '.continue/config.json'),
58
+ linux: path.join(os.homedir(), '.continue/config.json'),
59
+ },
60
+ },
40
61
  ];
41
62
 
42
63
  export async function runInit({ key } = {}) {
@@ -106,7 +127,9 @@ export async function runInit({ key } = {}) {
106
127
  for (const client of detected) {
107
128
  const configPath = client.path[platform] ?? client.path.linux;
108
129
  try {
109
- patchMcpConfig(configPath, key);
130
+ if (client.type === 'zed') patchZedConfig(configPath, key);
131
+ else if (client.type === 'continue') patchContinueConfig(configPath, key);
132
+ else patchMcpConfig(configPath, key);
110
133
  console.log(` • ${client.name} ✓`);
111
134
  } catch (err) {
112
135
  console.log(` • ${client.name} ✗ (${err.message})`);
@@ -221,14 +244,36 @@ function mcpEntry(apiKey) {
221
244
 
222
245
  function patchMcpConfig(configPath, apiKey) {
223
246
  let config = {};
224
- try {
225
- config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
226
- } catch {
227
- // file exists but is empty or malformed — start fresh
228
- }
229
-
247
+ try { config = JSON.parse(fs.readFileSync(configPath, 'utf8')); } catch {}
230
248
  if (!config.mcpServers) config.mcpServers = {};
231
249
  config.mcpServers.troxy = mcpEntry(apiKey).troxy;
250
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
251
+ }
252
+
253
+ function patchZedConfig(configPath, apiKey) {
254
+ let config = {};
255
+ try { config = JSON.parse(fs.readFileSync(configPath, 'utf8')); } catch {}
256
+ if (!config.context_servers) config.context_servers = {};
257
+ config.context_servers.troxy = {
258
+ source: 'custom',
259
+ command: 'npx',
260
+ args: ['troxy-cli', 'mcp'],
261
+ env: { TROXY_API_KEY: apiKey },
262
+ };
263
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
264
+ }
232
265
 
266
+ function patchContinueConfig(configPath, apiKey) {
267
+ let config = {};
268
+ try { config = JSON.parse(fs.readFileSync(configPath, 'utf8')); } catch {}
269
+ if (!config.modelContextProtocolServers) config.modelContextProtocolServers = [];
270
+ // Remove existing troxy entry if present, then add fresh
271
+ config.modelContextProtocolServers = config.modelContextProtocolServers.filter(
272
+ s => !(s.transport?.command === 'npx' && s.transport?.args?.includes('troxy-cli')),
273
+ );
274
+ config.modelContextProtocolServers.push({
275
+ transport: { type: 'stdio', command: 'npx', args: ['troxy-cli', 'mcp'] },
276
+ env: { TROXY_API_KEY: apiKey },
277
+ });
233
278
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
234
279
  }
package/src/mcp-server.js CHANGED
@@ -43,12 +43,8 @@ export async function runMcp() {
43
43
  'based on your Troxy policies. Call this before initiating any payment.',
44
44
  inputSchema: {
45
45
  type: 'object',
46
- required: ['card_alias', 'merchant_name', 'amount'],
46
+ required: ['merchant_name', 'amount'],
47
47
  properties: {
48
- card_alias: {
49
- type: 'string',
50
- description: 'Card alias to charge (e.g. "Personal", "Business")',
51
- },
52
48
  merchant_name: {
53
49
  type: 'string',
54
50
  description: 'Name of the merchant or service',