Skip to content

delivery

kubed-io[bot] edited this page Nov 27, 2026 · 21 revisions

Delivery

How a client says what it can take, and what the server lists for it. Material is always served: every skill, prompt and agent reads by its exact address on every request (PLUG-67, SKL-9). Three inputs choose only what is listed, which tools stand in for resources, and where the instructions point. This area covers the inputs, their defaults, the resource tools and the instructions.

Use cases

  • Claude Code's main session reads resources natively: it lists one row per skill and reads them, with no tools in the way.
  • A client that cannot read resources, a background subagent or a tools-only client, sends X-MCP-Resources: off and gets list_resources and read_resource over every resource the server has.
  • A client that wants prompts in its resource listing as well as skills sends X-MCP-Listed: skills,prompts.
  • A server that lists only its own resources for now sets its config's listed to none.
  • A client with the server's plugins installed, by a bundle or any other way, sends X-MCP-Via: local: resources/list, prompts/list, skills/list and agents/list list none of the plugins' material, so nothing arrives twice, while a stale link still reads.
  • A client that takes skills by the Skills extension, as interactive Claude Code does, sends X-MCP-Via: extension (Kb-Via, Sf-Via): skills/list lists the skills, the server's own included, resources/list leaves them out, and prompts are still listed. Under mcp and extension alike, the kb-agents hook installs the plugins' agents from agents/list, the only path for agents until Claude Code takes the agents extension.
  • Each mode lists a skill one way: mcp as a resource row, extension in skills/list, local by the installed plugin. A skill reads, and skills/get answers, in every mode. An explicit X-MCP-Listed shows a kind as rows anyway.
  • A server's instructions say one thing to a client that reads the Skills extension and another to one that does not, and point where the material is for the mode the client sent.
  • A gateway route that cannot know its client injects a default header, and a client that sends its own wins.
  • A server names its own headers once, Kb-Listed beside the shared X-MCP-Listed, and every client of every kubed-mcp server can still use the shared names.
  • A VS Code client, which reads no resources, gets the resource tools with no header sent, from kubed-mcp's table of known clients. A server that knows a client better sets that client's default itself, from its clientInfo.

Neighbours

DLV-1. What a plugin serves, and at which address, is the plugin layer's. One SKILL.md row per skill is skills's (SKL-8). The gateway prefix, and how an address is taken off and written, are the gateway's (GW-2 to GW-5); it resolves as the inputs here do (DLV-3). The bundles a local client installs are bundles'. Which defaults a gateway route injects belongs to the deployment.

The inputs

DLV-2. A request carries at most four inputs, each as a header or a query parameter of the connection's URL:

Header Query Values Default
X-MCP-Resources resources on (or true, 1, yes), off (or false, 0, no, none) on
X-MCP-Listed listed a comma-separated set of skills, prompts and agents; empty or none for none X-MCP-Via's preset, at its source (DLV-3, DLV-9)
X-MCP-Via via mcp, extension, local mcp
X-MCP-Max max a whole number of 1 or more, at most 10 digits, or all for no cap; it counts skills only (DLV-17) 100

Values are matched case-insensitively, with spaces around them ignored. Of a repeated header or parameter the first value is read. An empty value is no value, and the next source answers, except X-MCP-Listed's, which lists none.

DLV-3. Each input is resolved on its own, once per request, by walking its sources in order and stopping at the first with a value the input takes:

  1. the server's own header, <Prefix>-<Name>, when it names a prefix (DLV-16);
  2. the shared header, X-MCP-<Name>;
  3. the query parameter;
  4. the server's default for this client (DLV-14);
  5. the config's default (DLV-4);
  6. kubed-mcp's table of known clients (DLV-15);
  7. the default in DLV-2.

A server's own settings, levels 4 and 5, always beat kubed-mcp's guess at level 6. X-MCP-Via is resolved first, and the level that gives it also gives X-MCP-Listed its preset (DLV-9): an X-MCP-Listed from that level or an earlier one wins, and one from a later level does not. With no X-MCP-Via anywhere, the preset is X-MCP-Listed's default at level 7.

A header a gateway injects is a header. So that a client's own value wins, a route injects an input's header only when the request carries neither of its spellings. The gateway prefix (GW-2) resolves by the same walk, over its two headers and its query parameter; with none of them the request has no prefix. On stdio there is no header and no query, so the defaults answer. A request made inside another, a tool's read, shares the resolution of the one it is made in, and every listing, tool and read of a request reads that one resolution.

