@abgov/adsp-sdk-mcp-server 1.17.0 → 1.18.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.
@@ -327,6 +327,37 @@ A Core caller with the role can select a tenant via
327
327
  reads Core catalogs only. The service registers this role for tenant provisioning; existing tenants
328
328
  still need their normal role provisioning/assignment process.
329
329
 
330
+ ### Listing every catalog
331
+
332
+ ```http
333
+ GET /audit/v1/actions
334
+ Authorization: ****** with audit-reader>
335
+ ```
336
+
337
+ Returns `[{ "application", "core", "actions": [...] }]`, one entry per registered `actions-<application>`
338
+ catalog, sorted by application. Each entry is the same effective (tenant plus Core) catalog that
339
+ `GET /audit/v1/{namespace}/actions` returns; `core` is true when the catalog is shared from Core. The
340
+ service finds the catalogs by listing the `audit-service` configuration namespace with its own service
341
+ account, so a caller does not need configuration-service access. Status codes and tenant selection
342
+ follow the single-application listing; `503` is also returned when the catalog listing fails.
343
+
344
+ ### Reading configured retention
345
+
346
+ ```http
347
+ GET /audit/v1/retention
348
+ Authorization: ****** with audit-reader>
349
+ ```
350
+
351
+ Returns `{ "tenant": { "<class>": { "days": n } }, "applications": { "<application>": { "<class>": { "days": n } } } }`,
352
+ the retention periods that are **configured** for the resolved tenant. It does not include the built-in
353
+ defaults (standard 90, security 365, compliance 365 days), so a class absent from the response uses its
354
+ default. `tenant` holds `audit-service:retention`; `applications` holds `audit-service:retention-<application>`
355
+ for each application with a catalog, omitting applications with no overrides. Periods are resolved the way
356
+ writes resolve them (active configuration revision, with Core settings merged) and are checked against
357
+ `RETENTION_MIN_DAYS` and `RETENTION_MAX_DAYS`, so the response matches what is enforced. Without a tenant
358
+ context the response is empty. `403` is returned without `audit-reader`, and `503` when the settings cannot
359
+ be resolved or fall outside the bounds.
360
+
330
361
  The catalog governs future write classification, not history access. Removing a definition performs
331
362
  no audit-record deletion. History endpoints query PostgreSQL independently of the catalog, so
332
363
  removing an action does not prevent reading its existing records.
@@ -456,9 +487,41 @@ the reads themselves.
456
487
  Responses retain the existing camelCase event shape and never expose `tenant_id`.
457
488
  Database read failures return 503 rather than an empty result or a false 404.
458
489
 
490
+ ### Listing namespaces
491
+
492
+ `GET /audit/v1/namespaces` returns `{ "results": ["form-service", ...] }`: the distinct namespaces that have
493
+ events for the tenant. It requires `audit-reader`. Clients use it to populate namespace pickers, since a
494
+ namespace's catalog may not be visible to the tenant (for example core services).
495
+
496
+ ### Exporting events
497
+
498
+ `GET /audit/v1/events/export` and `GET /audit/v1/{namespace}/events/export` stream the matching events as CSV
499
+ (`text/csv`, sent as an attachment). They require `audit-reader` and accept the same filters as the lists;
500
+ `top` and `after` are ignored. Events are read in keyset pages of 1,000 and written as they are read, so the
501
+ export is not capped, is not held in memory, and stops if the client disconnects. A failure after the first
502
+ page breaks the connection, so a truncated file is not mistaken for a complete one, and the export is recorded
503
+ with a `failure` status and the number of events written so far. The `id` column is the stored event ID that the UI
504
+ and the event endpoint use; `eventId` is the ID the submitting service supplied.
505
+
506
+ The `actorName` and `actorEmail` columns are included only when the caller also holds `audit-admin`; for other
507
+ callers the columns are omitted. This is decided on the server from the caller's token (design §1.5). Values that
508
+ begin with `=`, `+`, `-` or `@` are prefixed with a single quote so spreadsheets do not evaluate them. Each export
509
+ is recorded as an `events.export` event with the filters and the number of events written.
510
+
459
511
  See the [submission contract](https://github.com/GovAlta/adsp-monorepo/blob/main/apps/audit-service/README.md#submission-contract-osp-707--osp-708)
460
512
  for the boundary with OSP-708.
461
513
 
514
+ ## Examples and administration UI
515
+
516
+ - **Sandbox** (`apps/sandbox-app`, Audit page): tabs to browse events, view the action catalog,
517
+ write an event, and list failed events against a live tenant.
518
+ - **Tenant management webapp** (Admin > Services > Audit, `audit` feature flag): Overview, Logs,
519
+ Catalogs and Retention tabs. Catalogs and retention both come from the audit service (`/audit/v1/actions`
520
+ and `/audit/v1/retention`), so they show the active configuration as enforced. Logs filters by namespace, action, actor, resource, scope,
521
+ status, category, severity, correlation and session IDs, and time range, shows formatted event details, and exports the
522
+ current search to CSV through the [export endpoint](#exporting-events), so the file is not capped and actor name and
523
+ email are included only for `audit-admin` users (design §1.5). Each page is itself a recorded read.
524
+
462
525
  ## Write buffer
463
526
 
464
527
  The router submits enriched events through
@@ -704,13 +767,13 @@ registered by the service at startup in core configuration, alongside `failed-ev
704
767
  applies to every tenant. If registration has not propagated yet, reads still succeed but recording
705
768
  fails and is counted.
706
769
 
707
- | Action | Category | Recorded when |
708
- | -------------------- | ------------- | ----------------------------------- |
709
- | `events.list` | `data-access` | A namespace listing succeeds. |
710
- | `events.list-all` | `data-access` | A cross-namespace listing succeeds. |
711
- | `events.read` | `data-access` | A single event read succeeds. |
712
- | `failed-events.list` | `data-access` | A failed-events listing succeeds. |
713
-
770
+ | Action | Category | Recorded when |
771
+ | -------------------- | ------------- | --------------------------------------------- |
772
+ | `events.list` | `data-access` | A namespace listing succeeds. |
773
+ | `events.list-all` | `data-access` | A cross-namespace listing succeeds. |
774
+ | `events.read` | `data-access` | A single event read succeeds. |
775
+ | `events.export` | `data-access` | An export finishes or the client disconnects. |
776
+ | `failed-events.list` | `data-access` | A failed-events listing succeeds. |
714
777
  Reads use the `security` retention class (365 days by default). Replay is recorded
715
778
  transactionally by the replay itself (see above), not by this mechanism.
716
779
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/adsp-sdk-mcp-server",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - MCP server for ADSP documentation and Node SDK reference lookup.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",