Class MCPConnector
java.lang.Object
ai.redouble.nucleo.mcp.MCPConnector
Single attached MCP server, identified by an
MCPHandle. Holds the
MCPEndpoint configuration and the lazily-resolved list of
MCPToolProviders pulled from listTools.
The connector is not AutoCloseable from the user's perspective;
its lifecycle is owned by MCPConnectorRegistry. The registry releases the
underlying MCPClient via MCPClientPool.evict(String) only when the
refcount on the endpoint id drops to zero, so connectors that share an endpoint
(different handles, same URL+headers) share one underlying client.
providers() is synchronized so concurrent attaches racing the same
handle issue exactly one listTools JSON-RPC roundtrip; subsequent callers see
the cached list. On failure the connector returns the last-known-good list (empty if
never connected) and lets the next call retry; a network blip never permanently shrinks
the LLM's tool surface.
- Since:
- 0.1 (2026-05-08)
- Author:
- Andrey Santrosyan
-
Method Summary
Modifier and TypeMethodDescriptionendpoint()handle()voidDrops the cached provider list.booleanReturns providers, lazily fetching the tool list on first call and on each subsequent call afterinvalidate()has dropped the cache.
-
Method Details
-
handle
-
endpoint
-
providers
Returns providers, lazily fetching the tool list on first call and on each subsequent call afterinvalidate()has dropped the cache. On transport failure returns the last-known-good list (empty if never connected) and logs the failure - the caller is not responsible for retry handling. -
invalidate
public void invalidate()Drops the cached provider list. The nextproviders()call re-fetches. -
serverInfo
-
isHealthy
public boolean isHealthy()
-