@troxy/cli 0.1.6 → 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 +1 -1
- package/src/api.js +3 -0
- package/src/mcp-server.js +7 -1
package/package.json
CHANGED
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/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
|
}
|