An extension adds negotiated behavior without changing the core protocol
profile. It implements Snodo.Extension, declares exact-versioned
Snodo.Extension.Method values, and is installed on the server:
use Snodo.Server,
name: "my-server",
version: "1.0.0",
extensions: [MyApp.Extension]Runtime construction rejects duplicate extension IDs, methods that collide with any core method (including unsupported and MRTR-only ones), and collisions between extensions. An installed route runs only when both peers advertise the extension and its callback accepts the negotiation. An advertised, compatible extension may also wrap core dispatch and contribute HTTP policy through generic hooks.
When the server starts without capabilities:, it advertises installed
modules under capabilities["extensions"] and activates compatible hooks,
including around_dispatch/4, transport_policy/2, tool_input_schema/2,
and subscription_filter/2. Implement server_settings/1 to return the
JSON object to advertise. It receives the options from {module, options},
or [] for a bare module. The default settings are %{}.
An explicit capabilities: map replaces the derived map and uses the module
settings listed in its "extensions" entries. To keep an installed module
inert, leave its ID out of those entries. With explicit capabilities, an
installed but unadvertised extension does nothing.
Middleware that stores or defers a call instead of passing it on calls
Snodo.Extension.check_dispatch/3 first, so the deferred work passes the same
lookup, authorization, and argument checks as a direct call.
See examples/06_custom_extension.exs.
Extension maturity
SEP-3392 defines the maturity stages listed in the MCP extension registry.
| MCP extension | Stage | snodo support |
|---|---|---|
Tasks (io.modelcontextprotocol/tasks, SEP-2663) | Beta | snodo_tasks |
Skills (io.modelcontextprotocol/skills, SEP-2640) | Beta | Snodo.Skills |
MCP Apps (io.modelcontextprotocol/ui, SEP-1865) | Stable | Snodo.Apps |
| OAuth Client Credentials (SEP-1046) | Stable | snodo_oauth client |
Server Cards (io.modelcontextprotocol/server-card, SEP-2127) | Beta | Snodo.ServerCard, opt-in server_card: on the HTTP transports |
Experimental extensions can change without notice. Beta extensions can make breaking changes, which should be infrequent and must be recorded upstream. snodo tracks the extension specifications and documents breaking changes it adopts in its normal release notes. Stable behavior is fixed within a core protocol revision and can change only with a new core protocol revision.
Promotion from Beta or Stable into the core specification requires a Standards Track SEP. Once the revision containing the feature is released, requests using that revision or later get the core behavior without extension negotiation. Clients that still support earlier revisions should keep advertising the extension for those revisions.
Initialize-era dialects
On 2025-11-25, the client advertises its extension settings in
initialize.params.capabilities.extensions. The server returns its settings
for installed, advertised extensions compatible with that revision in
initialize.result.capabilities.extensions. When both peers advertise an
extension, its negotiate/2 callback decides whether to activate it.
Without sessions, a 2025-11-25 HTTP or stdio server does not advertise extensions. The in-process client carries a session snapshot that makes the initialized client capabilities available to handlers and capability checks.
Set :client_capabilities on Snodo.Client and pass the owning module as
extension: MyApp.Extension
to Snodo.Client.request/4 for an extension method. The module must declare
the method for 2025-11-25 and both peers must advertise it. The server
applies the negotiation callback before running the route.
The 2025-06-18 dialect omits the extensions capability. Tasks and Skills declare methods for 2026-07-28.
Declared extensions
Some extensions add no methods: the server advertises them, reads what the
client declared, and attaches the extension's _meta to tools, resources, or
results. Declare one with its server settings instead of writing a module:
use Snodo.Server,
name: "my-server",
version: "1.0.0",
extensions: [{:declared, "com.example/charts", %{"version" => "1"}}]The runtime advertises the id under capabilities["extensions"] with those
settings; an entry you put there yourself wins. In a handler,
Snodo.Context.extension_settings/2 returns the settings the client sent for
the id, or nil when the client did not declare it, so the handler can fall
back to plain content:
tool "sales_chart" do
@impl true
def call(_arguments, context) do
case Snodo.Context.extension_settings(context, "com.example/charts") do
nil ->
{:ok, "Q3 sales: 120, 140, 180"}
_client_settings ->
{:ok,
Snodo.Result.text("Q3 sales: 120, 140, 180",
metadata: %{"com.example/charts" => %{"kind" => "bar", "series" => [120, 140, 180]}}
)}
end
end
endFor a published extension, attach the _meta keys its specification defines.
A declared extension has no routes, middleware, or negotiation callback; write
a Snodo.Extension module when you need any of those.
Server Cards
MCP Server Cards (io.modelcontextprotocol/server-card, SEP-2127) are at
the Beta stage under SEP-3392. Clients fetch cards before connecting, so
enabling the transport route requires no MCP capability negotiation.
The v1 card describes public server identity, the Streamable HTTP URL,
and supported protocol versions. Component listings and capabilities are
available through the live MCP endpoint. See the MCP extensions overview
and Server Card specification.
Enable the card with the transport option.
For optional domain-wide discovery, publish an AI Catalog from your site
router or reverse proxy at /.well-known/ai-catalog.json with media type
application/ai-catalog+json. Use Snodo.ServerCard.catalog/1 to build the
document, passing each stable catalog identifier and absolute card URL.
Snodo.ServerCard.catalog([
{"urn:air:example.com:mcp:weather", "https://example.com/mcp/server-card"}
])MCP Apps
MCP Apps (io.modelcontextprotocol/ui, specification 2026-01-26) links a tool
to a ui:// resource holding an HTML document that the host renders in a
sandboxed frame. It is a declared extension, and Snodo.Apps returns the
shapes the specification defines:
use Snodo.Server,
name: "weather",
version: "1.0.0",
extensions: [Snodo.Apps.extension()]
tool "forecast", metadata: Snodo.Apps.tool_metadata("ui://weather/forecast") do
argument("city", :string, required: true)
@impl true
def call(%{"city" => city}, context) do
if Snodo.Apps.supported?(context) do
{:ok, Snodo.Result.structured(%{"city" => city, "celsius" => 21})}
else
{:ok, "#{city}: sunny, 21 C"}
end
end
end
resource "forecast_view",
uri: "ui://weather/forecast",
mime_type: "text/html;profile=mcp-app" do
@impl true
def read(_params, _context) do
{:ok,
Snodo.Result.resource_read(
Snodo.Apps.html("ui://weather/forecast", File.read!("priv/forecast.html"),
csp: [connect_domains: ["https://api.weather.example"]],
prefers_border: true
)
)}
end
endtool_metadata/2 writes _meta.ui.resourceUri. With visibility: [:app]
the host hides the tool from the model and accepts calls to it only from the
UI, for actions such as a refresh button.
A host that does not implement MCP Apps ignores _meta.ui and shows the
tool's content, so the content should make sense as text. A host that does
implement it declares the extension with mimeTypes in its capabilities;
Snodo.Apps.supported?/1 checks for text/html;profile=mcp-app there, so a
handler can return data for the UI to such a host and plain text to any other.
Negotiation uses capabilities["extensions"] on 2026-07-28 and 2025-11-25.
On 2025-06-18, supported?/1 returns false.
The view's Content Security Policy goes in the content's _meta, which
html/3 builds from its options. Without :csp the host allows no external
origins. :connect_domains, :resource_domains, :frame_domains, and
:base_uri_domains list the origins for network requests, static assets,
nested frames, and the base URI. :permissions asks for :camera,
:microphone, :geolocation, or :clipboard_write. :domain requests a
dedicated sandbox origin in the format the host documents, and
:prefers_border asks the host to draw or omit a border. A host may restrict
any of these further.
Resource options are compile-time literals, so the listing's mimeType is
written out. html/3 sets the content's MIME type and checks its ui:// URI. Snodo.Apps.client_capabilities/0 is the host side of the
declaration, for Snodo.Client in tests.
See examples/35_mcp_apps.exs.
Skills
The Skills extension (io.modelcontextprotocol/skills, SEP-2640) serves
agent skills. A skill is a directory with a SKILL.md file, whose YAML
frontmatter gives the skill's name and description, and any supporting
files. Each file is a resource under skill://<skill-path>/<file>, where the
last segment of the skill path is the skill name. Snodo.Skills builds the
catalog when the module compiles:
defmodule MyApp.Skills do
use Snodo.Skills, directory: "priv/skills"
end
defmodule MyApp.Server do
use Snodo.Server,
name: "my-app",
version: "1.0.0",
extensions: [MyApp.Skills]
for file <- MyApp.Skills.resources(), do: resource(file)
endEvery directory under priv/skills that holds a SKILL.md is a skill, at
any depth: priv/skills/acme/pdf-processing/SKILL.md is served as
skill://acme/pdf-processing/SKILL.md. The module recompiles when a file
under the directory is added, removed, or changed. It compares paths, sizes,
and whole-second modification times, not contents, so a change that keeps a
file's size within the same second as its last modification can be missed;
run mix compile --force then. :entries adds skills the application supplies as a path and a map
of file contents, alone or next to :directory. Only skills supplied
through :entries can set :metadata, which supplies the protocol "_meta"
object in skills/list and skills/get. The Agent Skills frontmatter
metadata field is separate, and directory skills cannot set protocol
metadata. The frontmatter name must
equal the directory name and follow the naming rules (1 to 64 lowercase
letters, digits, and single hyphens), and description must be present. A
skill that breaks a rule or a limit fails compilation with ArgumentError.
The module is the extension. It answers:
skills/list: one entry per skill, with its SKILL.md URI, its frontmatter as JSON, and a{"uri", "digest", "size"}object for every file. The digest issha256:followed by the SHA-256 of the file's bytes in lowercase hex, computed at compile time. Entries are paged whole.skills/get: one entry by SKILL.md URI, or -32602 for a URI the server does not serve.resources/directory/read: the direct children of a skill directory, with subdirectories asinode/directory, or -32602 for a URI that is not a skill directory.directory_read: falseleaves the method out and drops"directoryRead": truefrom the declaration.
resources/0 returns one generated Snodo.Resource module per file, which
the server registers, so resources/read serves the bytes (text when they are
UTF-8, a blob otherwise) and resources/list lists the files. A SKILL.md
resource takes its name and description from the frontmatter.
Derived capabilities include "resources" when the router registers
resources, so register the skill files as shown above.
A server that passes explicit capabilities: can call capabilities/1,
which adds "resources" and the extension's declaration to the map.
As with every extension module, the three methods are answered only when the
client declares io.modelcontextprotocol/skills in its capabilities; a client
that does not gets -32021 with the extension in requiredCapabilities. The
skill files remain ordinary resources that any client can read. The
extension routes are 2026-07-28 only.
Frontmatter
The core has no YAML dependency, so Snodo.Skills.Frontmatter reads a subset
of YAML: a top-level mapping of plain or quoted keys, plain scalars typed by
the YAML 1.2 core schema, quoted strings, flow and block sequences of scalars,
and one level of nested mapping such as metadata:. Block scalars (|, >),
anchors, aliases, tags, flow mappings, and deeper nesting are refused with an
:unsupported Snodo.Skills.Frontmatter.Error. As in YAML, only spaces and
tabs are trimmed, so a no-break space stays part of a value. Frontmatter over
1 MiB, and a number with more than 1,000 digits, are refused with
:too_large. To read full YAML, pass a parser, for example one backed by a
YAML library in your application:
use Snodo.Skills,
directory: "priv/skills",
frontmatter_parser: &MyApp.YAML.decode/1The parser takes the text between the --- lines and returns {:ok, map} or
{:error, reason}. Snodo.Skills.Client takes the same option.
Client
Snodo.Skills.Client works over a Snodo.Client that declares the
extension:
{:ok, client} =
Snodo.Client.connect({:http, url}, client_capabilities: Snodo.Skills.Client.capabilities())
{:ok, entries} = Snodo.Skills.Client.list(client)
entry = Enum.find(entries, &(&1["frontmatter"]["name"] == "pdf-processing"))
{:ok, skill_md} = Snodo.Skills.Client.load(client, entry)
{:ok, forms} = Snodo.Skills.Client.read(client, entry, "skill://pdf-processing/references/FORMS.md")Listing and getting read no files; a host reads a skill's files when it uses
the skill. load/3 reads SKILL.md and read/4 any listed file. Before either
returns content, it checks that the file is listed, that its listed size is
within :max_file_bytes, that the byte length and digest match the entry, and,
for SKILL.md, that the parsed frontmatter matches the entry field by field. A
failed check returns a -32000 error with kind: :extension and a "reason"
in its data, such as "digest_mismatch", and the content is not returned.
The limits are listed in Transports.
See examples/36_skills.exs.
Tasks
snodo_tasks implements the io.modelcontextprotocol/tasks extension on those
hooks. It augments tools/call, keeps tasks/get, tasks/update, and
tasks/cancel outside the core catalog, and adds taskIds filters and
notifications/tasks to subscriptions.
The application owns the store and runner. The package includes memory and
DETS stores; snodo_tasks_postgres and snodo_tasks_sqlite add
transactional stores behind an application-owned Ecto Repo. Recovery is
at-least-once, so work must use its stable idempotency key for external
effects.
- Tasks package, including the stress-testing harness
- Writing a Tasks store
- PostgreSQL store
- SQLite store
Examples 07, 08, 09, 17, and 26 run from extensions/tasks; example 10 from
extensions/tasks_postgres with a live database; example 11 from
extensions/tasks_sqlite.
Events
snodo does not implement the Events extension (SEP-3415) yet. See the Events extension decision.