Skip to content

mcp-test-v1.1.1

Choose a tag to compare

@github-actions github-actions released this 06 May 02:36
· 24 commits to main since this release
b820563

Highlights

This release closes two subtasks from the audit-inspection roadmap (#8): the notification recorder and the PR #5 review-fix cleanup. Together with the bundled hardening they make the full request/response capture pipeline production-ready.

What you get:

  • Server-initiated notifications now land in audit_payloads.notifications. Every notifications/progress, notifications/message, and any future notifications/* your tools dispatch via req.Session.NotifyProgress / LogMessage is captured during the call window and stored alongside the request and response. The portal will surface these in the upcoming inspection drawer; today they're queryable directly via GET /api/v1/portal/audit/events/{id}.
  • Redaction extended to notifications. audit.redact_keys now applies to notification params, not just tool params. A tool that emits a token in a progress message no longer bypasses the operator's redact list.
  • Notifications are byte-bounded. A LogMessage with a large data blob can't blow past audit.max_payload_bytes; the captured slice is trimmed from the tail with notifications_truncated set so operators can tell.
  • Content annotations preserved. audit_payloads.response_result.content[] round-trips image, audio, embedded resource, and resource-link blocks through their SDK MarshalJSON, so annotations on those blocks survive into the captured payload (previously they were dropped to {type: unknown}).
  • error_category is consistent. The indexed audit_events.error_category and the detail row's response_error.category now always agree across auth, tool, and handler errors. The portal can filter on the indexed column without string-matching against the message.
  • CI tooling pinned in make verify. Local lint and security checks now install and use the exact versions CI runs (golangci-lint v2.11.4, gosec v2.25.0) into bin/tools/ instead of relying on $PATH. A pre-merge make verify will no longer green-light something that fails CI minutes later.

Breaking changes

None at the API or wire level. The schema cleanup migration drops three columns (jsonrpc_id, request_method, request_path) that the audit middleware never populated since v1.1.0; if you had ad-hoc tooling reading those, they were always empty.

Schema migration

A new migration 0003_audit_payloads_cleanup runs on first start after upgrade. It:

  • DROP COLUMN IF EXISTS jsonrpc_id
  • DROP COLUMN IF EXISTS request_method
  • DROP COLUMN IF EXISTS request_path
  • ADD COLUMN IF NOT EXISTS notifications_truncated BOOLEAN NOT NULL DEFAULT false

Migration 0002 was deliberately not edited in place; v1.1.0 operators get the same final shape via 0003, greenfield installs apply 0001 + 0002 (v1.1.0 schema) + 0003 and converge there.

Configuration

No required changes. Two existing knobs got new effective scope:

Setting Default Notes
audit.capture_payloads true (when unset) Enables the sibling audit_payloads row, including the new notifications array. Set to false to keep summary-only behavior.
audit.max_payload_bytes 65536 Now also bounds the notifications slice as a unit, in addition to request / response sides.
audit.max_notifications 100 Existing knob; per-call count cap on the recorder.
audit.redact_keys [] Substrings (case-insensitive) of param keys to redact. Now applies to notification params too.

What changed

pkg/mcpmw

  • New mcpmw.Notifications() sending-side middleware. Wired alongside mcpmw.Audit(...) at server boot via srv.AddSendingMiddleware(...). Records every notifications/* method dispatched while a tool-call window is open into a per-request recorder seeded by the receiving Audit middleware.
  • notificationRecorder is concurrency-safe; tools that fan out goroutines and call NotifyProgress from each can do so without external synchronization. JSON marshal and redaction run outside the recorder mutex so concurrent calls don't serialize.
  • The recorder applies redactKeys at append time. Once the tool-call window closes, the snapshot is taken; goroutines that fire later are silently dropped from that snapshot (this is documented and tested).
  • Payload assembly trims notifications from the tail with a single linear pass to fit max_payload_bytes; audit_payloads.notifications_truncated flags the trim.
  • error_category is assigned once after the call returns, so ev.ErrorCategory and payload.response_error.category are always equal. Auth-failure category propagates to both fields.

pkg/audit

  • audit.Notification struct: {ts, method, params}.
  • audit.Payload gains Notifications []Notification and NotificationsTruncated bool.
  • audit.SanitizeParameters short-circuits when redactKeys is empty (returns the input map without a deep copy). Hot-path optimization that affects every audit row.

pkg/httpsrv

  • GET /api/v1/portal/audit/events/{id} validates the id as a UUID at the boundary. Anything else returns 400, blocking the gosec G706 (log injection) flow on the soft-fail WARN log if the payload fetch errors.

CI / verify

  • Makefile: new tools-install target installs golangci-lint v2.11.4 and gosec v2.25.0 into bin/tools/ with a version-stamped sentinel for idempotent reinstalls. lint, gosec, govulncheck use bin/tools/<binary> instead of whatever which finds first.
  • tools-check shows resolved tool versions instead of just confirming presence.

Tests added

  • pkg/mcpmw/notifications_test.go: recorder concurrency, count cap, redact-keys propagation, post-snapshot append behavior, sending middleware wiring.
  • pkg/mcpmw/audit_payload_test.go: end-to-end notification capture; byte cap trimming with NotificationsTruncated assertion; redact-keys end-to-end; handler-error category consistency between event and payload; auth-failure category.
  • pkg/audit/postgres/store_test.go: testcontainer-backed Postgres store roundtrip exercising every captured column including NotificationsTruncated; cascade delete of payload row when the parent event is deleted.
  • tests/audit_notifications_test.go: full HTTP-stack integration test that calls the streaming progress tool with a ProgressToken and asserts the resulting audit row carries the notifications. Locks the SDK contract that Server.AddSendingMiddleware fires on ServerSession.NotifyProgress.

Upgrade

docker pull ghcr.io/plexara/mcp-test:v1.1.1

The 0003_audit_payloads_cleanup migration runs automatically on start. No restart-time downtime expected; the migration only touches audit_payloads, not the indexed audit_events summary table.

Roadmap

Remaining subtasks from #8 will land in subsequent releases:

  • Replay endpoint (POST /audit/events/{id}/replay)
  • SSE live tail (GET /audit/stream)
  • JSONB path filter compiler (?param.<path>=..., ?has=...)
  • NDJSON export
  • Portal UI inspection drawer (Overview / Request / Response / Notifications tabs)
  • Side-by-side comparison page
  • docs/operations/inspection.md walkthrough

Changelog

Features

  • 153f924: feat(audit): capture server-initiated notifications in payloads (@cjimti)

Bug Fixes

Installation

Container

docker pull ghcr.io/plexara/mcp-test:v1.1.1

Binary (macOS / Linux)

curl -L -o mcp-test.tar.gz \
  https://github.com/plexara/mcp-test/releases/download/v1.1.1/mcp-test_1.1.1_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz
tar -xzf mcp-test.tar.gz
./mcp-test --version

Documentation

Full docs at https://mcp-test.plexara.io.

Open source by Plexara, the commercial MCP server with configurable enrichment built in.