DLV-4. The built-in delivery section (DeliverySettings, CMP-4) gives each input's default: resources, listed, via and max, each a string of DLV-2's values, max also a whole number, or None for the built-in one, from DELIVERY_RESOURCES, DELIVERY_LISTED, DELIVERY_VIA and DELIVERY_MAX or the --delivery-resources, --delivery-listed, --delivery-via and --delivery-max flags. listed is a comma string of kinds, and none lists none. A value its input does not take is dropped with one warning when QuickMCP is built, naming config delivery.<attribute>, and that source gives nothing. Delivery is the partial type delivery_default answers with (DLV-14): a Protocol of the same four read-only attributes, where listed may also be a collection of kinds and max a whole number, never a bool. A whole number of more than 10 digits is not taken, and is never turned into text to be checked.

DLV-5. A value an input does not take is ignored, and the next source in DLV-3 answers: an invalid server header falls to the shared one, an invalid header to the query parameter, and so on to the default. It is logged once at warning, naming its source (header Kb-Listed, header X-MCP-Listed, query parameter listed) and the value, cut to 64 characters. Once is once per session, source and value when the request has a session, and once per source and value across the server when it has none, as on the 2026-07-28 protocol. The warnings remembered are bounded, the oldest forgotten first. Unknown kinds in X-MCP-Listed are dropped and the rest kept; a value with no kind left, other than an empty one or none, is not taken. A max of more than 10 digits, leading zeros counted, is not taken from any source.

DLV-16. QuickMCP(..., header_prefix="Kb") names the server's own headers. Every input read from a header is then read under two names, X-MCP-<Name>, the alias every kubed-mcp server answers to, and <Prefix>-<Name>:

Shared alias With header_prefix="Kb"
X-MCP-Resource-Prefix Kb-Resource-Prefix
X-MCP-Resources Kb-Resources
X-MCP-Listed Kb-Listed
X-MCP-Via Kb-Via
X-MCP-Max Kb-Max

The server's own name wins when both arrive (DLV-3), and an invalid one falls to the alias with a warning (DLV-5). A query parameter has one spelling. With no header_prefix only the X-MCP-* names are read. A header_prefix is a header-name token, letters and digits with a - only between them (Kb, Sf, My-Co), matched case-insensitively. A blank one, one with a leading or trailing - or any other character, and X-MCP itself are refused with a ValueError. A server's self-description names both spellings of each input's header (DLV-12).

Resources off

