[TT-16823] Filter MCP discovery with OAS middleware rules#8246
Conversation
|
This PR introduces filtering for Model Context Protocol (MCP) discovery responses based on rules defined in the OpenAPI Specification (OAS), ensuring clients only discover primitives (tools, prompts, resources) they are permitted to access. Files Changed AnalysisThe changes are concentrated in the
Architecture & Impact AssessmentWhat this PR accomplishesThis PR rectifies an inconsistency where MCP discovery endpoints ( Key technical changes introduced
Affected system components
Flow DiagramsequenceDiagram
participant Client
participant Gateway
participant Upstream
Client->>Gateway: POST /mcp (e.g., tools/list)
Gateway->>Upstream: POST /mcp (e.g., tools/list)
Upstream-->>Gateway: 200 OK (Full list of tools)
activate Gateway
Note right of Gateway: Intercept response
Gateway->>Gateway: 1. Extract Session/Policy rules
Gateway->>Gateway: 2. Extract OAS Middleware rules
Gateway->>Gateway: 3. Compose rule sets (AND for allow, OR for block)
Gateway->>Gateway: 4. Filter response body using composed rules
deactivate Gateway
Gateway-->>Client: 200 OK (Filtered list of tools)
Scope Discovery & Context ExpansionThis change establishes a new pattern for access control where rules can be defined statically on the API specification, empowering API designers to enforce fine-grained access directly within their OpenAPI definitions. This reduces reliance on separate, dynamic policy configurations for static rules.
Metadata
Powered by Visor from Probelabs Last updated: 2026-05-27T10:50:47.116Z | Triggered by: pr_updated | Commit: 0ab181e 💡 TIP: You can chat with Visor using |
Security Issues (2)
Security Issues (2)
Performance Issues (3)
Quality Issues (1)
Powered by Visor from Probelabs Last updated: 2026-05-27T10:50:12.447Z | Triggered by: pr_updated | Commit: 0ab181e 💡 TIP: You can chat with Visor using |
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |
|



Summary
Root Cause
MCP primitive invocation rules were enforced for tools/call, resources/read, and prompts/get, but discovery responses only considered session MCPAccessRights and ignored OAS middleware rules. As a result, tools/list could advertise primitives that tools/call later denied.
Validation
Ticket Details
TT-16823
Generated at: 2026-05-27 10:48:54