Phoenix router DSL for mounting an MCP endpoint and declaring exposed tools, prompts, and resources.
Typical usage:
mcp_scope "/mcp", MyApp.MCP do
tool "project_create", Tools.ProjectCreate
tool "project_status", Tools.ProjectStatus
prompt "draft_release_notes", Prompts.DraftReleaseNotes
resource "project", Resources.Project
endThe second argument behaves like a regular Phoenix scope alias. Given the
example above, Tools.ProjectCreate resolves to MyApp.MCP.Tools.ProjectCreate.
mcp_scope/2 and mcp_scope/3 generate the underlying route automatically,
so the host router does not need a separate MCP pipeline or forward call.
Runtime state is handled by a host-started MCPKit.Runtime child. The router
infers its name from the definition module unless overridden with runtime:.
resource/2 mounts MCP resources for the scope.
Summary
Functions
Mounts an MCP endpoint under the given router path.
Mounts an MCP endpoint under the given router path with an explicit scope alias and options.
Declares a prompt inside mcp_scope.
Declares a resource inside mcp_scope.
Declares a tool inside mcp_scope.
Functions
Mounts an MCP endpoint under the given router path.
The second argument may be either a scope alias or router options. When a
scope alias is given, mcp_scope/2 infers a sibling Definition module and
runtime name from that scope.
Inside the block you may declare tool/2, prompt/2, and resource/2
entries.
Mounts an MCP endpoint under the given router path with an explicit scope alias and options.
Supports definition: to override the inferred Definition module and
runtime: to override the inferred runtime name.
Declares a prompt inside mcp_scope.
The prompt name is exposed over MCP and the module must implement
MCPKit.Prompt.
Declares a resource inside mcp_scope.
The resource name is used for policy and completion routing, and the module
must implement MCPKit.Resource.
Declares a tool inside mcp_scope.
The tool name is exposed over MCP and the module must implement
MCPKit.Tool.