# `AshAi.Mcp.Server`
[🔗](https://github.com/ash-project/ash_ai/blob/v0.6.1/lib/ash_ai/mcp/server.ex#L5)

Implementation of the Model Context Protocol (MCP) RPC functionality.

This module handles HTTP requests and responses according to the MCP specification,
supporting both synchronous and streaming communication patterns.
It also handles the core JSON-RPC message processing for the protocol.

# `get_server_name`

Get the MCP server name

# `get_server_version`

Get the MCP server version

# `handle_delete`

Handle HTTP DELETE request for session termination

# `handle_get`

Process an HTTP GET request to open an SSE stream

# `handle_post`

Process an HTTP POST request containing JSON-RPC messages

# `json_rpc_error_response`

Create a standard JSON-RPC error response

# `parse_json_rpc`

Parse the JSON-RPC request

# `process_message`

Process a single JSON-RPC message

# `sandbox_domain`

Computes the sandbox domain for an `mcp_ui_resource` from the MCP server URL.

MCP hosts render UI resources in sandboxed iframes, and each host determines the
iframe's origin differently:

| Host    | Domain format                                    | Behavior                                              |
|---------|--------------------------------------------------|-------------------------------------------------------|
| Claude  | `{sha256_hash}.claudemcpcontent.com`             | Hash derived from the MCP server endpoint URL.        |
| ChatGPT | `{connector_id}.web-sandbox.oaiusercontent.com`  | Auto-assigned by ChatGPT; ignores the `domain` field. |

Since ChatGPT ignores `domain` entirely, this function generates a Claude-compatible
value so that a single configuration works across both hosts.

When `domain` is set to `:auto` (the default), this is called automatically at
request time using the server URL derived from the incoming connection.

## Examples

    iex> AshAi.Mcp.Server.sandbox_domain("http://localhost:4000/mcp")
    "0307c5dc3988887979d60ecbb5101189.claudemcpcontent.com"

# `send_sse_event`

Send an SSE event over the chunked connection

---

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