# Sake v0.1.0 - Table of Contents

> MCP for Elixir and Phoenix: a server for both protocol eras, an OAuth 2.1 authorization server on your own login, and a client.

## Pages

- [Sake](readme.md)
- [Changelog](changelog.md)

- Guides
  - [Quickstart](quickstart.md)
  - [Tools](tools.md)
  - [Resources and prompts](resources_and_prompts.md)
  - [Authorization](authorization.md)
  - [Multi-tenant endpoints](tenants.md)
  - [The client](client.md)

- Reference
  - [Protocol versions](protocol_versions.md)
  - [Security](security.md)

## Modules

- [Sake](Sake.md): Sake is MCP for Elixir and Phoenix.
- [Sake.Auth.Consent.Default](Sake.Auth.Consent.Default.md): The consent and error pages that ship with Sake.
- [Sake.Prompt.Spec](Sake.Prompt.Spec.md): The compiled definition of a prompt.
- [Sake.Resource.Spec](Sake.Resource.Spec.md): The compiled definition of a resource.
- [Sake.Server.Session](Sake.Server.Session.md): Legacy session IDs are signed tokens that carry the negotiated revision,
the client capabilities, the log level `logging/setLevel` last set, and
a random nonce. The server stores nothing per session.
- [Sake.Tool.Spec](Sake.Tool.Spec.md): The compiled definition of a tool.
- [SakeDev.Server](SakeDev.Server.md): The example server of the development server and the tests.

- Server
  - [Sake.Content](Sake.Content.md): A content block of a tool result, a resource read, or a prompt message.

  - [Sake.Context](Sake.Context.md): What a component learns about the request it serves.
  - [Sake.Elicit](Sake.Elicit.md): Asks the person for input from inside a component.
  - [Sake.Plug](Sake.Plug.md): The MCP endpoint. Mount it once per server
  - [Sake.Plug.Headers](Sake.Plug.Headers.md): The request headers that mirror the body on the modern Streamable HTTP
transport: `Mcp-Method`, `Mcp-Name` and `Mcp-Param-*`, with the Base64
sentinel encoding for values that are not plain ASCII.

  - [Sake.Plug.Streams](Sake.Plug.Streams.md): The registry of open streams on this node: `subscriptions/listen`
streams, legacy GET streams, and handlers waiting for a legacy
elicitation answer. Started by the `Sake` supervisor. With a `pubsub:`
option (a `Phoenix.PubSub` name) notifications reach every node.

  - [Sake.Progress](Sake.Progress.md): Progress and log notifications from inside a component.
  - [Sake.Prompt](Sake.Prompt.md): A prompt template: `arg` lines (strings only) and `get/2`, which returns
messages as `{:user | :assistant, text | %Sake.Content{}}`.

  - [Sake.Resource](Sake.Resource.md): A resource: a fixed `uri:` or a template with `{name}` placeholders, and
`read/2`. A template resource may implement `list/1` to enumerate concrete
resources. `subscribe: true` lets clients subscribe to updates, which the
host announces with `Sake.Server.resource_updated/2`.

  - [Sake.Router](Sake.Router.md): Router macros for Phoenix hosts
  - [Sake.Server](Sake.Server.md): The server module lists the components and their scopes.
  - [Sake.Tool](Sake.Tool.md): A tool: `use Sake.Tool` with options, `arg` lines, an optional `output`
block, and `execute/2`.

- Authorization
  - [Sake.Auth](Sake.Auth.md): Authorization for a Sake endpoint: the host app is the OAuth 2.1
authorization server, and the endpoint is the resource server.
  - [Sake.Auth.Authorize](Sake.Auth.Authorize.md): The authorization endpoint: `GET` validates the request and shows the
consent page (or redirects at once when consent is remembered); `POST`
records the decision. Mount it inside the pipeline that requires a
signed-in person; Sake reads the person through `Sake.Auth.Subject`.
  - [Sake.Auth.CIMD](Sake.Auth.CIMD.md): Client ID Metadata Documents: a client identifies itself with an HTTPS
