# `Issho.MCP`
[🔗](https://github.com/hattoriai/issho/blob/v0.4.0/lib/issho/mcp.ex#L155)

Issho's tools over MCP, with [Sake](https://hex.pm/packages/sake): a
`Sake.Server` of the tools you give, Issho's (`Issho.Tools.room/0`)
and the components' (`Kotoba.Issho.tools/0`, `Hakushi.Issho.tools/0`),
for any MCP client. The same tools serve your app's own model without
MCP (`Issho.Tools`).

    defmodule MyApp.MCP do
      use Issho.MCP,
        name: "my-app",
        version: "1.0.0",
        tools: Issho.Tools.room() ++ Kotoba.Issho.tools() ++ Hakushi.Issho.tools()
    end

    # config/config.exs
    config :issho, Issho.MCP, instance: MyApp.Issho

Serve it as your app serves MCP: over HTTP or stdio, with Sake's
authorization, your own, or none, on its own endpoint or mounted in
your own server (`mount MyApp.MCP`). Who a caller is in the rooms:
`Issho.MCP.Session`.

Options: those of `use Sake.Server` (`:name`, `:version`,
`:instructions`...), and `:tools`, a list of `Issho.Tool` modules.

## The inbox

An agent that is not connected is not told anything: MCP has no way
to reach it. What people said to it meanwhile waits in its inbox
(`Issho.Inbox`): the `inbox` tool takes it, and the server's
instructions, unless you give your own (then add `instructions/0`
to them), say to read it first. The server has the resource
`issho://inbox` (`Issho.MCP.Inbox`), and the clients that subscribe
to it hear when it changes: those connected. To wake one that is
not, give the instance an `:on_mention`.

Issho tells the servers that answered a call on the node of the
comment; in a cluster, name them all in the config:
`config :issho, Issho.MCP, servers: [MyApp.MCP]`. A server that
declares its own `resources` lists `Issho.MCP.Inbox` among them.
Sake is an optional dependency of Issho: add `{:sake, "~> 0.4"}` to
serve MCP, and start `{Sake, ...}` in your supervision tree, before
the endpoint (Sake's streams and tasks run there): without it, a
client that listens for changes (`subscriptions/listen`, as Claude
Code does on connecting) fails with "Sake.Plug.Streams is not
running". See the Agents guide.

# `instructions`

```elixir
@spec instructions() :: String.t()
```

What Issho's servers tell an agent when it connects, unless given other instructions.

---

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