Class McpServerRegistrar

java.lang.Object
io.agentscope.harness.agent.tools.McpServerRegistrar

public final class McpServerRegistrar extends Object
Registers MCP servers declared under mcpServers in workspace/tools.json into a Toolkit.

Each entry is built into an McpClientWrapper via McpClientBuilder according to its transport (stdio / sse / http) and then registered through Toolkit.registration() so that per-server enableTools allowlists are honoured.

Required connections abort bootstrap. Optional failures are reported through the configured callback and do not prevent other connections from registering.

  • Method Details

    • register

      public static void register(io.agentscope.core.tool.Toolkit toolkit, Map<String,McpServerConfig> servers)
      Registers every entry in servers into toolkit. Synchronous: each server is built and registered before the next is attempted. servers may be null or empty (no-op).
    • register

      public static void register(io.agentscope.core.tool.Toolkit toolkit, Map<String,McpServerConfig> servers, McpServerRegistrationListener listener)
      Registers every entry in servers into toolkit and reports each terminal result to listener. Synchronous: each server is built and registered before the next is attempted. servers or listener may be null.

      Listener failures are logged and do not affect registration or later entries.