Hi all,
I’ve just released Sake 0.5.0, and I want to explain better what it’s for, because I think many Phoenix apps can use it now.
Why Sake
An MCP server that only you use locally is easy. The difficult part is a remote server that real users connect to with their own accounts. For that, you need an OAuth 2.1 authorization server: discovery, PKCE, dynamic client registration, consent, token rotation. Most MCP libraries leave that part to you.
Sake includes it. Your existing Phoenix login becomes the identity provider, so each tool call knows which user made it. If you already use Keycloak, Auth0, Okta or Entra ID, Sake validates their tokens instead.
defmodule MyApp.MCP.CloseIssue do
use Sake.Tool, name: "close_issue", description: "Close an issue", scope: "issues:write"
arg :id, :integer, required: true
@impl true
def execute(%{id: id}, ctx) do
with {:ok, _} <- MyApp.Issues.close(ctx.scope, id), do: {:ok, "Closed ##{id}"}
end
end
{Sake,
secret_key_base: MyAppWeb.Endpoint.config(:secret_key_base),
auth: [subject: MyApp.MCP.Subject, # reads the signed-in user from the conn
issuer: "https://myapp.example.com",
servers: [MyApp.MCP],
store: {Sake.Auth.Store.Ecto,
repo: MyApp.Repo}]
}
# router.ex
import Sake.Router
scope "/" do
sake_endpoint "/mcp", server: MyApp.MCP
end
mix dev in the repo starts a full example app with a login form, the OAuth endpoints and sample tools.
What’s new
Tasks that survive a lost node. Before, a task run was a process on the node that started it. If that node went down, the task stayed working until it expired. Now each run holds a lease, and any node recovers a task whose lease lapses: it fails it, or it runs it again (recovery: {:retry, attempts}). You can also give task execution to a durable queue such as Oban (Sake.Tasks.Runner), or give a task to an external system that reports back with Sake.Tasks.complete/3. Sake adds no dependency for this.
Full JSON Schema 2020-12 validation. Before, a raw input_schema: was validated only for what arg lines generate. Now Sake validates the whole schema: $ref, allOf/anyOf/oneOf, if/then/else, unevaluatedProperties, prefixItems and the rest. A schema that cannot be valid is a compile error. Structured results are validated against output_schema: too, and Sake.Tool.Result lets a tool return structured content of any JSON type. With absent: :omit, a tool can tell a missing argument from null.
MCP extensions (SEP-2133). use Sake.Extension lets you implement an extension’s methods and notifications on a Sake server. They go through the same transports, auth, middleware, telemetry and tracing as core methods. Before, you could only advertise an extension.
Skills over MCP (SEP-2640, beta). A library or app can ship SKILL.md workflows with its tools. use Sake.Skill, dir: "..." compiles a skill directory at build time, with manifest and SHA-256 digests. Sake.Skill.Catalog serves skills at runtime. Sake.Client can list, get and verify skills too.
Resumable SSE streams on the session-based revisions. Each event has an ID. A call continues when its connection drops, and a GET with Last-Event-ID replays the events it missed, on any node when you use pubsub. The client resumes automatically.
Paged client lists. Sake.Client.list_tools_page/2 and the other *_page functions, reduce_list/5 for lazy enumeration of large catalogs, and cache metadata (ttlMs, cacheScope) on results.
Other parts of Sake:
- One endpoint for all clients: the stateless 2026-07-28 revision and the older session-based revisions (2025-11-25, 2025-06-18, 2025-03-26) on the same path.
- A client:
Sake.Clientdoes the full MCP auth flow against any server (discovery, registration, PKCE, refresh, step-up, DPoP). - Conformance: the official MCP conformance suite runs in CI on every commit.
Feedback
If you’re adding MCP to a Phoenix app, try Sake and tell me where it’s hard: setup, docs, a client that doesn’t connect, a missing feature. Issues, PRs and replies here are all welcome. I want to get to 1.0 with real apps behind it.
- Hex: sake | Hex
- Docs: Sake v0.5.0 — Documentation
- GitHub: GitHub - hattoriai/sake · GitHub


















