Skip to content

[CF-DATAPLANE][CPEX] Run resource hooks for resource reads - #128

Open
lucarlig wants to merge 3 commits into
mainfrom
user/luca/issue-6253-cpex-typed-extensions
Open

[CF-DATAPLANE][CPEX] Run resource hooks for resource reads#128
lucarlig wants to merge 3 commits into
mainfrom
user/luca/issue-6253-cpex-typed-extensions

Conversation

@lucarlig

@lucarlig lucarlig commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What this accomplishes

This PR lets the external dataplane apply CPEX policy to the complete resources/read lifecycle.

Before a backend resource is fetched, plugins receive its canonical backend-local URI and can allow or deny the request. After the backend responds, plugins can inspect, redact, or transform both text and binary resource content before it reaches the MCP client. Context created by the pre-fetch hook is preserved for the matching post-fetch hook, even if the configured runtime is reloaded while the backend call is in flight.

The result is that resource reads receive the same policy-enforcement boundary already available to tool and prompt calls. The bundled secrets-detection plugin demonstrates this by redacting a password resource for both direct and namespaced resource URIs.

Safety behavior

  • Plugins cannot change the canonical resource route, URI, MIME type, item identity, CMF schema version, or channel.
  • MCP base64 blobs are decoded for plugin inspection and safely encoded after modification.
  • Content left unchanged by plugins is returned exactly as supplied by the backend, including metadata and the original blob representation.
  • Unsupported transformations, invalid backend blobs, and missing or corrupted post-hook lifecycle state fail closed instead of returning uninspected content.
  • Calls allocate no resource correlation state when neither resource hook is configured.

Scope

This keeps the existing global CPEX configuration version and request-local PluginContextTable behavior. Scoped plugin bindings, trusted typed extensions, catalogs, caches, and runtime revisions are intentionally excluded pending the producer contract in IBM/mcp-context-forge#6252.

Part of IBM/mcp-context-forge#6253.

Protocol-specific coverage for MCP 2026-07-28 and 2025-11-25 is isolated in stacked PR #129.

Verification

  • cargo nextest run --locked --workspace --all-features
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cargo deny check advisories bans licenses
  • cargo shear --check-test-targets --deny-warnings --locked
  • repository pre-commit suite

Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig force-pushed the user/luca/issue-6253-cpex-typed-extensions branch from 34a2c5b to e4193e9 Compare September 3, 2026 09:52
@lucarlig lucarlig changed the title [CF-DATAPLANE][CPEX] Resolve scoped bindings and typed extensions [CF-DATAPLANE][CPEX] Run resource hooks for resource reads Sep 3, 2026
@lucarlig
lucarlig marked this pull request as ready for review September 3, 2026 09:59
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig marked this pull request as draft September 3, 2026 10:23
@lucarlig
lucarlig marked this pull request as ready for review September 3, 2026 10:27
@lucarlig
lucarlig requested a review from dawid-nowak September 3, 2026 10:28
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants