Problem
Framework mode has no layout.tsx-style convention for a shared route wrapper. Each route must import and render the wrapper manually.
In examples/audiobook-curator, more than 15 generated MCP routes import CuratorDocument directly. This repeats framework plumbing across tools, resources, and prompts and makes it easy for a new route to omit the server's standard document structure.
The conventions table in docs/entry-conventions.md discovers individual MCP route modules, but it offers no conventional composition point around all routes for one server.
Proposal
Add a conventional per-server layout module, such as:
src/mcp/<server>/layout.tsx
The generated Flight worker would compose each route's rendered component inside that layout. The layout should receive the route children and stable route metadata while preserving the route's existing result value and protocol projection.
Projects that do not define a layout should keep today's behavior unchanged. A custom generated-server mode should be able to opt out explicitly.
Why
- Centralizes a server's shared Agent Document structure.
- Removes repetitive wrapper imports from every route.
- Makes wrapper application consistent for newly added routes.
- Keeps framework-mode composition convention-driven rather than dependent on route-by-route discipline.
Acceptance criteria
- A conventional per-server layout is discovered and compiled for generated MCP routes.
- Tools, resources, and prompts can share it without changing their protocol result shapes.
- Route-unit rendering exercises the same layout composition as generated workers.
- Existing projects without a layout remain source- and behavior-compatible.
Problem
Framework mode has no
layout.tsx-style convention for a shared route wrapper. Each route must import and render the wrapper manually.In
examples/audiobook-curator, more than 15 generated MCP routes importCuratorDocumentdirectly. This repeats framework plumbing across tools, resources, and prompts and makes it easy for a new route to omit the server's standard document structure.The conventions table in
docs/entry-conventions.mddiscovers individual MCP route modules, but it offers no conventional composition point around all routes for one server.Proposal
Add a conventional per-server layout module, such as:
The generated Flight worker would compose each route's rendered component inside that layout. The layout should receive the route children and stable route metadata while preserving the route's existing result value and protocol projection.
Projects that do not define a layout should keep today's behavior unchanged. A custom generated-server mode should be able to opt out explicitly.
Why
Acceptance criteria