[Task] Add authorized local and remote MCP prompts aggregation
Background
Parent #7949. This task is a lower-priority MCP capability and can proceed independently after its catalog and security dependencies. MCP prompts provide client-facing templates and need their own list and get authorization and bounded aggregation contract.
Existing capabilities and reuse
Reuse Agent Gateway tools catalog snapshots, remote connection and credential lifecycle, trusted identity and list and execution authorization patterns. Existing tools-only behavior remains compatible. Existing resources PR #7669 is separate prior work, not a prerequisite or a replacement for prompts.
Implementation scope
- Add local and remote
prompts/listandprompts/getwith deterministic naming and conflict handling, correct routing and argument validation. Document naming before implementation; do not silently change existing tools names. - Enforce consistent list visibility and get authorization with deny precedence and tenant isolation; use trusted capability grants rather than treating tool access as prompt access.
- Implement capability advertisement, pagination and directory-change handling only as required by the selected supported protocol; preserve coherent snapshots under refresh and removal.
- Bound discovery and result sizes, concurrency and cancellation; reuse target-bound credentials and #7952 recovery rather than new transport infrastructure.
Non-goals
Automatic prompt-injection protection, implicit authorization to execute tools described by a prompt, full MCP protocol completion, resources subscriptions or templates, or unconditional SDK migration.
Acceptance criteria
- [ ] A documented real MCP client can list and get both local and remote prompts through the gateway with deterministic routing.
- [ ] Unauthorized prompts are neither listed nor retrievable; removed or revoked definitions cannot reappear through stale snapshots.
- [ ] Argument errors, pagination, naming conflicts, unsupported capabilities, bounded responses, timeout and cancellation have explicit protocol-consistent behavior.
- [ ] Existing tools and legacy MCP Server paths remain compatible and credentials or content do not leak into logs.
Tests
Parser, handler, catalog and provider tests; actual client-to-gateway-to-MCP-server list and get fixtures; multiple servers with name collisions, pagination and changing definitions; tenant and grant isolation and revoke or refresh races; error, cancel, oversize and tools-coexistence regressions.
Dependencies
Completed protocol and trusted-identity contracts, #7951 and #7952. SDK migration becomes a prerequisite only if this selected protocol or client path demonstrates a genuine compatibility or maintenance trigger; otherwise reuse the current stack. Additional resources capability is not a prerequisite.
/assign