URL, and the authorization server fetches the JSON document there.
  - [Sake.Auth.Client](Sake.Auth.Client.md): An OAuth client: from a Client ID Metadata Document, dynamically registered, or registered by the host.
  - [Sake.Auth.Clients](Sake.Auth.Clients.md): Clients the host registers itself (for its own CLIs or partners).
  - [Sake.Auth.Code](Sake.Auth.Code.md): An authorization code (stored hashed).
  - [Sake.Auth.Config](Sake.Auth.Config.md): The authorization configuration given to `{Sake, auth: [...]}`.
  - [Sake.Auth.Consent](Sake.Auth.Consent.md): Renders the consent page and the authorization error page. The default,
`Sake.Auth.Consent.Default`, ships its own small style sheet. A host
replaces it with `consent: MyAppWeb.MCPConsent` in the auth config.
  - [Sake.Auth.DCR](Sake.Auth.DCR.md): Dynamic Client Registration (RFC 7591) for clients that do not use Client
ID Metadata Documents. Public clients only; no authentication. Put a rate
limit in front of it.
  - [Sake.Auth.Migration](Sake.Auth.Migration.md): The tables of `Sake.Auth.Store.Ecto`. In your app
  - [Sake.Auth.Revoke](Sake.Auth.Revoke.md): The revocation endpoint (RFC 7009). Revoking a refresh token revokes its
whole family. Revoking any token of a client also forgets the consents
that person gave that client, so the next connection asks again.

  - [Sake.Auth.RouterPlug](Sake.Auth.RouterPlug.md): The token, registration and revocation endpoints as one Plug router for
hosts without Phoenix
  - [Sake.Auth.Store](Sake.Auth.Store.md): Where clients, codes, tokens and consents live. Implemented by `Sake.Auth.Store.ETS` and `Sake.Auth.Store.Ecto`.
  - [Sake.Auth.Store.ETS](Sake.Auth.Store.ETS.md): An in-memory store for development and tests on one node. Everything is
lost on restart.

  - [Sake.Auth.Store.Ecto](Sake.Auth.Store.Ecto.md): The Ecto store: `store: {Sake.Auth.Store.Ecto, repo: MyApp.Repo}` with
the tables from `Sake.Auth.Migration`. Tested on Postgres.

  - [Sake.Auth.Subject](Sake.Auth.Subject.md): How Sake finds the person behind a request. The host implements it
  - [Sake.Auth.Token](Sake.Auth.Token.md): The token endpoint: the authorization code grant with PKCE, and refresh
token rotation with reuse detection.

  - [Sake.Auth.TokenRecord](Sake.Auth.TokenRecord.md): An access or refresh token (stored hashed). `family_id` groups the tokens born from one authorization code.
  - [Sake.Auth.WellKnown](Sake.Auth.WellKnown.md): Serves `/.well-known/oauth-protected-resource` (also under the endpoint's
path) and `/.well-known/oauth-authorization-server`. Mount at the root

- Client
  - [Sake.Client](Sake.Client.md): A client for MCP servers over Streamable HTTP, on both protocol eras.
  - [Sake.Client.Challenge](Sake.Client.Challenge.md): A parsed `WWW-Authenticate` challenge.
  - [Sake.Client.Session](Sake.Client.Session.md): The state of a client connection; every `Sake.Client` call returns an updated one.
  - [Sake.Client.ToolResult](Sake.Client.ToolResult.md): The result of `Sake.Client.call_tool/3`.

- Protocol
  - [Sake.JSONRPC](Sake.JSONRPC.md): JSON-RPC 2.0 messages as MCP uses them: requests with a string or integer
id, notifications without one, results, errors, and batches (legacy
revision 2025-03-26 only).

  - [Sake.Protocol](Sake.Protocol.md): The protocol revisions Sake speaks and the `_meta` keys the protocol reserves.
  - [Sake.Schema](Sake.Schema.md): Builds JSON Schema 2020-12 from `arg` declarations and validates arguments
against it.

