MCPKit.Definition behaviour (mcp_kit v0.2.4)

Copy Markdown View Source

Host application contract for MCP runtime configuration.

MCPKit owns the MCP transport version and exposes it through MCPKit.Definition.protocol_version/0.

policy/0 is optional. When omitted, the built-in allow-all policy is used.

Summary

Callbacks

Returns optional server instructions included in the initialize response.

Returns the MCPKit.Policy implementation used for request-time access checks.

Returns the MCP server information map sent during initialize.

Returns the MCPKit.SessionStore implementation used for durable sessions.

Functions

Returns the protocol version currently implemented by mcp_kit.

Callbacks

instructions()

(optional)
@callback instructions() :: String.t()

Returns optional server instructions included in the initialize response.

When omitted, MCPKit does not include an instructions field.

policy()

(optional)
@callback policy() :: module()

Returns the MCPKit.Policy implementation used for request-time access checks.

When omitted, the built-in allow-all policy is used.

server_info()

@callback server_info() :: map()

Returns the MCP server information map sent during initialize.

The map is serialized directly into the JSON-RPC response and typically includes at least a server name and version.

session_store()

@callback session_store() :: module()

Returns the MCPKit.SessionStore implementation used for durable sessions.

Functions

protocol_version()

Returns the protocol version currently implemented by mcp_kit.