ConduitMcp.Client.Transport.InProcess (ConduitMCP v0.11.0)

Copy Markdown View Source

A ConduitMcp.Client.Transport that serves requests from a server module in the same VM, for tests and development.

{ConduitMcp.Client,
 name: :local,
 transport: {ConduitMcp.Client.Transport.InProcess, server: MyApp.MCPServer}}

Each request runs ConduitMcp.Handler.dispatch/3 against the server module, which classifies its era (ConduitMcp.Era.classify/2) exactly as the HTTP transports do, in its own task under the client's Task.Supervisor; the result comes back to the connection as a transport event. The server module (dsl: false, DSL or ConduitMcp.Endpoint) is the one you would mount behind ConduitMcp.Transport.StreamableHTTP; no HTTP stack, socket or optional dependency is involved.

There are no sessions and no HTTP headers, so plugs (authentication, rate limiting, ConduitMcp.Plugs.HeaderValidation) do not run. Give the server a caller identity with :principal instead.

Cancelling a request kills its task. The server never sends server-to-client requests over this transport.

A modern tools/call sent with :on_progress (or after set_log_level/2) runs to its response with the tool's notifications/progress and notifications/message delivered as they happen, as over Streamable HTTP. subscriptions/listen needs a stream this transport cannot hold and is answered -32601.

Options

  • :server (required) - the server module.
  • :assigns - conn.assigns for every request (default %{}).
  • :principal - a ConduitMcp.Principal map put on every request's conn with ConduitMcp.Principal.put/2 (default: none).
  • :remote_ip - the conn's remote_ip (default {127, 0, 0, 1}).
  • :server_name, :server_version, :instructions - as for ConduitMcp.Transport.StreamableHTTP (an Endpoint's :name and :version are used when unset).