@happyvertical/smrt-app-mcp 0.60.18 → 0.61.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/AGENTS.md +12 -0
- package/README.md +40 -0
- package/agents/runtime-loading.md +21 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/audit-store.d.ts +53 -0
- package/dist/audit-store.d.ts.map +1 -0
- package/dist/audit-store.js +149 -0
- package/dist/audit-store.js.map +1 -0
- package/dist/audit.d.ts +59 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/chunks/{protocol-BRQji5k_.js → defaults-i3kpRFpB.js} +190 -149
- package/dist/chunks/defaults-i3kpRFpB.js.map +1 -0
- package/dist/chunks/{errors-XG_zn1pP.js → errors-C704k8Mv.js} +3 -2
- package/dist/chunks/errors-C704k8Mv.js.map +1 -0
- package/dist/chunks/protocol-D_O2WaCO.js +153 -0
- package/dist/chunks/protocol-D_O2WaCO.js.map +1 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/host-operations.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +435 -3
- package/dist/server.d.ts +39 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +174 -8
- package/dist/smrt-knowledge.okf.md +17 -4
- package/dist/sveltekit.d.ts +1 -1
- package/dist/sveltekit.d.ts.map +1 -1
- package/dist/sveltekit.js +4 -3
- package/dist/sveltekit.js.map +1 -1
- package/dist/workflow-tools.d.ts +14 -0
- package/dist/workflow-tools.d.ts.map +1 -1
- package/package.json +14 -6
- package/dist/chunks/errors-XG_zn1pP.js.map +0 -1
- package/dist/chunks/protocol-BRQji5k_.js.map +0 -1
package/dist/manifest.json
CHANGED
|
@@ -2,12 +2,444 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-app-mcp",
|
|
5
|
-
"packageVersion": "0.
|
|
6
|
-
"objects": {
|
|
5
|
+
"packageVersion": "0.61.0",
|
|
6
|
+
"objects": {
|
|
7
|
+
"@happyvertical/smrt-app-mcp:McpCallAudit": {
|
|
8
|
+
"name": "mcpcallaudit",
|
|
9
|
+
"className": "McpCallAudit",
|
|
10
|
+
"qualifiedName": "@happyvertical/smrt-app-mcp:McpCallAudit",
|
|
11
|
+
"collection": "mcpcallaudits",
|
|
12
|
+
"description": "One persisted MCP tool call. Stores identity, tool, tenant, outcome and argument KEY names only: never argument values or response bodies.",
|
|
13
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/smrt-app-mcp/src/audit-store.ts",
|
|
14
|
+
"packageName": "@happyvertical/smrt-app-mcp",
|
|
15
|
+
"fields": {
|
|
16
|
+
"tenantId": {
|
|
17
|
+
"type": "text",
|
|
18
|
+
"required": false,
|
|
19
|
+
"_meta": {
|
|
20
|
+
"sqlType": "UUID",
|
|
21
|
+
"nullable": true,
|
|
22
|
+
"__tenancy": {
|
|
23
|
+
"isTenantIdField": true,
|
|
24
|
+
"autoFilter": true,
|
|
25
|
+
"required": false,
|
|
26
|
+
"autoPopulate": true,
|
|
27
|
+
"nullable": true,
|
|
28
|
+
"mode": "optional",
|
|
29
|
+
"field": "tenantId",
|
|
30
|
+
"allowSuperAdminBypass": false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"principalId": {
|
|
35
|
+
"type": "text",
|
|
36
|
+
"required": false,
|
|
37
|
+
"_meta": {
|
|
38
|
+
"nullable": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"principalKind": {
|
|
42
|
+
"type": "text",
|
|
43
|
+
"required": false,
|
|
44
|
+
"_meta": {
|
|
45
|
+
"nullable": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"identityIssuer": {
|
|
49
|
+
"type": "text",
|
|
50
|
+
"required": false,
|
|
51
|
+
"_meta": {
|
|
52
|
+
"nullable": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"identitySubject": {
|
|
56
|
+
"type": "text",
|
|
57
|
+
"required": false,
|
|
58
|
+
"_meta": {
|
|
59
|
+
"nullable": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"identityClientId": {
|
|
63
|
+
"type": "text",
|
|
64
|
+
"required": false,
|
|
65
|
+
"_meta": {
|
|
66
|
+
"nullable": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"tool": {
|
|
70
|
+
"type": "text",
|
|
71
|
+
"required": true,
|
|
72
|
+
"default": "",
|
|
73
|
+
"_meta": {
|
|
74
|
+
"required": true,
|
|
75
|
+
"default": ""
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"outcome": {
|
|
79
|
+
"type": "text",
|
|
80
|
+
"required": true,
|
|
81
|
+
"default": "allowed",
|
|
82
|
+
"_meta": {
|
|
83
|
+
"required": true,
|
|
84
|
+
"default": "allowed"
|
|
85
|
+
},
|
|
86
|
+
"enum": [
|
|
87
|
+
"allowed",
|
|
88
|
+
"denied",
|
|
89
|
+
"error"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"errorCode": {
|
|
93
|
+
"type": "text",
|
|
94
|
+
"required": false,
|
|
95
|
+
"_meta": {
|
|
96
|
+
"nullable": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"argumentKeys": {
|
|
100
|
+
"type": "json",
|
|
101
|
+
"required": false,
|
|
102
|
+
"_meta": {}
|
|
103
|
+
},
|
|
104
|
+
"occurredAt": {
|
|
105
|
+
"type": "datetime",
|
|
106
|
+
"required": true,
|
|
107
|
+
"_meta": {
|
|
108
|
+
"required": true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"methods": {},
|
|
113
|
+
"decoratorConfig": {
|
|
114
|
+
"tableName": "smrt_mcp_call_audits",
|
|
115
|
+
"api": false,
|
|
116
|
+
"mcp": false,
|
|
117
|
+
"cli": false,
|
|
118
|
+
"tenantScoped": {
|
|
119
|
+
"mode": "optional"
|
|
120
|
+
},
|
|
121
|
+
"conflictColumns": [
|
|
122
|
+
"tenant_id",
|
|
123
|
+
"slug",
|
|
124
|
+
"context"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"extends": "SmrtObject",
|
|
128
|
+
"exportName": "McpCallAudit",
|
|
129
|
+
"collectionExportName": "McpCallAuditCollection",
|
|
130
|
+
"validationRules": [
|
|
131
|
+
{
|
|
132
|
+
"field": "tool",
|
|
133
|
+
"rule": "required",
|
|
134
|
+
"fieldType": "text"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"field": "outcome",
|
|
138
|
+
"rule": "required",
|
|
139
|
+
"fieldType": "text"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"field": "occurredAt",
|
|
143
|
+
"rule": "required",
|
|
144
|
+
"fieldType": "datetime"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"schema": {
|
|
148
|
+
"tableName": "smrt_mcp_call_audits",
|
|
149
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"smrt_mcp_call_audits\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"principal_id\" TEXT,\n \"principal_kind\" TEXT,\n \"identity_issuer\" TEXT,\n \"identity_subject\" TEXT,\n \"identity_client_id\" TEXT,\n \"tool\" TEXT NOT NULL DEFAULT '',\n \"outcome\" TEXT NOT NULL DEFAULT 'allowed',\n \"error_code\" TEXT,\n \"argument_keys\" JSON,\n \"occurred_at\" TIMESTAMP NOT NULL\n);",
|
|
150
|
+
"columns": {
|
|
151
|
+
"_sync_origin_device_id": {
|
|
152
|
+
"type": "TEXT"
|
|
153
|
+
},
|
|
154
|
+
"_sync_revision": {
|
|
155
|
+
"type": "INTEGER"
|
|
156
|
+
},
|
|
157
|
+
"id": {
|
|
158
|
+
"type": "UUID",
|
|
159
|
+
"primaryKey": true,
|
|
160
|
+
"referenceKind": "id",
|
|
161
|
+
"notNull": true
|
|
162
|
+
},
|
|
163
|
+
"slug": {
|
|
164
|
+
"type": "TEXT",
|
|
165
|
+
"notNull": true
|
|
166
|
+
},
|
|
167
|
+
"context": {
|
|
168
|
+
"type": "TEXT",
|
|
169
|
+
"notNull": true,
|
|
170
|
+
"default": ""
|
|
171
|
+
},
|
|
172
|
+
"created_at": {
|
|
173
|
+
"type": "TIMESTAMP",
|
|
174
|
+
"notNull": true,
|
|
175
|
+
"default": "current_timestamp"
|
|
176
|
+
},
|
|
177
|
+
"updated_at": {
|
|
178
|
+
"type": "TIMESTAMP",
|
|
179
|
+
"notNull": true,
|
|
180
|
+
"default": "current_timestamp"
|
|
181
|
+
},
|
|
182
|
+
"tenant_id": {
|
|
183
|
+
"type": "UUID",
|
|
184
|
+
"referenceKind": "tenantId",
|
|
185
|
+
"notNull": false,
|
|
186
|
+
"unique": false
|
|
187
|
+
},
|
|
188
|
+
"principal_id": {
|
|
189
|
+
"type": "TEXT",
|
|
190
|
+
"notNull": false,
|
|
191
|
+
"unique": false
|
|
192
|
+
},
|
|
193
|
+
"principal_kind": {
|
|
194
|
+
"type": "TEXT",
|
|
195
|
+
"notNull": false,
|
|
196
|
+
"unique": false
|
|
197
|
+
},
|
|
198
|
+
"identity_issuer": {
|
|
199
|
+
"type": "TEXT",
|
|
200
|
+
"notNull": false,
|
|
201
|
+
"unique": false
|
|
202
|
+
},
|
|
203
|
+
"identity_subject": {
|
|
204
|
+
"type": "TEXT",
|
|
205
|
+
"notNull": false,
|
|
206
|
+
"unique": false
|
|
207
|
+
},
|
|
208
|
+
"identity_client_id": {
|
|
209
|
+
"type": "TEXT",
|
|
210
|
+
"notNull": false,
|
|
211
|
+
"unique": false
|
|
212
|
+
},
|
|
213
|
+
"tool": {
|
|
214
|
+
"type": "TEXT",
|
|
215
|
+
"notNull": true,
|
|
216
|
+
"unique": false,
|
|
217
|
+
"default": ""
|
|
218
|
+
},
|
|
219
|
+
"outcome": {
|
|
220
|
+
"type": "TEXT",
|
|
221
|
+
"notNull": true,
|
|
222
|
+
"unique": false,
|
|
223
|
+
"default": "allowed"
|
|
224
|
+
},
|
|
225
|
+
"error_code": {
|
|
226
|
+
"type": "TEXT",
|
|
227
|
+
"notNull": false,
|
|
228
|
+
"unique": false
|
|
229
|
+
},
|
|
230
|
+
"argument_keys": {
|
|
231
|
+
"type": "JSON",
|
|
232
|
+
"notNull": false,
|
|
233
|
+
"unique": false
|
|
234
|
+
},
|
|
235
|
+
"occurred_at": {
|
|
236
|
+
"type": "TIMESTAMP",
|
|
237
|
+
"notNull": true,
|
|
238
|
+
"unique": false
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"indexes": [
|
|
242
|
+
{
|
|
243
|
+
"name": "smrt_mcp_call_audits_slug_context_idx",
|
|
244
|
+
"columns": [
|
|
245
|
+
"tenant_id",
|
|
246
|
+
"slug",
|
|
247
|
+
"context"
|
|
248
|
+
],
|
|
249
|
+
"unique": true,
|
|
250
|
+
"nullsNotDistinct": true
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "smrt_mcp_call_audits_tenant_id_created_at_idx",
|
|
254
|
+
"columns": [
|
|
255
|
+
"tenant_id",
|
|
256
|
+
"created_at"
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
"version": "e0a722bb"
|
|
261
|
+
},
|
|
262
|
+
"importPath": "@happyvertical/smrt-app-mcp/audit-store"
|
|
263
|
+
},
|
|
264
|
+
"@happyvertical/smrt-app-mcp:McpCallAuditCollection": {
|
|
265
|
+
"name": "mcpcallauditcollection",
|
|
266
|
+
"className": "McpCallAuditCollection",
|
|
267
|
+
"qualifiedName": "@happyvertical/smrt-app-mcp:McpCallAuditCollection",
|
|
268
|
+
"collection": "mcpcallaudits",
|
|
269
|
+
"description": "Tenant-aware persistence and queries for McpCallAudit.",
|
|
270
|
+
"filePath": "/home/runner/work/smrt/smrt/packages/smrt-app-mcp/src/audit-store.ts",
|
|
271
|
+
"packageName": "@happyvertical/smrt-app-mcp",
|
|
272
|
+
"fields": {},
|
|
273
|
+
"methods": {
|
|
274
|
+
"append": {
|
|
275
|
+
"name": "append",
|
|
276
|
+
"async": true,
|
|
277
|
+
"parameters": [
|
|
278
|
+
{
|
|
279
|
+
"name": "record",
|
|
280
|
+
"type": "McpAuditRecord",
|
|
281
|
+
"optional": false
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"returnType": "Promise<McpCallAudit>",
|
|
285
|
+
"isStatic": false,
|
|
286
|
+
"isPublic": true
|
|
287
|
+
},
|
|
288
|
+
"listAudits": {
|
|
289
|
+
"name": "listAudits",
|
|
290
|
+
"async": true,
|
|
291
|
+
"parameters": [
|
|
292
|
+
{
|
|
293
|
+
"name": "query",
|
|
294
|
+
"type": "any",
|
|
295
|
+
"optional": false,
|
|
296
|
+
"typeUnresolved": true
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"returnType": "any",
|
|
300
|
+
"isStatic": false,
|
|
301
|
+
"isPublic": true
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
"decoratorConfig": {
|
|
305
|
+
"tableName": "smrt_mcp_call_audits",
|
|
306
|
+
"api": false,
|
|
307
|
+
"mcp": false,
|
|
308
|
+
"cli": false
|
|
309
|
+
},
|
|
310
|
+
"extends": "SmrtCollection",
|
|
311
|
+
"extendsTypeArg": "McpCallAudit",
|
|
312
|
+
"exportName": "McpCallAuditCollection",
|
|
313
|
+
"collectionExportName": "McpCallAuditCollectionCollection",
|
|
314
|
+
"collectionOf": "@happyvertical/smrt-app-mcp:McpCallAudit",
|
|
315
|
+
"inheritedExposure": [
|
|
316
|
+
"api",
|
|
317
|
+
"mcp",
|
|
318
|
+
"cli"
|
|
319
|
+
],
|
|
320
|
+
"schema": {
|
|
321
|
+
"tableName": "smrt_mcp_call_audits",
|
|
322
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"smrt_mcp_call_audits\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"principal_id\" TEXT,\n \"principal_kind\" TEXT,\n \"identity_issuer\" TEXT,\n \"identity_subject\" TEXT,\n \"identity_client_id\" TEXT,\n \"tool\" TEXT NOT NULL DEFAULT '',\n \"outcome\" TEXT NOT NULL DEFAULT 'allowed',\n \"error_code\" TEXT,\n \"argument_keys\" JSON,\n \"occurred_at\" TIMESTAMP NOT NULL\n);",
|
|
323
|
+
"columns": {
|
|
324
|
+
"_sync_origin_device_id": {
|
|
325
|
+
"type": "TEXT"
|
|
326
|
+
},
|
|
327
|
+
"_sync_revision": {
|
|
328
|
+
"type": "INTEGER"
|
|
329
|
+
},
|
|
330
|
+
"id": {
|
|
331
|
+
"type": "UUID",
|
|
332
|
+
"primaryKey": true,
|
|
333
|
+
"referenceKind": "id",
|
|
334
|
+
"notNull": true
|
|
335
|
+
},
|
|
336
|
+
"slug": {
|
|
337
|
+
"type": "TEXT",
|
|
338
|
+
"notNull": true
|
|
339
|
+
},
|
|
340
|
+
"context": {
|
|
341
|
+
"type": "TEXT",
|
|
342
|
+
"notNull": true,
|
|
343
|
+
"default": ""
|
|
344
|
+
},
|
|
345
|
+
"created_at": {
|
|
346
|
+
"type": "TIMESTAMP",
|
|
347
|
+
"notNull": true,
|
|
348
|
+
"default": "current_timestamp"
|
|
349
|
+
},
|
|
350
|
+
"updated_at": {
|
|
351
|
+
"type": "TIMESTAMP",
|
|
352
|
+
"notNull": true,
|
|
353
|
+
"default": "current_timestamp"
|
|
354
|
+
},
|
|
355
|
+
"tenant_id": {
|
|
356
|
+
"type": "UUID",
|
|
357
|
+
"referenceKind": "tenantId",
|
|
358
|
+
"notNull": false,
|
|
359
|
+
"unique": false
|
|
360
|
+
},
|
|
361
|
+
"principal_id": {
|
|
362
|
+
"type": "TEXT",
|
|
363
|
+
"notNull": false,
|
|
364
|
+
"unique": false
|
|
365
|
+
},
|
|
366
|
+
"principal_kind": {
|
|
367
|
+
"type": "TEXT",
|
|
368
|
+
"notNull": false,
|
|
369
|
+
"unique": false
|
|
370
|
+
},
|
|
371
|
+
"identity_issuer": {
|
|
372
|
+
"type": "TEXT",
|
|
373
|
+
"notNull": false,
|
|
374
|
+
"unique": false
|
|
375
|
+
},
|
|
376
|
+
"identity_subject": {
|
|
377
|
+
"type": "TEXT",
|
|
378
|
+
"notNull": false,
|
|
379
|
+
"unique": false
|
|
380
|
+
},
|
|
381
|
+
"identity_client_id": {
|
|
382
|
+
"type": "TEXT",
|
|
383
|
+
"notNull": false,
|
|
384
|
+
"unique": false
|
|
385
|
+
},
|
|
386
|
+
"tool": {
|
|
387
|
+
"type": "TEXT",
|
|
388
|
+
"notNull": true,
|
|
389
|
+
"unique": false,
|
|
390
|
+
"default": ""
|
|
391
|
+
},
|
|
392
|
+
"outcome": {
|
|
393
|
+
"type": "TEXT",
|
|
394
|
+
"notNull": true,
|
|
395
|
+
"unique": false,
|
|
396
|
+
"default": "allowed"
|
|
397
|
+
},
|
|
398
|
+
"error_code": {
|
|
399
|
+
"type": "TEXT",
|
|
400
|
+
"notNull": false,
|
|
401
|
+
"unique": false
|
|
402
|
+
},
|
|
403
|
+
"argument_keys": {
|
|
404
|
+
"type": "JSON",
|
|
405
|
+
"notNull": false,
|
|
406
|
+
"unique": false
|
|
407
|
+
},
|
|
408
|
+
"occurred_at": {
|
|
409
|
+
"type": "TIMESTAMP",
|
|
410
|
+
"notNull": true,
|
|
411
|
+
"unique": false
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
"indexes": [
|
|
415
|
+
{
|
|
416
|
+
"name": "smrt_mcp_call_audits_slug_context_idx",
|
|
417
|
+
"columns": [
|
|
418
|
+
"tenant_id",
|
|
419
|
+
"slug",
|
|
420
|
+
"context"
|
|
421
|
+
],
|
|
422
|
+
"unique": true,
|
|
423
|
+
"nullsNotDistinct": true
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"name": "smrt_mcp_call_audits_tenant_id_created_at_idx",
|
|
427
|
+
"columns": [
|
|
428
|
+
"tenant_id",
|
|
429
|
+
"created_at"
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
],
|
|
433
|
+
"version": "e0a722bb"
|
|
434
|
+
},
|
|
435
|
+
"importPath": "@happyvertical/smrt-app-mcp/audit-store"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
7
438
|
"moduleType": "smrt",
|
|
8
439
|
"smrtDependencies": [
|
|
9
440
|
"@happyvertical/smrt-core",
|
|
10
|
-
"@happyvertical/smrt-jobs"
|
|
441
|
+
"@happyvertical/smrt-jobs",
|
|
442
|
+
"@happyvertical/smrt-tenancy"
|
|
11
443
|
],
|
|
12
444
|
"stampsConstructors": true
|
|
13
445
|
}
|
package/dist/server.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { MCPConfig, MCPResponse, MCPTool } from '@happyvertical/smrt-core/generators/mcp';
|
|
19
19
|
import { type McpTask } from '@happyvertical/smrt-jobs';
|
|
20
|
+
import { type McpAuditSink } from './audit.js';
|
|
20
21
|
import { type McpToolErrorInfo } from './errors.js';
|
|
21
22
|
import { type McpAppResource, type McpAppResourceContent, type McpAppResourceDefinition, type McpResourcePolicy } from './resources.js';
|
|
22
23
|
import { type McpToolEffect } from './tools.js';
|
|
@@ -91,6 +92,14 @@ export interface McpToolCallAuditEvent {
|
|
|
91
92
|
identity: Readonly<McpPrincipalIdentity> | null;
|
|
92
93
|
outcome: McpToolCallOutcome;
|
|
93
94
|
error?: Readonly<McpToolErrorInfo>;
|
|
95
|
+
/**
|
|
96
|
+
* Host-supplied tenant for the call ({@link CreateMcpAppServerOptions.auditTenantId},
|
|
97
|
+
* default `principal.tenantId`), or `null`.
|
|
98
|
+
*/
|
|
99
|
+
tenantId: string | null;
|
|
100
|
+
/** Sorted argument key names only; values are never reported. */
|
|
101
|
+
argumentKeys: readonly string[];
|
|
102
|
+
occurredAt: Date;
|
|
94
103
|
}
|
|
95
104
|
/** Context supplied to the optional per-tool principal policy. */
|
|
96
105
|
export interface McpToolPolicyContext {
|
|
@@ -195,6 +204,36 @@ export interface CreateMcpAppServerOptions {
|
|
|
195
204
|
* fast: a call returns after the hook settles.
|
|
196
205
|
*/
|
|
197
206
|
onToolCall?: (event: McpToolCallAuditEvent) => void | Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Persistent audit destination, written once per call with the same
|
|
209
|
+
* never-throws, awaited semantics as {@link onToolCall} (failures go to
|
|
210
|
+
* `onToolCallHookError`). Records carry argument key names only.
|
|
211
|
+
*/
|
|
212
|
+
auditSink?: McpAuditSink;
|
|
213
|
+
/**
|
|
214
|
+
* Tenant recorded for a call. Defaults to `principal.tenantId`. Must derive
|
|
215
|
+
* from the authenticated principal, never from request arguments.
|
|
216
|
+
*/
|
|
217
|
+
auditTenantId?: (context: {
|
|
218
|
+
principal: Readonly<McpAppPrincipal> | null;
|
|
219
|
+
tool: string;
|
|
220
|
+
}) => string | null | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Declarative tool authorization: glob pattern (see `matchesToolPattern`) to
|
|
223
|
+
* the scopes the principal must hold, all of them, for every matching tool.
|
|
224
|
+
* A tool lacking them is hidden from discovery and denied on call, composed
|
|
225
|
+
* (AND) with `toolPolicy` and with a workflow tool's own `requiredScopes`.
|
|
226
|
+
* An unauthenticated caller holds none, so a scoped tool is never public.
|
|
227
|
+
*/
|
|
228
|
+
toolScopes?: Readonly<Record<string, readonly string[]>>;
|
|
229
|
+
/**
|
|
230
|
+
* Glob patterns of tools that need `arguments.confirm === true`. An
|
|
231
|
+
* unconfirmed call is refused before any assertion or handler runs with a
|
|
232
|
+
* `confirm_required` error result, audited as `denied`; discovery advertises
|
|
233
|
+
* the boolean `confirm` argument. Combines with a workflow tool's own
|
|
234
|
+
* `requiresConfirm`.
|
|
235
|
+
*/
|
|
236
|
+
confirmTools?: readonly string[];
|
|
198
237
|
/** Receives (never rethrown) failures of {@link onToolCall}. */
|
|
199
238
|
onToolCallHookError?: (error: unknown) => void;
|
|
200
239
|
/**
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,OAAO,EAER,MAAM,yCAAyC,CAAC;AAKjD,OAAO,EACL,KAAK,OAAO,EAIb,MAAM,0BAA0B,CAAC;AAElC,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,OAAO,EAER,MAAM,yCAAyC,CAAC;AAKjD,OAAO,EACL,KAAK,OAAO,EAIb,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAOL,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EA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