GenServer that owns the protocol state for a single MCP server connection.
The process spawns the configured transport, performs the
initialize / notifications/initialized / tools/list handshake,
and then services synchronous tool calls from callers.
In normal use, callers do not interact with this module directly:
Condukt.MCP.start_all/2 builds a list of clients and turns each
server's tools into Condukt.Tool.Inline specs ready to drop into an
agent or workflow tool list. Use start_link/2 directly when you
need finer control.
Summary
Functions
Calls a tool on the connected server. The result is the raw content
block returned by the server, normalized into a single string when
the server returns text-only content. Errors include both transport
errors and isError: true tool responses.
Returns a specification to start this module under a supervisor.
Returns the serverInfo block returned by the server during the
initialize handshake.
Starts a client and blocks the caller until the connection is ready or fails.
Stops the client and closes the underlying transport.
Returns the cached tools/list descriptors discovered during
initialization.
Functions
Calls a tool on the connected server. The result is the raw content
block returned by the server, normalized into a single string when
the server returns text-only content. Errors include both transport
errors and isError: true tool responses.
Returns a specification to start this module under a supervisor.
See Supervisor.
Returns the serverInfo block returned by the server during the
initialize handshake.
Starts a client and blocks the caller until the connection is ready or fails.
Options:
:name- register the GenServer under a name:fetch_env- injection point for env-backed auth/secret refs (testing):token_request- injection point for the OAuth token endpoint (testing):sse_request/:http_request- injection points for the HTTP transports (testing)
Stops the client and closes the underlying transport.
Returns the cached tools/list descriptors discovered during
initialization.