API Reference OzMcp v#0.9.0

Copy Markdown View Source

Modules

OzMcp is an Elixir framework to write MCP servers. It supports the revision 2025-11-25 of the Model Context Protocol only. The README, the main page of these docs, lists the guides.

Contract for the token check of a protected MCP server.

A refusal of a request. It becomes an HTTP status and a WWW-Authenticate header value.

Protected Resource Metadata (RFC 9728) of a protected MCP server.

The authenticated caller.

The scopes that a tool, a resource, a template or a prompt requires.

What a callback can ask of the client: input from the user (elicitation), a model completion (sampling) and the roots of the client.

Behaviour for MCP prompt modules.

Compile-time macros of a prompt module (use OzMcp.Config.Prompt).

Behaviour for MCP resource modules.

Compile-time macros of a resource module (use OzMcp.Config.Resource).

Behaviour of a server module. A server module declares one MCP server: its information, its capabilities and the modules of its tools, resources, templates and prompts.

Compile-time macros of a server module (use OzMcp.Config.Server).

Behaviour for MCP resource template modules.

Compile-time macros of a resource template module (use OzMcp.Config.Template).

Behaviour for MCP tool modules.

Compile-time macros of a tool module (use OzMcp.Config.Tool).

The context of one JSON-RPC message and the ctx map that the callbacks of the entities receive.

Supervisor of a single MCP server instance.

The levels of notifications/message (RFC 5424 severities), from the lowest to the highest.

The notifications that a server sends to its clients.

Requests the server sends to the client.

The entity of a request, found by the bind stage of the pipeline (OzMcp.Pipeline.Bind). The stage puts the struct in the field bound of the context and the authorize/3 callback of a verifier receives it as its third argument.

The broadcast of the session notifications. The default implementation (OzMcp.PubSub.Registry) uses a Registry of the instance. The option :pubsub of OzMcp gives the module. A custom module can send the messages through another system. OzMcp also has OzMcp.PubSub.PG, which uses :pg and reaches the sessions of the connected nodes.

An OzMcp.PubSub that uses :pg (Erlang process groups).

The default OzMcp.PubSub: a duplicate Registry of the instance.

HTTP endpoint of an MCP server: the Streamable HTTP transport.

The persistent part of a session, for a restart or a cluster. The session process calls the module (the option :session_snapshot of OzMcp). The default OzMcp.Session.Snapshot.None keeps nothing.

The default snapshot module: no persistence.

The sessions of an instance: start, find, stop.

Helper module used to build Annotations structure.

Helper module used to build AudioContent structure.

Helper module used to build BlobResourceContents structure.

Helper module used to build BooleanSchema structure: a yes/no field of an elicitation form.

Helper module used to build CallToolResult structure.

Helper module used to build the CompleteResult structure.

Helper module used to build the Completion structure.

Helper module used to define the ContentBlock structure.

Helper module used to build the params of a sampling/createMessage request.

Helper module used to build CreateTaskResult structure.

Helper module used to build the params of an elicitation/create request in form mode.

Helper module used to build the params of an elicitation/create request in URL mode: the user is sent to a web page, the data never passes through the client.

Helper module used to build the requestedSchema of a form elicitation: a flat object whose properties are primitive fields.

Helper module used to build EmbeddedResource structure.

Helper module used to build a single-select enum field of an elicitation form (UntitledSingleSelectEnumSchema or TitledSingleSelectEnumSchema).

Helper module used to build GetPromptResult structure.

Helper module used to build Icon structure.

Helper module used to build ImageContent structure.

Helper module used to build Implementation structure.

Helper module used to build InitializeResult structure.

Helper module used to build ModelPreferences structure: what the server prefers when the client chooses a model. The client has the last word.

Helper module used to build a multi-select enum field of an elicitation form (UntitledMultiSelectEnumSchema or TitledMultiSelectEnumSchema).

Helper module used to build NotificationParams structure.

Helper module used to build NumberSchema structure: a numeric field of an elicitation form. The type is number by default; use type/2 with :integer for a whole number.

Helper module used to build Prompt structure.

Helper module used to build PromptArgument structure.

Helper module used to build PromptMessage structure.

Helper module used to build ReadResourceResult structure.

Helper module used to build RelatedTaskMetadata structure.

Helper module used to build Resource structure.

Helper module used to define the ResourceContents structure.

Helper module used to build ResourceLink structure.

Helper module used to build ResourceTemplate structure.

Helper module used to build Root structure: a directory or file the client lets the server work in.

Helper module used to build SamplingMessage structure: a message of the conversation the server asks the client to complete.

Helper module used to build ServerCapabilities structure.

Helper module used to build StringSchema structure: a text field of an elicitation form.

Helper module used to build Task structure.

Helper module used to build TaskMetadata structure.

Helper module used to build TextContent structure.

Helper module used to build TextResourceContents structure.

Helper module used to build Tool structure.

Helper module used to build ToolAnnotations structure.

Helper module used to build ToolChoice structure: how the model uses the tools of a sampling request.

Helper module used to build ToolExecution structure.

Helper module used to build ToolResultContent structure: the result of a tool call, inside a sampling message.

Helper module used to build ToolUseContent structure: a request of the model to call a tool, inside a sampling message.

Helper module used to define shared types for the OzMcp.Structs modules.

The tasks of an instance (MCP 2025-11-25, "Tasks").

Task helpers for tool authors.

ETS record store of the tasks of one instance: the default store of the option :task_store and it implements OzMcp.Tasks.StoreBehaviour. One named table per instance (the records table, table/1). The index of the records lives in OzMcp.Tasks.Index: this store implements none of the optional callbacks of the contract, so the facade OzMcp.Tasks.Records keeps that index for it.

The contract of a task store (the :task_store option of OzMcp, default OzMcp.Tasks.EtsStore).

A client for the tests of an MCP server. It starts the server in the test, opens a session through OzMcp.Router and gives the answers as a client reads them.

The MCP stdio transport: newline-delimited JSON-RPC on stdin and stdout.

Puts the standard input and output of the process in a shape the stdio transport can use.

A JSON-RPC error that a callback returns.

Mix Tasks

Runs an MCP server on the stdio transport, for a local client that starts this command as a subprocess.