ExMCP.Client.Wrapper (ex_mcp v0.10.0)

View Source

Wrapper module that provides a unified interface to different client implementations.

This module allows runtime switching between the legacy GenServer implementation and the new StateMachine implementation via configuration.

Configuration

# Use state machine implementation (opt-in)
config :ex_mcp, :client_adapter, ExMCP.Client.StateMachineAdapter

# Use legacy implementation (default)
config :ex_mcp, :client_adapter, ExMCP.Client.LegacyAdapter

Per-client configuration

# Force specific implementation
{:ok, client} = ExMCP.Client.start_link(
  transport: :stdio,
  command: "mcp-server",
  adapter: ExMCP.Client.StateMachineAdapter
)

Summary

Functions

batch_request(state, requests, opts \\ [])

call(state, method, params, opts \\ [])

call_tool(state, name, arguments, opts \\ [])

complete(state, request, token)

connect(client)

disconnect(client)

find_matching_tool(state, pattern)

find_tool(state, name)

get_adapter(config, opts)

Gets the adapter module for a client or from configuration.

get_pending_requests(state)

get_prompt(state, name, arguments, opts \\ [])

get_status(state)

list_prompts(state, opts \\ [])

list_resource_templates(state, opts \\ [])

list_resources(state, opts \\ [])

list_roots(state, opts \\ [])

list_tools(state, opts \\ [])

log_message(state, level, message, data \\ nil, opts \\ [])

make_request(state, method, params, opts \\ [])

negotiated_version(state)

notify(state, method, params)

ping(state, opts \\ [])

read_resource(state, uri, opts \\ [])

send_batch(state, requests)

send_cancelled(state, request_id)

server_capabilities(state)

server_info(state)

set_log_level(state, level, opts \\ [])

start_link(config, opts \\ [])

Starts a client with the configured adapter.

stop(state)

subscribe_resource(state, uri, opts \\ [])

tools(state)

unsubscribe_resource(state, uri, opts \\ [])