Sake is MCP for Elixir and Phoenix.

See Sake.Server to expose tools, Sake.Plug to mount the endpoint, Sake.Auth to protect it with your own login, and Sake.Client to call other servers.

Configuration

  • config :sake, :json_library, Jason — the library Sake encodes your data with (tool results, resources, prompts, notifications): JSON (the default), Jason, or any module with encode!/1 and encode_to_iodata!/1. Choose Jason when your structs derive Jason.Encoder rather than JSON.Encoder. See the tools guide.
  • config :sake, :secret_key_base — the signing secret, when neither Sake.Plug nor {Sake, ...} is given one.
  • config :sake, :opentelemetry — see the observability guide.

Summary

Functions

The child for the host's supervision tree

The package version.

Functions

child_spec(opts)

The child for the host's supervision tree:

{Sake, secret_key_base: {MyAppWeb.Endpoint, :config, [:secret_key_base]}, pubsub: MyApp.PubSub, auth: [...]}

auth: takes the Sake.Auth.Config options, for Sake's own authorization server; external_auth: names other authorization servers whose tokens endpoints take (see Sake.Auth.External); without either only the stream registry and tasks run. tasks: takes the Sake.Tasks options (false turns tasks off).

replay: is the Sake.Auth.Store that remembers the single-use JWTs already seen (client assertions, JWT grants, DPoP proofs), as {module, options}; by default the auth: store. On several nodes it must be shared, {Sake.Auth.Store.Ecto, repo: MyApp.Repo}, for a JWT used on one node to be refused on the others; a deployment with only external_auth: and DPoP sets it to have that. Without either, each node remembers on its own.

When a store, the replay table or the streams keep their state on this node only (the ETS stores, no replay: store, no pubsub:), Sake logs a warning once this node is connected to another, naming each and its shared alternative. See the "Running on several nodes" guide.

version()

@spec version() :: String.t()

The package version.