Miosa.Mcp (Miosa v1.0.1)

Copy Markdown View Source

Model Context Protocol — JSON-RPC dispatch and streaming SSE channel.

Clients (Claude Code, Cursor, Gemini CLI, GitHub Copilot) point at /api/v1/mcp with a msk_* Bearer token and discover the MIOSA tool-belt via this endpoint.

Example

client = Miosa.client(System.fetch_env!("MIOSA_API_KEY"))

{:ok, result} = Miosa.Mcp.dispatch(client, %{
  method: "tools/call",
  params: %{name: "computer_screenshot", arguments: %{computer_id: "abc"}}
})

Summary

Functions

Close (terminate) the MCP session.

Send a JSON-RPC request to the MCP endpoint.

Open the MCP listen channel (GET).

Functions

close(client)

@spec close(Miosa.Client.t()) :: Miosa.Client.result(map())

Close (terminate) the MCP session.

dispatch(client, body \\ %{})

@spec dispatch(Miosa.Client.t(), map()) :: Miosa.Client.result(map())

Send a JSON-RPC request to the MCP endpoint.

body map may contain :method, :params, and any additional JSON-RPC fields (id, jsonrpc, etc.).

listen(client)

@spec listen(Miosa.Client.t()) :: Miosa.Client.result(map())

Open the MCP listen channel (GET).

For true SSE streaming use Miosa.Client.stream_sse/4 directly. This function returns the initial response body for one-shot callers.