ExMCP.ACP.AdapterBridge (ex_mcp v0.9.0)
View SourceGenServer bridge between ACP clients and non-native CLI agents.
Owns the Port subprocess and delegates translation to a pluggable
ExMCP.ACP.Adapter implementation. Uses an outbox + waiters queue
for synchronized message delivery.
Modes
- Persistent (default) — opens a Port on init, keeps it alive
- One-shot — adapter manages subprocess per prompt (Codex pattern)
Usage
{:ok, bridge} = AdapterBridge.start_link(
adapter: ExMCP.ACP.Adapters.Claude,
adapter_opts: [model: "sonnet"]
)
:ok = AdapterBridge.send_message(bridge, json_rpc_string)
{:ok, response} = AdapterBridge.receive_message(bridge)
Summary
Functions
Returns a specification to start this module under a supervisor.
Close the bridge and terminate the subprocess.
Receive the next ACP message from the agent. Blocks until available.
Send a JSON-encoded ACP message to the agent.
Start the bridge linked to the caller.
Types
@type t() :: GenServer.server()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec close(t()) :: :ok
Close the bridge and terminate the subprocess.
Receive the next ACP message from the agent. Blocks until available.
Send a JSON-encoded ACP message to the agent.
@spec start_link(keyword()) :: GenServer.on_start()
Start the bridge linked to the caller.