DLV-6. A server with a plugin serves two tools, list_resources() and read_resource(uri), over every resource it has, the plugins' and its own. With X-MCP-Resources: off they are in tools/list; with on they are left out of it and stay callable. Both are titled ("List resources", "Read a resource"), in their annotations too, and annotated read-only, idempotent, not destructive and closed-world.

  • list_resources returns one text content, the JSON {"resources": [...]}: the rows resources/list returns for the request, each as it is sent, less any whose URI is ui://. It lists no template.
  • read_resource returns what resources/read returns for uri, one content per content read. A content's media type is the one it declares, or one guessed from uri's extension when it declares none or application/octet-stream. Text is text. A blob is image content when it is a PNG, JPEG, GIF or WebP, with no size limit, and text when it is text/* or SVG and its bytes are UTF-8. Any other blob is a text content holding the JSON {"uri": ..., "mime_type": ..., "bytes": ..., "binary": true, "read": ...}, uri as sent, bytes its length, and read the sentence Not returned: binary content is not text., followed after a space by the server's pointer when it gives one.
  • mcp.binary_pointer(fn) sets that pointer, and returns fn: fn(uri), called with uri as sent, returns where the blob's link is listed, or None, and an empty string is none. An fn that raises, or returns anything but a string, is logged at error and gives none. A second call replaces the first.
  • read_resource refuses a ui:// address, with or without a gateway prefix before it, with the tool error <uri> is an app for a host to draw, not to read. An MCP Apps resource is for a host to draw, not for a model.
  • A miss is a tool error with the message resources/read gives for uri.
  • Behind a gateway prefix, read_resource takes its uri as resources/read takes one (GW-4). Each list_resources row's uri is written with the prefix as GW-5 writes an address, since a gateway rewrites no tool result. The rest of both results is what the request's build serves, prefixed already (GW-5), or the server's own, which is not rewritten (GW-10).

DLV-7. A server that has its own tool named list_resources or read_resource is refused at its first add_plugin, or its first serve, with a PluginError naming the tool and saying the plugin layer serves it over every resource (DLV-6). Once it has a plugin, mcp.tool refuses either name with a ValueError that says the same. A tool added past mcp.tool, through mcp.server or a provider (add_provider), is not checked.

Listing

DLV-8. resources/list shows the kinds X-MCP-Listed names, as the request resolved it (DLV-3): for skills, one row per skill (SKL-8), the plugins' and those of each catalogue the server serves with skills.serve alike; for prompts, one row per prompt, its prompts:// file; for agents, one row per agent, its agents:// file. A prompt's or agent's row is the row its folder lists it by (PLUG-68), its description and _meta included. Folders and indexes are never listed. The server's other own resources, those no plugin serves and no skills.serve catalogue holds, are always listed. prompts/list, skills/list and agents/list do not change with it: they follow X-MCP-Via (DLV-9, DLV-10). An explicit X-MCP-Listed that names a kind its X-MCP-Via lists elsewhere lists that kind twice, as the operator chose (DLV-9). resources/list's skill rows are capped as DLV-17 says.

Via

DLV-9. X-MCP-Via is a preset. It sets X-MCP-Listed's default in DLV-2, and says what prompts/list, skills/list and agents/list show. The preset ranks at the source of DLV-3 its X-MCP-Via came from, so the client's own mode wins over the server's: a client that sends X-MCP-Via: local lists none over a config that lists skills. An X-MCP-Listed from the same source or an earlier one still wins over the preset. A plugin is installed on a local client by a bundle or any other way.

Via X-MCP-Listed default prompts/list skills/list agents/list
mcp skills the plugins' and the server's own none: no plugin's, and none of the server's own the plugins'
extension none the plugins' and the server's own the plugins' and the server's own the plugins'
local none the server's own only the server's own only none of the plugins'

The Skills extension is declared in every mode, directoryRead included (SKL-20); only what the listings show follows X-MCP-Via. The mode comes from X-MCP-Via alone, never from what one request declares: a skills/list whose _meta declares the Skills extension is answered as its mode says. An X-MCP-Listed that wins over the preset (DLV-3) is honoured in every mode, even where it lists a kind twice: skills under extension, prompts or agents under mcp.

DLV-10. Hiding is unlisting, never unserving. In every mode each plugin prompt still answers prompts/get, each skill skills/get, each agent agents/get, every file resources/read and every folder resources/directory/read, all under the request's view (PLUG-54). The server's own prompts are always in prompts/list. The skills of a catalogue it serves with skills.serve are listed as the plugins' are, one way per mode: in resources/list as X-MCP-Listed says (DLV-8), and in skills/list under extension and local, never under mcp. Under mcp and extension, the kb-agents hook installs the plugins' agents from agents/list; under local, the installed plugin brings them. A skills/list that lists none of the plugins' skills, under mcp and local, builds nothing for them, so a view that fails (PLUG-53) fails no such listing.

This holds where QuickMCP resolves delivery. A catalogue served with skills.serve on a FastMCP server no QuickMCP wraps lists its skills in both resources/list and skills/list, as it always has.

Where each kind comes from

Via skills prompts agents
mcp resources/list rows, the server's own included prompts/list the kb-agents hook, from agents/list
extension skills/list, the server's own included prompts/list the kb-agents hook, from agents/list
local the installed plugin; the server's own in skills/list the installed plugin; the server's own in prompts/list the installed plugin

Agents switch the way skills do once Claude Code takes the agents extension (PLUG-27 is unchanged).

Edge cases

Case What a client sees
mcp, X-MCP-Listed none skills listed nowhere; every one reads, and skills/get answers; the instructions' _index.md finds them
mcp, a skills/list whose _meta declares Skills still mcp: no plugin's and none of the server's own skills listed
extension with an explicit X-MCP-Listed: skills skills in skills/list and as rows, both capped alike (the opt-in)
mcp with an explicit X-MCP-Listed: prompts or agents those kinds as rows and in prompts/list / agents/list (the opt-in)
the server's own skills.serve skills mcp rows; extension skills/list; local skills/list; rows anywhere an explicit X-MCP-Listed names skills
a skills.serve catalogue on a FastMCP server no QuickMCP wraps rows and skills/list both, in every request (DLV-10)
a FastMCP server with a skills.serve catalogue mounted on a QuickMCP its skills follow the QuickMCP's mode, as its own do: the request is the QuickMCP's
skills/get, resources/read, resources/directory/read under any mode answer, under the view
a legacy 2025-11-25 session resolved per request as on 2026-07-28; initialize declares Skills (SKL-22) in every mode
the cap and the handshake count the cap cuts the mode's listing; Resolved.skills counts it (DLV-11)
-p / the SDK under extension no skills listed: they never call skills/list (Known limits)
an own skills.serve key shaped <namespace>/<skill>, so its URI is a plugin skill's, under local listed in skills/list, yet skills/get answers nothing for it, and FastMCP's duplicate warning does not fire: a misconfiguration (a listing that shows none of the plugins' skills asks them for no URI, DLV-10)

The cap

DLV-17. X-MCP-Max caps how many skills a listing shows. It counts skills alone, over the whole listing and not per page, before the listing is paged, so it caps the listing's total, not each page's. It cuts the listing the request's mode lists skills in (DLV-9): the SKILL.md rows of resources/list, and so list_resources' (DLV-6), or skills/list's entries. When an explicit X-MCP-Listed shows skills in both, it cuts both by the same rule. A prompt's or an agent's row, prompts/list and agents/list are never counted or cut. Which skills it keeps is a rule, the same on every call:

  1. The server's own skills, those of each catalogue it serves with skills.serve, are never cut (DLV-8, DLV-10), and are listed wherever the mode lists skills, as SKL-23 serves them. They all count toward the cap, those skills/list withholds from a caller (SKL-23) included.
  2. The plugins' skills fill the room left, max less the server's own skills, and never less than none. They are ranked by plugin, in the order the plugins were added (PLUG-4). Within a plugin they are ranked by skills folder, in the order read, and within a folder by name (PLUG-19). A listing keeps the first that fit, so a server chooses which survive by the order it adds its plugins.
  3. When the server's own skills alone reach the cap, every one of them is listed and no plugin skill is.

A skill from any other source, a mounted server's, is neither counted nor cut. A listing shows what it keeps in its own order: skills/list sorted by URI (SKL-23).

When both listings show skills, skills/list keeps the first that fit of those it serves the caller, so one it withholds (SKL-23) gives its place to the next, and resources/list fills the same room from the build's rows: the two can differ by such a skill. Under X-MCP-Via: local, skills/list lists none of the plugins' skills (DLV-9), so none is cut there; a resources/list that lists skills anyway, by an explicit X-MCP-Listed: skills, keeps the first plugin rows that fit the same room. Past the cap every skill still answers skills/get, and every file resources/read, its folders' _index.md and _index.json, its _manifest and resources/directory/read included (DLV-10). An instructions fn gets the numbers as Resolved.skills (DLV-11), to say the list was cut and point at the rest.

Instructions

DLV-11. mcp.instructions(fn) sets the server's instructions, and returns fn. fn(delivery) is called once per initialize and once per server/discover. delivery is a kubed.mcp.delivery.Resolved, what the request resolved, with seven read-only attributes:

  • resources, "on" or "off";
  • listed, a frozenset of kinds;
  • via, "mcp", "extension" or "local";
  • prefix, the gateway prefix (GW-2), or None;
  • extensions, a frozenset of the extension ids the client declares, empty when it declares none, or None when the request does not say. On initialize it is read from the request's capabilities.extensions, and on any other request from where FastMCP's client_supports_extension reads it. Instructions key on via, not on it: no declaration chooses a mode (DLV-9);
  • max, the cap the request took (DLV-17): a whole number, or None for no cap;
  • skills, a kubed.mcp.delivery.SkillCount, a frozen dataclass of listed, how many skills the request lists, the server's own included, in the listing its mode lists skills in: under mcp the SKILL.md rows of resources/list, as X-MCP-Listed gives them, and under extension and local skills/list; and cut, how many of the plugins' skills the cap left out of that listing. A listing that shows no plugin skill (local, or mcp with X-MCP-Listed leaving out skills) cuts none, and counting it builds nothing. It is counted on initialize and server/discover for fn, from the request's build (PLUG-55) and the server's own catalogues, never from a listing, so a skill skills/list withholds from a caller (SKL-23) is still counted. Anywhere else it is None, as it is on a server that serves no skill. A count that fails is left out, never failing the handshake: a view or build that fails is logged at error once per view and error, and the request's next read fails as PLUG-53 says.

fn's string is the result's instructions, written with the prefix as served text is (GW-5) after fn returns it. A server with no fn, an fn that returns None, and an fn that raises or returns anything but a string all give the instructions the server was built with; the last two are logged at error. A second call replaces the first.

DLV-12. initialize and server/discover results carry what the request resolved, as _meta["io.kubed/delivery"]: {"resources": ..., "listed": [...], "via": ..., "prefix": ..., "max": ...}, listed in DLV-2's order (skills, prompts, agents), prefix null without one, and max the number or "all", never null, so a client or a hook can see what the server took from it. extensions is not echoed: the client sent it. Nor is skills.

Defaults per client

DLV-13. A request resolves its inputs once, at its start, and every listing, tool, prompt and instruction in it reads the same resolution.

DLV-14. mcp.delivery_default(fn) sets a per-client default, and returns fn. fn(client_info) is called once each time a request's inputs are resolved, with the client's clientInfo, an mcp_types.Implementation, or None when the request names none. It is read:

  • on initialize, from its params.clientInfo;
  • on any other request, from its _meta["io.modelcontextprotocol/clientInfo"] first, then from the session's initialize.

A lookup that fails, or a clientInfo that is not one, counts as none. fn returns a partial Delivery (DLV-4), None for any input it leaves alone, or None for all of them. Its answer is level 4 of DLV-3, and a value its input does not take, or one of a type DLV-4 does not allow it, falls through as DLV-5 says, named delivery_default <attribute>. An fn that raises, or answers with anything but a partial Delivery or None, is logged at error and gives nothing. A second call replaces the first.

DLV-15. kubed-mcp carries a table of known clients' defaults, each a partial Delivery keyed by a prefix of clientInfo.name (DLV-14's source), matched case-sensitively, so Visual Studio Code also matches Visual Studio Code - Insiders. When several rows match, the longest prefix wins. The table is level 6 of DLV-3: a server's own settings always win. It has a row only where a server needs one today:

clientInfo.name starts with Default Needed by
Visual Studio Code resources off selenium-flow: VS Code reads no resources

A client with no clientInfo matches no row.

Captured declarations

Why the table has no row for Claude Code. Claude Code 2.1.332 was captured on 2026-11-27 against an echo server that answers server/discover at 2026-07-28 and declares Skills:

Client User-Agent First request Extensions declared Calls skills/list
claude -p claude-code/2.1.332 (sdk-cli) server/discover 2026-07-28 tasks, every request never
Agent SDK spawn (VS Code, stream-json) claude-code/2.1.332 (claude-vscode, agent-sdk/0.3.332) same tasks, every request never
either, discover refused — initialize 2025-11-25 none (extensions absent) —
interactive Claude Code (VS Code) claude-code/2.1.332 (claude-vscode, agent-sdk/0.3.332) same tasks; plus skills on skills/list only yes
  • All send clientInfo claude-code / "Claude Code" / 2.1.332, roots listChanged, and elicitation form and url.
  • The interactive order is discover → prompts/list → skills/list → resources/list → tools/list. A skill's SKILL.md is read with plain resources/read, declaring tasks only. It never sends initialize, subscriptions/listen, resources/templates/list, resources/directory/read or skills/get, and it shows a skill as <server>:<skill>.
  • Its discover is byte-for-byte the SDK spawn's, and its Skills declaration rides on one request. So neither clientInfo nor a declaration chooses the mode: every client gets X-MCP-Via's default, mcp, unless it sends one.

Known limits

  • A config that interactive Claude Code shares with claude -p, the SDK or a generic subagent cannot serve both natively. With X-MCP-Via: extension there, -p lists no skills, because it never calls skills/list.
  • The recommendation: -p, the SDK and the runners use the default mcp, which works, subagents included. mcp resources reach the most clients today; extension is newer and has gaps.
  • Untested, and easier said than done: a defined subagent (an agent file with frontmatter) might carry its own MCP settings, such as another X-MCP-Via. It is for a later test, not a promise.
  • Claude Code and the MCP protocol move fast, and agentgateway 1.8 (#82) is pending. Either may change this.

Clone this wiki locally