Proposal

Channel faces on every routed application, one _meta segment, and the server GUI as a separate component

proposal/channels-meta-and-server-gui2026-10-28Giovanni Porcariaccepted

Problem

Three application classes expose the same router on different channels: OpenApiApplication (REST and OpenAPI), McpOpenApiApplication (REST, OpenAPI and MCP) and McpApplication (MCP only). McpOpenApiApplication is the most common base, and its name is long.

Each class reserves its own path segments inside the application: _meta and mcp. The rule for what an application may name its own routes is not written anywhere.

The server application _server extends OpenApiApplication, so it has no MCP face. A browser interface for _server is being built on gramlot. If it lives in kajenn, gramlot becomes a required dependency of the core.

Current state

readsrc/kajenn/routed_application.py:1272026-11-03
RoutedApplication is BaseApplication plus the genro-routes RoutingClass. Its execute is the single execution point that REST, MCP, WSX and the KajennBus reach.
readsrc/kajenn/applications/openapi.py:892026-11-03
OpenApiApplication attaches _meta with schema_json, docs (Swagger UI) and index.
readsrc/kajenn/applications/mcp.py:3872026-11-03
McpOpenApiApplication adds the MCP JSON-RPC face under the segment mcp (mcp_name_segment). The channel plugin decides visibility: the MCP face lists only entries declared for channel mcp, and an undeclared method is REST only.
readsrc/kajenn/applications/mcp.py:3232026-11-03
McpApplication makes the whole application one JSON-RPC endpoint over an external RoutingClass, with no REST face.
readsrc/kajenn/well_known.py:402026-11-03
A path matching WELL_KNOWN_PATTERN goes to the route the application declared for it in its class dict well_known. No segment inside the application is reserved for it.
readsrc/kajenn/server_app/server_app.py:2072026-11-03
ServerApplication extends OpenApiApplication.
readsrc/kajenn/asgi_server.py:1392026-11-03
The server mounts ServerApplication under _server when no declared application has that code.
readsrc/kajenn/server.py:5592026-11-03
After the well-known paths, the server demux picks an application by the first path segment only. A mount is always one segment.

Proposed solution

Channel faces on RoutedApplication

  • The REST/OpenAPI face and the MCP face move into RoutedApplication. Every application with routes has both, with no switch to turn them off.
  • The channel plugin keeps deciding visibility. Turning MCP on everywhere exposes nothing that is not declared for channel mcp.
  • OpenApiApplication, McpOpenApiApplication and McpApplication become deprecated aliases, then are removed. No new class name is needed.
  • BaseApplication stays for applications without routes: RemoteApplication and raw ASGI applications.

One reserved segment: _meta

Inside a RoutedApplication the only reserved segment is _meta. It holds the administrative routes of the application. Application routes are never under it: a route pippo is reached as /<app>/pippo over REST and as tool pippo over MCP.

_meta layout
PathContentToday
_meta/indexApplication page with links to the channel descriptions_meta/index
_meta/openapi/schema_jsonOpenAPI 3.1 document_meta/schema_json
_meta/openapi/docsSwagger UI_meta/docs
POST _meta/mcpMCP JSON-RPC entrymcp
GET _meta/mcp/toolsList of the MCP tools, readable without speaking MCPnone

The names mcp and api become free for application routes.

Discovery documents are not under _meta: an application declares its well-known URLs in a class dict, and the _well_known branch was removed (well-known-urls, 2026-11-02).

SpaConsole in kajenn-orchestra

SpaConsoleMcpApplication becomes a RoutedApplication. The routes of SpaConsole are declared for channel mcp, so the REST face refuses them. Its MCP client moves from /<mount>/ to /<mount>/_meta/mcp.

Server application: API in kajenn, GUI in its own repository

  • ServerApplication stays in kajenn and serves REST and MCP only. It gains MCP by inheriting from RoutedApplication. kajenn does not depend on gramlot.
  • The GUI is a component in the repository kajenn-serverapp-gui, which depends on kajenn and gramlot.
  • The recipe enables it on the server element: gui(gui_class=...). Without the element there is no GUI. The core never names the GUI package.
  • ServerApplication builds the component as gui_class(self) (dual relationship) and passes every request on ui/... to it. The component releases its resources in on_shutdown. The URL is /_server/ui/.
  • The GUI reads and writes only through the REST routes of _server, like any other client.

Extension pages

  • The REST routes of an extension keep using attach_section(section, name) of the core.
  • The GUI pages of an extension register on the GUI component, only when the component exists. ServerApplication exposes the component, or None.
  • gramlot is an optional extra of the extension, for example kajenn-orchestra[gui].
  • Pages generated from the OpenAPI description of each section are a future direction. They are not designed here.

Decisions

decidedd-faces
Where do the REST/OpenAPI and MCP faces live?
  1. In RoutedApplication, always on
  2. In dedicated subclasses, as today
Choice: In RoutedApplication, always on (GP, 2026-10-28)
Every routed application answers network calls on every channel; visibility stays with the channel plugin.
decidedd-switch
Can an application turn the faces off?
  1. No
  2. Yes, with a flag
Choice: No (GP, 2026-10-28)
A schema lists only routes already exposed; a switch would be code without a verified use.
decidedd-segment
Which segments does the kernel reserve inside an application?
  1. Every segment starting with an underscore
  2. The bare segment _
  3. _meta only
Choice: _meta only (GP, 2026-10-28)
One segment for every administrative route; reserving every underscore name takes too much from the application.
decidedd-mcpapp
Does McpApplication stay?
  1. Deprecated, then removed
  2. Kept
Choice: Deprecated, then removed (GP, 2026-10-28)
A RoutedApplication with routes declared for channel mcp gives the same result.
decidedd-gui-switch
How does a recipe enable the server GUI?
  1. Optional import of the GUI package
  2. app_class on the _server application
  3. A boolean flag on the server
  4. A gui element on the server naming the class
Choice: A gui element on the server naming the class (GP, 2026-10-28)
The recipe names the class; the core holds neither a dependency nor the name of the GUI package.
decidedd-gui-shape
What is the class named by gui?
  1. A composed server application replacing _server
  2. A component built by ServerApplication and called for ui/...
Choice: A component built by ServerApplication and called for ui/... (GP, 2026-10-28)
It works with any _server class and needs no mixin.
decidedd-ext-pages
How do extensions add GUI pages?
  1. Register on the GUI component when present
  2. A separate GUI package per extension
  3. Pages generated from the REST description
Choice: Register on the GUI component when present (GP, 2026-10-28)
Generated pages remain the direction for later.
decidedd-gui-name
What is the attribute of the gui element called?
  1. gui_class

    class is a Python keyword; other elements use app_class and handler_class.

Choice: gui_class (GP, 2026-11-03)
The same shape as app_class and handler_class.

Consequences