# Class MCPClientRegistrar

java.lang.Object
com.codename1.mcp.MCPClientRegistrar

public final class MCPClientRegistrar extends Object

Detects installed MCP hosts and registers a Codename One application's stdio MCP server with them, so an end user can point Claude Desktop, Claude Code, Codex and similar tools at the application without editing config by hand.

Two config shapes are written: the JSON `mcpServers` object the Claude hosts use, and the `[mcp_servers.<name>]` tables Codex keeps in `~/.codex/config.toml` (see `MCPToml`). Either way the user's other servers and settings are preserved, and a config that cannot be edited safely is reported and left alone.

This is a plain reusable API. It is meant to be driven by Codename One tooling (the certificate wizard, Game Builder, Settings, the simulator) and by applications themselves.

Registration is a desktop concern. File access goes through `FileSystemStorage` so the class links on every target, but `isSupported()` is false where the platform provides no reachable home directory (mobile), and each detected host reports whether its config is writable.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `MCPClientRegistrar.MCPClient`
  A detected MCP host and where its config lives.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<MCPClientRegistrar.MCPClient>`
  `detectClients()`
  Detects installed MCP hosts by looking for their config file or its parent directory under the user home.
  `static MCPClientRegistrar`
  `getInstance()`
  `boolean`
  `isSupported()`
  Returns true when this platform exposes a home directory the registrar can reach.
  `List<MCPClientRegistrar.MCPClient>`
  `register(MCPClientDescriptor descriptor)`
  Registers the descriptor with every detected, writable host.
  `List<MCPClientRegistrar.MCPClient>`
  `register(MCPClientDescriptor descriptor, List<MCPClientRegistrar.MCPClient> clients)`
  Registers the descriptor with the given hosts.
  `List<MCPClientRegistrar.MCPClient>`
  `unregister(String serverName)`
  Removes the named server entry from every detected, writable host.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getInstance

    public static MCPClientRegistrar getInstance()

  - ### isSupported

    public boolean isSupported()
    Returns true when this platform exposes a home directory the registrar can reach.

  - ### detectClients

    public List<MCPClientRegistrar.MCPClient> detectClients()
    Detects installed MCP hosts by looking for their config file or its parent directory under the user home.

  - ### register

    public List<MCPClientRegistrar.MCPClient> register(MCPClientDescriptor descriptor)
    Registers the descriptor with every detected, writable host. Returns the list of hosts that were updated.

  - ### register

    public List<MCPClientRegistrar.MCPClient> register(MCPClientDescriptor descriptor, List<MCPClientRegistrar.MCPClient> clients)
    Registers the descriptor with the given hosts. Non writable hosts are skipped.

  - ### unregister

    public List<MCPClientRegistrar.MCPClient> unregister(String serverName)
    Removes the named server entry from every detected, writable host. Returns the list of hosts that were updated.