Topic 4 of 4 · 5 min read
Extension negotiation and graceful fallback
Goal: Write the capability check and fallback for a server that uses an extension so it still works in hosts without it.
An extension is optional: use it only when the client declared it, and make sure the server still does its job when the client did not. Extensions are opt-in on both sides.
Check yourself · 1 of 3
When may a server use an extension such as MCP Apps in a given session?
Why it matters
MCP apps, skills, events and some auth flows are extensions rather than core features. Host support varies, and the support matrix is community-maintained and changes. A server that always returns an HTML-only result works in one host and shows nothing in another. A user who connects your server to a terminal client should still get answers.
How it works
Each extension has an identifier in the form vendor-prefix/name. Official ones use io.modelcontextprotocol/, for example io.modelcontextprotocol/ui for MCP Apps and io.modelcontextprotocol/skills. A third-party extension should use a reversed domain you own, such as com.example/my-extension. An extension also has a lifecycle stage, experimental, beta or stable, and only a stable one has fixed behavior within a protocol revision.
Both sides advertise support in an extensions field of their capabilities:
- Server: lists it in its capabilities (returned by
server/discoverin protocol revision 2026-07-28 and later). - Client: sends it in
_meta["io.modelcontextprotocol/clientCapabilities"]with requests. For apps, the settings list the mime types it can render, such astext/html;profile=mcp-app. - Older revisions: many SDKs negotiate the same field during the
initializehandshake, though it is not part of the published schema for versions up to 2025-11-25.
A server uses the extension only when it sees the client's declaration.
function supportsApps(caps: ClientCapabilities | undefined): boolean {
const ui = caps?.extensions?.["io.modelcontextprotocol/ui"];
return !!ui?.mimeTypes?.includes("text/html;profile=mcp-app");
}
async function salesByRegion(args, ctx) {
const data = await querySales(args.quarter);
return {
content: [{ type: "text", text: renderTable(data) }],
...(supportsApps(ctx.clientCapabilities)
? { structuredContent: data }
: {}),
};
}
Before and after
Weak: the tool returns "See the chart above" and relies on the view. Hosts without apps show that sentence and no chart.
Better: the text result always carries the table or summary. The view is an upgrade when supported.
What goes wrong
- Checking the wrong thing. Testing the client's name or version string breaks when a new host ships. Test the declared capability.
- Failing hard. Throwing an error because a capability is missing turns an optional feature into a requirement.
- Hard-coding the matrix. Support changes. Read the declaration at runtime and use the matrix only for planning and testing.
Examples
Same tool, two hosts
A reporting server gets a request from a host that declares io.modelcontextprotocol/ui with text/html;profile=mcp-app. It returns the table as text plus structured data for the view. A second request comes from a terminal client with no extensions. It returns only the table as text. Both users get the report.
Picking a third-party identifier
Acme Corp owns acme.dev and builds an audit-trail extension. It names the extension dev.acme/audit-trail, with the reversed domain as prefix, so it cannot collide with another vendor's audit-trail.
Key points
- Extension identifiers look like vendor-prefix/name; official ones use the io.modelcontextprotocol prefix and third parties use a reversed domain.
- Both client and server declare an extension in the extensions field of their capabilities, and use it only if both did.
- Check the declared capability and its settings, such as supported mime types, rather than the client's name or version.
- Keep a complete text result as the baseline and treat the extension as an upgrade when the client supports it.
- Support varies by host and changes over time, so test the server against a client that lacks the extension.
Common mistakes
- Returning content that is meaningless unless the extension is rendered.
- Switching behavior on the client's name instead of its declared capabilities.
- Throwing an error when the client lacks the extension instead of falling back.
- Treating an experimental extension as fixed, when its design may change without notice.
Check yourself · 2 of 3
Which identifier fits a third-party extension built by a company that owns the domain example.com?
Check yourself · 3 of 3
A tool normally returns a chart view. What should it return to a client that did not declare the UI extension?
Practice items, not counted towards your mastery.
Start here
- MCP extensions overview (opens in a new tab)DocsFree
Extension identifiers, the experimental/beta/stable lifecycle, and how clients and servers negotiate support.
- MCP Apps overview (opens in a new tab)DocsFree
How a tool points at a ui:// resource, how the host renders it, and when a UI is worth building.
- MCP Apps SDK and specification repository (opens in a new tab)ToolFree
The SDK, working examples and the full MCP Apps specification, including CSP and visibility rules.
More for this topic
- MCP extension support matrix (opens in a new tab)DocsFree
A community-maintained table of which clients implement which official extensions.