# `Lotus.Web.MCP`
[🔗](https://github.com/elixir-lotus/lotus_web/blob/v1.4.0/lib/lotus/web/mcp.ex#L2)

Lotus's MCP server with Lotus Web on top: every tool of `Lotus.MCP`, the
`show_chart` tool, whose chart an MCP App draws inside the conversation
(in hosts that render apps, such as Claude), and your
`Lotus.Web.Resolver` deciding who may do what, as it does in the
dashboard.

Compiled only when the host depends on `:sake`. Serve it instead of
`Lotus.MCP`:

    # router.ex
    sake_endpoint "/lotus/mcp", server: Lotus.Web.MCP, auth: true

    # config/config.exs
    config :lotus_web, Lotus.Web.MCP, resolver: MyApp.LotusResolver

    config :lotus, :mcp,
      authorize: {Lotus.Web.MCP, :authorize?},
      actor: {Lotus.Web.MCP, :actor}

`authorize?/1` lets in whoever the resolver's `resolve_access/1` gives
`:all` or `:read_only` access; `actor/1` gives Lotus the
`resolve_context/1` and `resolve_scope/1` the dashboard would. Each tool
then needs the dashboard action it stands for (see
`Lotus.Web.MCP.Access`), decided by the resolver's `authorize/3`, or by
the access level without one.

See the MCP guide.

# `actor`

```elixir
@spec actor(Lotus.Web.Resolver.user()) :: [{:context, term()} | {:scope, term()}, ...]
```

The `:context` and `:scope` the dashboard would give Lotus for `user`.
For `config :lotus, :mcp, actor:`.

# `authorize?`

```elixir
@spec authorize?(Lotus.Web.Resolver.user()) :: boolean()
```

Whether `user` may use Lotus over MCP: the resolver's `resolve_access/1`
gives `:all` or `:read_only`. For `config :lotus, :mcp, authorize:`.

A resolver that does not implement `resolve_access/1` lets nobody in,
rather than everybody, as the dashboard's default would: an MCP endpoint
has no router pipeline in front of it to keep strangers out.

---

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