AI

AgentOps: validate MCP resource subscriptions before trusting live context

A production runbook for qualifying MCP resource notifications, proving transport persistence, detecting missed updates, and deciding promotion, authoritative-read fallback or rollback.

30 Oct 2026 aiagentopsmcpresourcessubscriptionsnotificationscontextobservabilityevaluationguardrailsautomationrunbookrollbackproduction

An operations agent reads the MCP resource deploy://payments/status to follow a deployment. The server announces an update, the client refreshes context, and the agent concludes that the release is ready for traffic. On a later deployment, no notification arrives. The agent keeps the previous state and proposes a decision from stale data.

A resource notification is not proof of freshness. It says that another read may return a new state; it does not replace an authoritative read, a business version, or recovery after disconnection. The running case qualifies this chain before an agent can use a watched resource to authorize promotion, prepare an action, or close an incident.

Contain the decision before testing delivery

Return write actions to draft mode or mandatory approval. Pin the client, server, negotiated protocol revision, and actual transport. Preserve one trace where the resource is read, changed, and read again; a test that stops after subscription acceptance proves no delivery.

yaml 01-resource-subscription-incident.yml
incident: INC-AI-904
agent_release: ops-agent-2026.10.30-2
server: release-mcp
server_version: 5.2.1
protocol_revision: "2026-07-28"
transport: streamable-http
resource_uri: deploy://payments/status
last_observed_version: 1842
current_backend_version: 1844
last_notification_at: 2026-10-30T16:41:12Z
containment:
production_writes: approval_always
live_context_badge: disabled
authoritative_read_before_decision: required
evidence:
- negotiated_capabilities
- subscription_acknowledgement
- transport_lifecycle
- resource_read_versions
- notification_trace

The first objective is not restoring a “live” indicator. It is preventing absence of signal from being interpreted as absence of change.

Separate catalog, content, and decision

MCP exposes two different changes. A notifications/resources/list_changed notification means the catalog changed: a resource was added or removed, or its metadata changed. A notifications/resources/updated notification targets the content of an already known URI. Confusing them can make a client relist the whole catalog for every event or never discover a new resource.

In both cases, keep the notification as an invalidation signal. When it arrives, the client rereads the resource, validates its type, and ties the value to a version. The agent must not treat notification text as business state.

text 02-notification-contract.txt
CATALOG CHANGE
Signal: notifications/resources/list_changed
Client action: relist, diff URIs and metadata, then apply allowlist

RESOURCE CONTENT CHANGE
Signal: notifications/resources/updated for one URI
Client action: reread that URI, validate content and compare version

PRODUCTION DECISION
Required evidence: authoritative read + monotonic version + freshness budget
Never sufficient: connection open, subscription accepted, notification received

Put a stable identifier, monotonic version or ETag, source observation time, and explicit business phase in the resource. Client receipt time measures transport latency, not backend freshness.

Qualify the protocol revision and transport

The subscription contract depends on the negotiated revision. On 2025 revisions, the server advertises resources.subscribe, the client calls resources/subscribe for one URI, and the connection holds that state until unsubscribe or closure. On revision 2026-07-28, the client opens subscriptions/listen with URIs in resourceSubscriptions; the server acknowledges the accepted subset and delivers notifications on that stream.

Do not mix both contracts in one test. Archive the negotiated revision and the filter actually accepted. A setup that works over persistent stdio may fail behind a stateless HTTP handler: subscription succeeds, but the instance that held the URI disappears before the update.

yaml 03-protocol-validation-matrix.yml
cases:
- protocol: "2025-11-25"
  subscribe: resources/subscribe
  required_lifecycle: persistent_connection
  prove:
    - subscription_state_bound_to_connection
    - unsubscribe_stops_delivery

- protocol: "2026-07-28"
  subscribe: subscriptions/listen
  filter:
    resourceSubscriptions:
      - deploy://payments/status
  prove:
    - acknowledged_filter_contains_uri
    - stream_remains_open
    - reconnect_opens_new_listener

reject:
  - capability_not_advertised
  - uri_not_authorized
  - unsupported_protocol_method
  - notification_on_unsubscribed_uri

