@jclvsh/iris 0.7.0 → 0.9.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.
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { formatMcpError } from "../cli-utils.js";
2
3
  // Mirrors WEBHOOK_EVENTS in src/lib/api/webhooks/events.ts (server-side source of truth).
3
4
  // Keep in sync — anything not on this list is rejected by validateWebhookEvents at the route layer.
4
5
  const WEBHOOK_EVENTS = [
@@ -34,15 +35,7 @@ export function registerWebhookTools(server, client) {
34
35
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
35
36
  }
36
37
  catch (error) {
37
- return {
38
- content: [
39
- {
40
- type: "text",
41
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
42
- },
43
- ],
44
- isError: true,
45
- };
38
+ return formatMcpError(error);
46
39
  }
47
40
  });
48
41
  server.tool("create_webhook", "create a new webhook endpoint. requires admin scope.", {
@@ -59,15 +52,7 @@ export function registerWebhookTools(server, client) {
59
52
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
60
53
  }
61
54
  catch (error) {
62
- return {
63
- content: [
64
- {
65
- type: "text",
66
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
67
- },
68
- ],
69
- isError: true,
70
- };
55
+ return formatMcpError(error);
71
56
  }
72
57
  });
73
58
  server.tool("get_webhook", "get a webhook by ID. requires admin scope.", {
@@ -78,15 +63,7 @@ export function registerWebhookTools(server, client) {
78
63
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
79
64
  }
80
65
  catch (error) {
81
- return {
82
- content: [
83
- {
84
- type: "text",
85
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
86
- },
87
- ],
88
- isError: true,
89
- };
66
+ return formatMcpError(error);
90
67
  }
91
68
  });
92
69
  server.tool("update_webhook", "update a webhook's configuration. requires admin scope.", {
@@ -105,15 +82,7 @@ export function registerWebhookTools(server, client) {
105
82
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
106
83
  }
107
84
  catch (error) {
108
- return {
109
- content: [
110
- {
111
- type: "text",
112
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
113
- },
114
- ],
115
- isError: true,
116
- };
85
+ return formatMcpError(error);
117
86
  }
118
87
  });
119
88
  server.tool("delete_webhook", "delete a webhook. requires admin scope.", {
@@ -124,15 +93,7 @@ export function registerWebhookTools(server, client) {
124
93
  return { content: [{ type: "text", text: `webhook ${id} deleted` }] };
125
94
  }
126
95
  catch (error) {
127
- return {
128
- content: [
129
- {
130
- type: "text",
131
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
132
- },
133
- ],
134
- isError: true,
135
- };
96
+ return formatMcpError(error);
136
97
  }
137
98
  });
138
99
  server.tool("test_webhook", "send a test event to a webhook endpoint to verify it's working. requires admin scope.", {
@@ -143,15 +104,7 @@ export function registerWebhookTools(server, client) {
143
104
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
144
105
  }
145
106
  catch (error) {
146
- return {
147
- content: [
148
- {
149
- type: "text",
150
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
151
- },
152
- ],
153
- isError: true,
154
- };
107
+ return formatMcpError(error);
155
108
  }
156
109
  });
157
110
  server.tool("rotate_webhook_secret", "rotate the signing secret for a webhook. the new secret is returned in the response. the old secret is invalidated immediately — receivers must update their HMAC verification before the next delivery. requires admin scope.", {
@@ -162,15 +115,7 @@ export function registerWebhookTools(server, client) {
162
115
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
163
116
  }
164
117
  catch (error) {
165
- return {
166
- content: [
167
- {
168
- type: "text",
169
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
170
- },
171
- ],
172
- isError: true,
173
- };
118
+ return formatMcpError(error);
174
119
  }
175
120
  });
176
121
  server.tool("list_webhook_deliveries", "list delivery history for a webhook. requires admin scope.", {
@@ -188,15 +133,7 @@ export function registerWebhookTools(server, client) {
188
133
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
189
134
  }
190
135
  catch (error) {
191
- return {
192
- content: [
193
- {
194
- type: "text",
195
- text: `error: ${error instanceof Error ? error.message : String(error)}`,
196
- },
197
- ],
198
- isError: true,
199
- };
136
+ return formatMcpError(error);
200
137
  }
201
138
  });
202
139
  }
package/dist/types.d.ts CHANGED
@@ -237,6 +237,8 @@ export interface Webhook {
237
237
  export interface CreateApiKeyResponse extends ApiKey {
238
238
  key: string;
239
239
  }
240
+ /** Response when rotating an API key. Same shape as create — the new raw key is shown once. */
241
+ export type RotateApiKeyResponse = CreateApiKeyResponse;
240
242
  export interface WebhookDelivery {
241
243
  id: string;
242
244
  webhook_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jclvsh/iris",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "MCP server for the Iris API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",