Class DefaultMcpClientFactory
- All Implemented Interfaces:
com.tnsai.spi.McpClientFactory
McpClientFactory shipped by tnsai-mcp.
Adapts a server URL into a Healthcheckable probe that
performs the full MCP initialize handshake against the
remote server and returns
Healthcheckable.HealthStatus.healthy(Duration) only when
the server completes the handshake within the supplied budget.
Discovered via ServiceLoader — the validator
in tnsai-core
(com.tnsai.agents.validation.validators.MCPServerReachabilityValidator,
AGENT-V011) loads this implementation when tnsai-mcp is on
the runtime classpath. Consumers without tnsai-mcp get
graceful silent degradation.
Config map keys
| Key | Type | Effect |
|---|---|---|
headers |
Map<String, String> |
HTTP headers passed to TransportDetector (typically
for Authorization). Other shapes are silently
ignored to keep the contract forward-compatible. |
Unknown keys are ignored — the SPI documents the config
map as intentionally open so future McpClientFactory
implementations can carry additional knobs.
Probe semantics
The returned probe runs the entire detect → connect → initialize
→ disconnect cycle synchronously on the caller's thread. The
validator's outer reachability harness applies the per-probe
timeout via ForkJoinPool cancellation; if the probe
overshoots, an AGENT-V099 INFO issue is emitted by the
harness instead of an AGENT-V011 WARNING.
- Since:
- 0.8.5 (issue #237 follow-up)
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultMcpClientFactory
public DefaultMcpClientFactory()
-
-
Method Details
-
probeFor
- Specified by:
probeForin interfacecom.tnsai.spi.McpClientFactory
-