In a multi-instance server, the connection listening for updates may not belong to the instance that observes the change. Carry the signal through a shared event bus or equivalent mechanism. An in-memory subscriber set is insufficient when the load balancer sends the write elsewhere.

Prove one update end to end

Build a canary with no production action. It reads version 1842, opens the correct subscription, changes a test source to 1843, receives the signal, then rereads the URI. Success requires the reread content to carry 1843 and a state consistent with the source.

json 04-versioned-resource.json
{
"uri": "deploy://payments/status",
"deploymentId": "dep-payments-1843",
"version": 1843,
"phase": "validated",
"sourceObservedAt": "2026-10-30T16:47:03Z",
"generatedAt": "2026-10-30T16:47:04Z",
"expiresAt": "2026-10-30T16:49:04Z",
"evidence": {
  "healthProbe": "passed",
  "errorBudgetGate": "passed"
}
}

Correlate every step with connection ID, subscription ID, URI, previous and new version, then source, publication, receipt, and reread timestamps. Do not log sensitive resource contents. Metadata should be enough to calculate latency, duplicates, and version gaps.

Also test two concurrent clients: one subscribed and one not. The first must receive the signal; the second must neither receive the targeted notification nor read the resource without authorization. Cross-connection delivery reveals incorrectly shared subscription state.

Handle duplicates, loss, and reconnection

A notification may be repeated, coalesced, or lost during an outage. Make the handler idempotent: several signals for one version produce one logical update. Conversely, moving from 1842 to 1844 must trigger a reread and flag the gap, not fabricate state 1843.

After reconnection, do not assume the server remembers the client. Reopen the subscription for the negotiated revision, immediately reread the resource, and compare its version with the last persisted value. Bounded polling remains a useful safety net for resources that drive sensitive decisions.

yaml 05-client-freshness-policy.yml
freshness_policy:
on_notification:
  - enqueue_uri_once
  - authoritative_read
  - validate_schema
  - require_version_greater_or_equal
on_reconnect:
  - renegotiate_protocol
  - recreate_subscription
  - immediate_authoritative_read
periodic_reconciliation:
  interval_seconds: 60
  jitter_seconds: 10
decision_gate:
  max_source_age_seconds: 120
  require_monotonic_version: true
  block_on_missing_version: true
  block_on_expired_resource: true

Reconciliation polling must not hide a broken stream. Expose expected notification rate, delivery latency, reconnects, rejected filters, version gaps, and catch-up reads as separate signals.

Evaluate promotion, fallback, and rollback

The evaluation set must cover the happy path and failure modes: allowed and denied URI, catalog change, two rapid updates, duplicated notification, disconnect before delivery, reconnection, different server instance, regressing version, expired resource, and a client that does not support the proposed revision.

yaml 06-promotion-gates.yml
promote:
require:
  - protocol_and_capabilities_recorded
  - accepted_filter_matches_requested_uris
  - end_to_end_update_reread_passes
  - connection_isolation_passes
  - reconnect_reconciliation_passes
  - duplicate_and_gap_handling_passes
  - stale_resource_blocks_production_decision

fallback:
- stop_claiming_live_context
- read_authoritatively_before_each_decision
- enable_bounded_reconciliation_polling
- keep_writes_on_human_approval

rollback:
- restore_previous_server_and_client_pair
- close_incompatible_listeners
- invalidate_cached_resource_versions
- replay_canary_without_production_writes

Promote subscriptions only when the canary proves the complete chain on the production transport. If delivery remains uncertain but reads are reliable, keep the authoritative-read fallback and remove any real-time promise. Roll back the client-server pair when the revision or transport breaks the contract.

Conclusion

An MCP resource subscription speeds up context invalidation; it does not turn a resource into real-time truth. Useful evidence connects negotiated capability, persistent stream, accepted URI, notification, authoritative reread, version, and freshness budget.

The decision is explicit: promote when loss, duplicates, and reconnections are controlled; stay on bounded reads when the signal is uncertain; or roll back the client-server pair if the protocol contract cannot be proved. No production action should depend on the silence of a notification stream alone.