Skip to content

Add a conventional shared layout module for server routes #312

Description

@ScriptedAlchemy

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions