Skip to content
kubed-io[bot] edited this page Nov 26, 2026 · 11 revisions

Facade

The FastMCP and MCP SDK names a server imports, re-exported from kubed.mcp so a server imports neither directly, and the one reader of a request's query and headers. This area covers kubed/mcp/__init__.py, protocol.py, auth.py and request.py, and the names kubed.mcp.skills re-exports.

Use cases

  • A tool module imports QuickMCP, Inject, Context, ToolResult and the errors from kubed.mcp, and nothing from fastmcp.
  • A server's protocol code, its extensions, providers and error replies, imports from kubed.mcp.protocol.
  • A server's HTTP auth imports its verifiers from kubed.mcp.auth.
  • A server reads its per-request settings, a library or a workspace, out of request_values(), the same way on a live request and in a background task's worker.

Neighbours

FAC-1. QuickMCP is the app's, Delivery is delivery's (DLV-4), TelemetrySettings is the telemetry area's, Component, ServingSettings and DeliverySettings are components' (CMP), Config, Field, NoDecode, Source, config and config_schema are config's (CFG), and Inject, lookup and Depends's use are the container's. The FastMCP range the names are checked against is the package's (PKG-9). What each server reads out of request_values() belongs to that server.

The modules

FAC-2. Five modules, each with an explicit __all__:

Module __all__
kubed.mcp QuickMCP, Component, Config, Field, NoDecode, Source, config, config_schema, ServingSettings, DeliverySettings, Delivery, TelemetrySettings, Inject, lookup, Depends, Context, ToolResult, Image, TextContent, Middleware, ToolError, NotFoundError, ResourceError, PromptError, ValidationError, FastMCPError, Resource, TextResource, ResourceResult, ResourceContent, ResourceTemplate, Prompt, PromptArgument
kubed.mcp.protocol AdvertiseLegacyExtensions (skills, SKL-22), ServerExtension, MethodBinding, Provider, Tool, PromptsAsTools, VersionSpec, MCPError, PARSE_ERROR, INVALID_REQUEST, METHOD_NOT_FOUND, INVALID_PARAMS, INTERNAL_ERROR, RequestParams, PaginatedRequestParams, client_supports_extension, MODERN_PROTOCOL_VERSIONS, AppConfig, ResourceCSP, UI_EXTENSION_ID, ToolAnnotations, PromptReference, ResourceTemplateReference, InputRequiredPromptResult, TaskConfig, TasksExtension, types
kubed.mcp.auth AuthProvider, TokenVerifier, JWTVerifier, MultiAuth, AccessToken, get_access_token
kubed.mcp.request request_values, Values, get_context, get_http_request
kubed.mcp.skills Skill, and the serving rules of skills: EntryOnlySkillProvider, SkillsExtension, NameTheIndex, FolderNotFound, Folders, load_skill, without_reserved, serve

FAC-3. A re-export is the same object as FastMCP's or the SDK's, so isinstance and pydantic keep working. Its repr and a traceback still name the module it came from.

FAC-4. kubed.mcp.protocol.types is the MCP SDK's mcp_types module, whole, for the wire types the table does not name.

FAC-5. No name FastMCP deprecates is re-exported. A test imports every name in every __all__ with DeprecationWarning as an error, and checks each re-export is the original object.

FAC-6. Every name needs only the base install except TasksExtension, which needs the tasks extra. Without it, importing TasksExtension raises an ImportError naming the extra, and the rest of kubed.mcp.protocol imports as usual.

FAC-7. kubed.mcp.skills re-exports one FastMCP name, Skill, the snapshot a catalogue holds; its other names are this package's own building blocks for the plugin layer (skills). No other fastmcp.skills name is re-exported: FastMCP's providers and results stay behind them.

Reading a request

FAC-8. request_values() returns (query parameters, headers) for the current request: two dicts of lists, because a repeated name is how a client says "any of these". Header names are lowercased; query parameter names keep their case. Off HTTP, as on stdio, it returns None.

FAC-9. Off a live request, a background task's worker still has the headers FastMCP snapshotted when the task was submitted, every header included. request_values() returns those with no query parameters, after passing them through snapshot when the caller gives one, so a server can rewrite what a worker must not trust.

FAC-10. request_values(request) reads a given Starlette Request, such as a custom route's, by the rules of FAC-8: lists, lowercased header names. It needs no live MCP request. snapshot does not apply to a given request, which has its own headers; it is for FAC-9's worker alone.

Importing

FAC-11. kubed.mcp resolves every name in its __all__ but Component, Config, DeliverySettings, Field, LoadedConfig, NoDecode, ServingSettings, Source, TelemetrySettings, config, config_schema and load_config on first use. Importing kubed.mcp, kubed.mcp.telemetry or kubed.mcp.components, importing any of those names, writing config_schema(...) or calling load_config(...), imports no FastMCP or MCP SDK module, so a server's config layer can declare its sections and components and write their schema without loading FastMCP. The first FastMCP-backed name a caller uses imports it. __all__ and dir(kubed.mcp) name every export as before, each the same object (FAC-3), and an unknown name raises AttributeError as in any module. A submodule such as kubed.mcp.protocol is reached by importing it. At module level, kubed.mcp.components imports only pydantic and the standard library, kubed.mcp.telemetry those and the config module, and the built-ins' module those, the config module, kubed.mcp.components and kubed.mcp.telemetry. The config module imports only pydantic, PyYAML, the standard library and kubed.mcp.components.

Clone this wiki locally