# `Tayori.MCP`
[🔗](https://github.com/hattoriai/tayori/blob/v0.1.0/lib/tayori/mcp.ex#L2)

An MCP server for the news, built on [Sake](https://hexdocs.pm/sake):
an MCP client (Claude Code, Claude Desktop, an agent) reads the news
and the inbox, adds what shipped, drafts entries, writes them in each
language with their screenshots, and publishes them when it is asked
to, as the admin of the app it acts for.

Compiled only when the app depends on `:sake`. Mount it in the app's
own Sake server, next to the servers of its other libraries, or serve
it on an endpoint of its own:

    defmodule MyAppWeb.MCP do
      use Sake.Server, name: "my-app", version: "1.0.0"
      mount Tayori.MCP, prefix: "tayori"
    end

    # or, in the router
    sake_endpoint "/news/mcp", server: Tayori.MCP, auth: true

## Scopes

  * `tayori:read` - read the news, the drafts, the inbox and the
    categories.
  * `tayori:write` - add changes to the inbox, draft, write, publish
    and unpublish entries, and upload their images.

The app's subject module gives them to its roles (`scopes_for/2`), and
the app's `Tayori.Resolver` decides as in the admin: `:all` may do what
the token's scopes allow, `:read_only` only read. Nobody may use the
server until the `:mcp` option of `Tayori.Config` names the resolver:

    {Tayori, repo: MyApp.Repo, pubsub: MyApp.PubSub,
     mcp: [resolver: MyAppWeb.TayoriResolver]}

Nothing is published but by `publish_entry`, and nothing is deleted.
See the [MCP](mcp.md) guide.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
