The server module lists the components and their scopes.
defmodule MyApp.MCP do
use Sake.Server, name: "myapp", version: "1.0.0", instructions: "..."
scope "issues:read", "Read issues"
tools [MyApp.MCP.SearchIssues]
resources [MyApp.MCP.Issue]
prompts [MyApp.MCP.Triage]
endOptions: name, version (required), instructions, ttl (default
300 000 ms), cache_scope (:public or :private; default: private
when the endpoint has authorization, public otherwise), page_size
(default 100), extensions (a map for extension negotiation).
On the modern protocol, list and read results carry ttlMs: the
server's ttl, or less. A tool, resource or prompt with its own ttl:
shortens the ttlMs of every list page that includes it, and a
resource's ttl: also sets the ttlMs of its resources/read result
(the shortest ttl always wins).
Summary
Functions
Whether the request may see or call the component: no token means no gating.
Tells listening clients that the list of tools, resources or prompts changed.
Tells subscribed clients that a resource changed.
Functions
@spec allowed?(struct(), Sake.Context.t()) :: boolean()
Whether the request may see or call the component: no token means no gating.
@spec notify_list_changed(module(), :tools | :resources | :prompts) :: :ok
Tells listening clients that the list of tools, resources or prompts changed.
@spec prompt(module(), String.t()) :: {:ok, Sake.Prompt.Spec.t()} | :error
@spec resource(module(), String.t()) :: {:ok, Sake.Resource.Spec.t(), map()} | :error
Tells subscribed clients that a resource changed.
@spec tool(module(), String.t()) :: {:ok, Sake.Tool.Spec.t()} | :error