@agentvalet/mcp-server 0.3.4 → 0.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.
Files changed (2) hide show
  1. package/dist/index.js +109 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51,6 +51,26 @@ const LIST_PLATFORMS_TOOL = {
51
51
  name: "list_platforms",
52
52
  description: "list_platforms: List the platforms and permission scopes this agent has access to.\nInput: None.\nReturns: { platforms: [{ platformId, platformName, scopes, requireApproval }], version: \"<hex>\" }.\nVersion: a deterministic hash that only changes when the platform set or scopes change. Cache the value across calls in the same session — only refresh when you suspect platforms have changed (e.g. user mentions a new connection).\nAuth: Bearer JWT.",
53
53
  inputSchema: { type: "object", properties: {} },
54
+ outputSchema: {
55
+ type: "object",
56
+ properties: {
57
+ platforms: {
58
+ type: "array",
59
+ items: {
60
+ type: "object",
61
+ properties: {
62
+ platformId: { type: "string" },
63
+ platformName: { type: "string" },
64
+ scopes: { type: "array", items: { type: "string" } },
65
+ requireApproval: { type: "boolean" },
66
+ },
67
+ required: ["platformId", "platformName", "scopes"],
68
+ },
69
+ },
70
+ version: { type: "string" },
71
+ },
72
+ required: ["platforms"],
73
+ },
54
74
  };
55
75
  const USE_PLATFORM_TOOL = {
56
76
  name: "use_platform",
@@ -112,6 +132,17 @@ const AGENT_REGISTER_TOOL = {
112
132
  },
113
133
  required: ["owner_id", "agent_name", "requested_scopes"],
114
134
  },
135
+ outputSchema: {
136
+ type: "object",
137
+ properties: {
138
+ registration_token: { type: "string" },
139
+ poll_url: { type: "string" },
140
+ client_id: { type: "string" },
141
+ scope: { type: "string" },
142
+ expires_in: { type: "number" },
143
+ },
144
+ required: ["registration_token"],
145
+ },
115
146
  };
116
147
  const AGENT_STATUS_TOOL = {
117
148
  name: "agent_status",
@@ -126,6 +157,15 @@ const AGENT_STATUS_TOOL = {
126
157
  },
127
158
  required: ["token"],
128
159
  },
160
+ outputSchema: {
161
+ type: "object",
162
+ properties: {
163
+ status: { type: "string", enum: ["pending_approval", "approved", "rejected"] },
164
+ agent_id: { type: "string" },
165
+ mcp_config: { type: "object" },
166
+ },
167
+ required: ["status"],
168
+ },
129
169
  };
130
170
  const AUTHZEN_EVALUATE_TOOL = {
131
171
  name: "authzen_evaluate",
@@ -144,6 +184,14 @@ const AUTHZEN_EVALUATE_TOOL = {
144
184
  },
145
185
  required: ["platform_id", "scope"],
146
186
  },
187
+ outputSchema: {
188
+ type: "object",
189
+ properties: {
190
+ decision: { type: "boolean" },
191
+ context: { type: "object", properties: { reason: { type: "string" } } },
192
+ },
193
+ required: ["decision"],
194
+ },
147
195
  };
148
196
  const REPORT_SELF_DIAGNOSTIC_TOOL = {
149
197
  name: "report_self_diagnostic",
@@ -183,11 +231,55 @@ const REPORT_SELF_DIAGNOSTIC_TOOL = {
183
231
  },
184
232
  required: ["severity", "message"],
185
233
  },
234
+ outputSchema: {
235
+ type: "object",
236
+ properties: {
237
+ id: { type: "string" },
238
+ received_at: { type: "string" },
239
+ },
240
+ required: ["id"],
241
+ },
186
242
  };
187
243
  const LIST_MY_PENDING_ACTIONS_TOOL = {
188
244
  name: "list_my_pending_actions",
189
245
  description: "list_my_pending_actions: Returns this agent's currently-pending approval requests AND any that completed in the last 24 hours. Use this at session start when the user mentions an earlier action, or when use_platform's long-poll timed out and the user comes back asking what happened.\nInput: None.\nReturns: { pending: [{approval_id, platform_id, scope, created_at, expires_at}], recently_completed: [{approval_id, platform_id, scope, status, executed_at, result_summary, execution_error}] }.\nAuth: Bearer agent JWT (sent automatically).",
190
246
  inputSchema: { type: "object", properties: {} },
247
+ outputSchema: {
248
+ type: "object",
249
+ properties: {
250
+ pending: {
251
+ type: "array",
252
+ items: {
253
+ type: "object",
254
+ properties: {
255
+ approval_id: { type: "string" },
256
+ platform_id: { type: "string" },
257
+ scope: { type: "string" },
258
+ created_at: { type: "string" },
259
+ expires_at: { type: "string" },
260
+ },
261
+ required: ["approval_id", "platform_id", "scope"],
262
+ },
263
+ },
264
+ recently_completed: {
265
+ type: "array",
266
+ items: {
267
+ type: "object",
268
+ properties: {
269
+ approval_id: { type: "string" },
270
+ platform_id: { type: "string" },
271
+ scope: { type: "string" },
272
+ status: { type: "string" },
273
+ executed_at: { type: "string" },
274
+ result_summary: { type: "string" },
275
+ execution_error: { type: "string" },
276
+ },
277
+ required: ["approval_id", "status"],
278
+ },
279
+ },
280
+ },
281
+ required: ["pending", "recently_completed"],
282
+ },
191
283
  };
192
284
  // TODO: intent_resolve tool — planned for future release
193
285
  // ---------------------------------------------------------------------------
@@ -471,13 +563,27 @@ async function waitForApproval(approvalId, originalCall, progressToken) {
471
563
  // Re-execution complete. Return the upstream response transparently —
472
564
  // the agent sees this as if the original use_platform call just succeeded.
473
565
  const r = status.result;
474
- const summary = `[Owner approved after ${Math.round(elapsed / 1000)}s]\n` +
475
- JSON.stringify(r.data ?? null);
476
566
  // Mirror the non-2xx-from-upstream behaviour of the regular path.
477
567
  if (r.status < 200 || r.status >= 300) {
478
568
  return errorContent(`Upstream returned ${r.status}: ${JSON.stringify(r.data)}`);
479
569
  }
480
- return { content: [{ type: "text", text: summary }] };
570
+ // Two-channel return: the text envelope carries the human-readable
571
+ // "[Owner approved after Ns]" prefix (visible to non-structured-aware
572
+ // clients), and structuredContent carries the parsed upstream JSON
573
+ // directly so MCP-aware hosts (Claude Desktop ≥ MCP spec 2025-06-18)
574
+ // never have to strip-the-prefix-and-reparse. Without the second
575
+ // channel the prefix forces Claude into the same wrapper-parse
576
+ // round-trip the bare /v1/actions path used to.
577
+ const data = r.data ?? null;
578
+ const summary = `[Owner approved after ${Math.round(elapsed / 1000)}s]\n` +
579
+ JSON.stringify(data);
580
+ const result = {
581
+ content: [{ type: "text", text: summary }],
582
+ };
583
+ if (data && typeof data === "object" && !Array.isArray(data)) {
584
+ result.structuredContent = data;
585
+ }
586
+ return result;
481
587
  }
482
588
  if (status.status === "denied") {
483
589
  return errorContent(`Owner denied this action${status.execution_error ? `: ${status.execution_error}` : "."}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvalet/mcp-server",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "AgentValet MCP server — lets AI agents call approved platforms via the AgentValet proxy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",