@rovn-ai/mcp-server 0.2.0 → 0.3.0

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/dist/server.d.ts CHANGED
@@ -27,6 +27,7 @@ export interface ServerConfig {
27
27
  ownerEmail: string;
28
28
  apiKey: string;
29
29
  agentId: string;
30
+ sessionId: string;
30
31
  }
31
32
  export declare function getArg(args: string[], flag: string): string | undefined;
32
33
  export declare function createConfig(args: string[]): ServerConfig;
@@ -64,13 +65,14 @@ export declare const TOOLS: ({
64
65
  };
65
66
  title?: undefined;
66
67
  metadata?: undefined;
68
+ task_id?: undefined;
67
69
  action?: undefined;
68
70
  context?: undefined;
69
71
  urgency?: undefined;
70
72
  cost?: undefined;
71
73
  status?: undefined;
72
- task_id?: undefined;
73
74
  days?: undefined;
75
+ summary?: undefined;
74
76
  };
75
77
  required: string[];
76
78
  };
@@ -96,6 +98,10 @@ export declare const TOOLS: ({
96
98
  type: string;
97
99
  description: string;
98
100
  };
101
+ task_id: {
102
+ type: string;
103
+ description: string;
104
+ };
99
105
  name?: undefined;
100
106
  capabilities?: undefined;
101
107
  action?: undefined;
@@ -103,8 +109,8 @@ export declare const TOOLS: ({
103
109
  urgency?: undefined;
104
110
  cost?: undefined;
105
111
  status?: undefined;
106
- task_id?: undefined;
107
112
  days?: undefined;
113
+ summary?: undefined;
108
114
  };
109
115
  required: string[];
110
116
  };
@@ -137,9 +143,10 @@ export declare const TOOLS: ({
137
143
  capabilities?: undefined;
138
144
  title?: undefined;
139
145
  metadata?: undefined;
140
- status?: undefined;
141
146
  task_id?: undefined;
147
+ status?: undefined;
142
148
  days?: undefined;
149
+ summary?: undefined;
143
150
  };
144
151
  required: string[];
145
152
  };
@@ -169,12 +176,13 @@ export declare const TOOLS: ({
169
176
  name?: undefined;
170
177
  capabilities?: undefined;
171
178
  metadata?: undefined;
179
+ task_id?: undefined;
172
180
  action?: undefined;
173
181
  context?: undefined;
174
182
  cost?: undefined;
175
183
  status?: undefined;
176
- task_id?: undefined;
177
184
  days?: undefined;
185
+ summary?: undefined;
178
186
  };
179
187
  required: string[];
180
188
  };
@@ -195,12 +203,13 @@ export declare const TOOLS: ({
195
203
  capabilities?: undefined;
196
204
  title?: undefined;
197
205
  metadata?: undefined;
206
+ task_id?: undefined;
198
207
  action?: undefined;
199
208
  context?: undefined;
200
209
  urgency?: undefined;
201
210
  cost?: undefined;
202
- task_id?: undefined;
203
211
  days?: undefined;
212
+ summary?: undefined;
204
213
  };
205
214
  required?: undefined;
206
215
  };
@@ -230,6 +239,7 @@ export declare const TOOLS: ({
230
239
  urgency?: undefined;
231
240
  cost?: undefined;
232
241
  days?: undefined;
242
+ summary?: undefined;
233
243
  };
234
244
  required: string[];
235
245
  };
@@ -249,12 +259,13 @@ export declare const TOOLS: ({
249
259
  capabilities?: undefined;
250
260
  title?: undefined;
251
261
  metadata?: undefined;
262
+ task_id?: undefined;
252
263
  action?: undefined;
253
264
  context?: undefined;
254
265
  urgency?: undefined;
255
266
  cost?: undefined;
256
267
  status?: undefined;
257
- task_id?: undefined;
268
+ summary?: undefined;
258
269
  };
259
270
  required?: undefined;
260
271
  };
@@ -270,12 +281,68 @@ export declare const TOOLS: ({
270
281
  capabilities?: undefined;
271
282
  title?: undefined;
272
283
  metadata?: undefined;
284
+ task_id?: undefined;
285
+ action?: undefined;
286
+ context?: undefined;
287
+ urgency?: undefined;
288
+ cost?: undefined;
289
+ status?: undefined;
290
+ days?: undefined;
291
+ summary?: undefined;
292
+ };
293
+ required?: undefined;
294
+ };
295
+ } | {
296
+ name: string;
297
+ description: string;
298
+ inputSchema: {
299
+ type: "object";
300
+ properties: {
301
+ name: {
302
+ type: string;
303
+ description: string;
304
+ };
305
+ metadata: {
306
+ type: string;
307
+ description: string;
308
+ };
309
+ description?: undefined;
310
+ type?: undefined;
311
+ capabilities?: undefined;
312
+ title?: undefined;
313
+ task_id?: undefined;
273
314
  action?: undefined;
274
315
  context?: undefined;
275
316
  urgency?: undefined;
276
317
  cost?: undefined;
277
318
  status?: undefined;
319
+ days?: undefined;
320
+ summary?: undefined;
321
+ };
322
+ required?: undefined;
323
+ };
324
+ } | {
325
+ name: string;
326
+ description: string;
327
+ inputSchema: {
328
+ type: "object";
329
+ properties: {
330
+ summary: {
331
+ type: string;
332
+ description: string;
333
+ };
334
+ name?: undefined;
335
+ description?: undefined;
336
+ type?: undefined;
337
+ capabilities?: undefined;
338
+ title?: undefined;
339
+ metadata?: undefined;
278
340
  task_id?: undefined;
341
+ action?: undefined;
342
+ context?: undefined;
343
+ urgency?: undefined;
344
+ cost?: undefined;
345
+ status?: undefined;
279
346
  days?: undefined;
280
347
  };
281
348
  required?: undefined;
@@ -330,13 +397,14 @@ export declare function handleRequest(request: {
330
397
  };
331
398
  title?: undefined;
332
399
  metadata?: undefined;
400
+ task_id?: undefined;
333
401
  action?: undefined;
334
402
  context?: undefined;
335
403
  urgency?: undefined;
336
404
  cost?: undefined;
337
405
  status?: undefined;
338
- task_id?: undefined;
339
406
  days?: undefined;
407
+ summary?: undefined;
340
408
  };
341
409
  required: string[];
342
410
  };
@@ -362,6 +430,10 @@ export declare function handleRequest(request: {
362
430
  type: string;
363
431
  description: string;
364
432
  };
433
+ task_id: {
434
+ type: string;
435
+ description: string;
436
+ };
365
437
  name?: undefined;
366
438
  capabilities?: undefined;
367
439
  action?: undefined;
@@ -369,8 +441,8 @@ export declare function handleRequest(request: {
369
441
  urgency?: undefined;
370
442
  cost?: undefined;
371
443
  status?: undefined;
372
- task_id?: undefined;
373
444
  days?: undefined;
445
+ summary?: undefined;
374
446
  };
375
447
  required: string[];
376
448
  };
@@ -403,9 +475,10 @@ export declare function handleRequest(request: {
403
475
  capabilities?: undefined;
404
476
  title?: undefined;
405
477
  metadata?: undefined;
406
- status?: undefined;
407
478
  task_id?: undefined;
479
+ status?: undefined;
408
480
  days?: undefined;
481
+ summary?: undefined;
409
482
  };
410
483
  required: string[];
411
484
  };
@@ -435,12 +508,13 @@ export declare function handleRequest(request: {
435
508
  name?: undefined;
436
509
  capabilities?: undefined;
437
510
  metadata?: undefined;
511
+ task_id?: undefined;
438
512
  action?: undefined;
439
513
  context?: undefined;
440
514
  cost?: undefined;
441
515
  status?: undefined;
442
- task_id?: undefined;
443
516
  days?: undefined;
517
+ summary?: undefined;
444
518
  };
445
519
  required: string[];
446
520
  };
@@ -461,12 +535,13 @@ export declare function handleRequest(request: {
461
535
  capabilities?: undefined;
462
536
  title?: undefined;
463
537
  metadata?: undefined;
538
+ task_id?: undefined;
464
539
  action?: undefined;
465
540
  context?: undefined;
466
541
  urgency?: undefined;
467
542
  cost?: undefined;
468
- task_id?: undefined;
469
543
  days?: undefined;
544
+ summary?: undefined;
470
545
  };
471
546
  required?: undefined;
472
547
  };
@@ -496,6 +571,7 @@ export declare function handleRequest(request: {
496
571
  urgency?: undefined;
497
572
  cost?: undefined;
498
573
  days?: undefined;
574
+ summary?: undefined;
499
575
  };
500
576
  required: string[];
501
577
  };
@@ -515,12 +591,13 @@ export declare function handleRequest(request: {
515
591
  capabilities?: undefined;
516
592
  title?: undefined;
517
593
  metadata?: undefined;
594
+ task_id?: undefined;
518
595
  action?: undefined;
519
596
  context?: undefined;
520
597
  urgency?: undefined;
521
598
  cost?: undefined;
522
599
  status?: undefined;
523
- task_id?: undefined;
600
+ summary?: undefined;
524
601
  };
525
602
  required?: undefined;
526
603
  };
@@ -536,12 +613,68 @@ export declare function handleRequest(request: {
536
613
  capabilities?: undefined;
537
614
  title?: undefined;
538
615
  metadata?: undefined;
616
+ task_id?: undefined;
617
+ action?: undefined;
618
+ context?: undefined;
619
+ urgency?: undefined;
620
+ cost?: undefined;
621
+ status?: undefined;
622
+ days?: undefined;
623
+ summary?: undefined;
624
+ };
625
+ required?: undefined;
626
+ };
627
+ } | {
628
+ name: string;
629
+ description: string;
630
+ inputSchema: {
631
+ type: "object";
632
+ properties: {
633
+ name: {
634
+ type: string;
635
+ description: string;
636
+ };
637
+ metadata: {
638
+ type: string;
639
+ description: string;
640
+ };
641
+ description?: undefined;
642
+ type?: undefined;
643
+ capabilities?: undefined;
644
+ title?: undefined;
645
+ task_id?: undefined;
539
646
  action?: undefined;
540
647
  context?: undefined;
541
648
  urgency?: undefined;
542
649
  cost?: undefined;
543
650
  status?: undefined;
651
+ days?: undefined;
652
+ summary?: undefined;
653
+ };
654
+ required?: undefined;
655
+ };
656
+ } | {
657
+ name: string;
658
+ description: string;
659
+ inputSchema: {
660
+ type: "object";
661
+ properties: {
662
+ summary: {
663
+ type: string;
664
+ description: string;
665
+ };
666
+ name?: undefined;
667
+ description?: undefined;
668
+ type?: undefined;
669
+ capabilities?: undefined;
670
+ title?: undefined;
671
+ metadata?: undefined;
544
672
  task_id?: undefined;
673
+ action?: undefined;
674
+ context?: undefined;
675
+ urgency?: undefined;
676
+ cost?: undefined;
677
+ status?: undefined;
545
678
  days?: undefined;
546
679
  };
547
680
  required?: undefined;
package/dist/server.js CHANGED
@@ -46,6 +46,7 @@ function createConfig(args) {
46
46
  ownerEmail: getArg(args, '--email') ?? process.env.ROVN_OWNER_EMAIL ?? '',
47
47
  apiKey: getArg(args, '--api-key') ?? process.env.ROVN_API_KEY ?? '',
48
48
  agentId: getArg(args, '--agent-id') ?? process.env.ROVN_AGENT_ID ?? '',
49
+ sessionId: '',
49
50
  };
50
51
  }
51
52
  exports.config = createConfig(process.argv.slice(2));
@@ -55,6 +56,7 @@ function resetConfig(overrides = {}) {
55
56
  exports.config.ownerEmail = overrides.ownerEmail ?? '';
56
57
  exports.config.apiKey = overrides.apiKey ?? '';
57
58
  exports.config.agentId = overrides.agentId ?? '';
59
+ exports.config.sessionId = overrides.sessionId ?? '';
58
60
  }
59
61
  function requireAgent(cfg) {
60
62
  if (!cfg.agentId || !cfg.apiKey) {
@@ -138,8 +140,25 @@ function autoLog(title, type = 'governance') {
138
140
  type,
139
141
  title,
140
142
  metadata: { source: 'mcp-auto' },
143
+ session_id: exports.config.sessionId || undefined,
141
144
  }).catch(() => { });
142
145
  }
146
+ // ─── Session Helpers ─────────────────────────────────────────
147
+ async function startSession() {
148
+ if (!exports.config.agentId || !exports.config.apiKey)
149
+ return null;
150
+ try {
151
+ const res = await rovnPost(`/api/agents/${exports.config.agentId}/sessions`, {});
152
+ if (res.success) {
153
+ const data = res.data;
154
+ const sessionId = data.id;
155
+ exports.config.sessionId = sessionId;
156
+ return sessionId;
157
+ }
158
+ }
159
+ catch { /* ignore session start failures */ }
160
+ return null;
161
+ }
143
162
  // ─── MCP Tools Definition ───────────────────────────────────
144
163
  exports.TOOLS = [
145
164
  {
@@ -170,6 +189,7 @@ exports.TOOLS = [
170
189
  type: { type: 'string', description: 'Activity type (e.g., code_generation, testing, deployment, review)' },
171
190
  description: { type: 'string', description: 'Detailed description of what was done' },
172
191
  metadata: { type: 'object', description: 'Additional structured data (e.g., { files_changed: 3 })' },
192
+ task_id: { type: 'string', description: 'Optional task ID to link this activity to a specific task' },
173
193
  },
174
194
  required: ['title'],
175
195
  },
@@ -242,6 +262,27 @@ exports.TOOLS = [
242
262
  properties: {},
243
263
  },
244
264
  },
265
+ {
266
+ name: 'rovn_start_session',
267
+ description: 'Start a new session. Activities logged after this will be automatically grouped under this session.',
268
+ inputSchema: {
269
+ type: 'object',
270
+ properties: {
271
+ name: { type: 'string', description: 'Optional session name' },
272
+ metadata: { type: 'object', description: 'Optional metadata for the session' },
273
+ },
274
+ },
275
+ },
276
+ {
277
+ name: 'rovn_end_session',
278
+ description: 'End the current session. Optionally provide a summary.',
279
+ inputSchema: {
280
+ type: 'object',
281
+ properties: {
282
+ summary: { type: 'string', description: 'Optional summary of what was accomplished in this session' },
283
+ },
284
+ },
285
+ },
245
286
  ];
246
287
  // ─── MCP Protocol Handler ───────────────────────────────────
247
288
  async function handleRequest(request) {
@@ -273,11 +314,15 @@ async function handleToolCall(params) {
273
314
  const check = await rovnGet(`/api/agents/${exports.config.agentId}/trust-score`);
274
315
  if (check.success) {
275
316
  const data = (check.data ?? check);
317
+ // Auto-start session on reuse
318
+ if (!exports.config.sessionId)
319
+ await startSession();
276
320
  return toolResult({
277
321
  success: true,
278
322
  data: {
279
323
  id: exports.config.agentId,
280
324
  name: data.agent_name ?? toolArgs.name,
325
+ session_id: exports.config.sessionId || undefined,
281
326
  message: 'Already registered. Using existing agent credentials.',
282
327
  },
283
328
  });
@@ -285,10 +330,14 @@ async function handleToolCall(params) {
285
330
  // Pre-configured credentials (from CLI args) — keep using them even if validation fails
286
331
  // This prevents creating duplicate agents when the server is temporarily unavailable
287
332
  if (getArg(process.argv.slice(2), '--api-key') || process.env.ROVN_API_KEY) {
333
+ // Auto-start session on reuse
334
+ if (!exports.config.sessionId)
335
+ await startSession();
288
336
  return toolResult({
289
337
  success: true,
290
338
  data: {
291
339
  id: exports.config.agentId,
340
+ session_id: exports.config.sessionId || undefined,
292
341
  message: 'Using pre-configured credentials (server validation skipped).',
293
342
  },
294
343
  });
@@ -311,12 +360,15 @@ async function handleToolCall(params) {
311
360
  exports.config.apiKey = data.api_key;
312
361
  exports.config.agentId = data.id;
313
362
  autoLog(`Registered as ${data.name}`, 'registration');
363
+ // Auto-start session on new registration
364
+ await startSession();
314
365
  return toolResult({
315
366
  success: true,
316
367
  data: {
317
368
  id: data.id,
318
369
  name: data.name,
319
370
  claim_url: data.claim_url,
371
+ session_id: exports.config.sessionId || undefined,
320
372
  message: 'Agent registered! Share the claim_url with the owner. API key saved for this session.',
321
373
  },
322
374
  });
@@ -332,6 +384,8 @@ async function handleToolCall(params) {
332
384
  title: toolArgs.title,
333
385
  description: toolArgs.description,
334
386
  metadata: toolArgs.metadata,
387
+ session_id: exports.config.sessionId || undefined,
388
+ task_id: toolArgs.task_id || undefined,
335
389
  }));
336
390
  }
337
391
  case 'rovn_check_action': {
@@ -397,6 +451,42 @@ async function handleToolCall(params) {
397
451
  return toolResult({ success: false, error: err });
398
452
  return toolResult(await rovnGet(`/api/agents/${exports.config.agentId}/trust-score`));
399
453
  }
454
+ case 'rovn_start_session': {
455
+ const err = requireAgent(exports.config);
456
+ if (err)
457
+ return toolResult({ success: false, error: err });
458
+ // End existing session if any
459
+ if (exports.config.sessionId) {
460
+ await rovnPatch(`/api/sessions/${exports.config.sessionId}`, {});
461
+ exports.config.sessionId = '';
462
+ }
463
+ const sessionRes = await rovnPost(`/api/agents/${exports.config.agentId}/sessions`, {
464
+ name: toolArgs.name,
465
+ metadata: toolArgs.metadata,
466
+ });
467
+ if (sessionRes.success) {
468
+ const data = sessionRes.data;
469
+ exports.config.sessionId = data.id;
470
+ autoLog(`Session started: ${toolArgs.name ?? data.id}`, 'session');
471
+ }
472
+ return toolResult(sessionRes);
473
+ }
474
+ case 'rovn_end_session': {
475
+ const err = requireAgent(exports.config);
476
+ if (err)
477
+ return toolResult({ success: false, error: err });
478
+ if (!exports.config.sessionId) {
479
+ return toolResult({ success: false, error: 'No active session to end' });
480
+ }
481
+ const endRes = await rovnPatch(`/api/sessions/${exports.config.sessionId}`, {
482
+ summary: toolArgs.summary,
483
+ });
484
+ if (endRes.success) {
485
+ autoLog(`Session ended: ${exports.config.sessionId}`, 'session');
486
+ exports.config.sessionId = '';
487
+ }
488
+ return toolResult(endRes);
489
+ }
400
490
  default:
401
491
  return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
402
492
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovn-ai/mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Rovn MCP Server — governance tools for Claude, GPT, and any MCP-compatible agent",
5
5
  "main": "dist/server.js",
6
6
  "bin": {