@troxy/cli 0.1.5 → 0.1.7

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": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {
package/src/api.js CHANGED
@@ -47,6 +47,9 @@ export const api = {
47
47
 
48
48
  // Evaluate (agent API key)
49
49
  evaluate: (body, apiKey) => request('POST', '/evaluate', { apiKey, body }),
50
+
51
+ // MCP heartbeat (agent API key)
52
+ mcpHeartbeat: (apiKey) => request('POST', '/mcp/heartbeat', { apiKey }),
50
53
  };
51
54
 
52
55
  // Named export for backwards compat with init.js + mcp-server.js
package/src/auth.js CHANGED
@@ -58,7 +58,7 @@ export async function runLogin({ email } = {}) {
58
58
  process.stdout.write(' Verifying... ');
59
59
  try {
60
60
  const result = await api.verify(token);
61
- saveSession({ jwt: result.token, email });
61
+ saveSession({ jwt: result.access_token, email });
62
62
  console.log('✓');
63
63
  console.log(`\n Logged in as ${email}\n`);
64
64
  } catch (err) {
package/src/mcp-server.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  ListToolsRequestSchema,
6
6
  } from '@modelcontextprotocol/sdk/types.js';
7
7
  import { loadConfig } from './config.js';
8
- import { evaluatePayment } from './api.js';
8
+ import { evaluatePayment, api } from './api.js';
9
9
 
10
10
  export async function runMcp() {
11
11
  const config = loadConfig();
@@ -107,4 +107,10 @@ export async function runMcp() {
107
107
 
108
108
  const transport = new StdioServerTransport();
109
109
  await server.connect(transport);
110
+
111
+ // Heartbeat: tell the dashboard this MCP server is active
112
+ const sendHeartbeat = () =>
113
+ api.mcpHeartbeat(apiKey).catch(() => {}); // silent — don't crash MCP on network error
114
+ sendHeartbeat();
115
+ setInterval(sendHeartbeat, 60_000);
110
116
  }