Skip to content

Run plugin hooks for resource reads - #128

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

Run plugin hooks for resource reads#128
lucarlig wants to merge 5 commits into
mainfrom
user/luca/issue-6253-cpex-typed-extensions

Conversation

@lucarlig

@lucarlig lucarlig commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Resource reads now run CPEX hooks before the backend fetch and before returning its contents. Plugins can allow or deny reads, rewrite a URI to an unambiguous target in the caller's published resource routes, and transform returned text or binary content.

Result transformations may change URI, MIME type and text/blob format. Existing MCP metadata and unchanged blob wire values are preserved. CMF-only envelope and descriptive fields no longer cause blanket rejection. Text takes precedence when both text and blob are supplied, matching the built-in serializer.

The request-owned hook state preserves the selected runtime across configuration reloads. Authorization checks and errors for content that cannot be converted to MCP remain. Prompt conversion is unchanged from the base branch; this PR adds no prompt-wide payload validation.

Part of IBM/mcp-context-forge#6253 and IBM/mcp-context-forge#6254. Effective policy selection and trusted request extensions remain separate framework work.

Validation: 238 all-feature workspace tests passed, with 13 existing skips. All-feature Clippy and build, formatting, dependency/license audit, cargo shear, and wiki build/test passed. Regression coverage includes direct/aliased routes, text/blob changes, metadata preservation, pre/post denial, allowed URI rewrites, unpublished/ambiguous targets and reload consistency. Focused checks against built-in CPEX 0.1.3 and the pinned gateway serialization source confirm the modified payload behavior; this is not a full two-dataplane parity certification.

@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
@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
@lucarlig
lucarlig force-pushed the user/luca/issue-6253-cpex-typed-extensions branch from 6df91b2 to cdd1aef Compare September 4, 2026 15:23
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig force-pushed the user/luca/issue-6253-cpex-typed-extensions branch from cdd1aef to 4aff72d Compare September 4, 2026 15:26
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig lucarlig changed the title [CF-DATAPLANE][CPEX] Run resource hooks for resource reads Run plugin hooks for resource reads Sep 4, 2026
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