ExMCP.ServiceRegistry behaviour (ex_mcp v0.9.0)
View SourcePluggable service registry behaviour for ExMCP.Native service discovery.
By default, uses ExMCP.ServiceRegistry.Local which wraps Elixir's built-in
Registry module — zero external dependencies required.
For distributed clusters, configure the Horde adapter:
# config/config.exs
config :ex_mcp, :service_registry, ExMCP.ServiceRegistry.HordeImplementing a Custom Adapter
Implement all callbacks defined in this module:
defmodule MyApp.CustomRegistry do
@behaviour ExMCP.ServiceRegistry
@impl true
def child_specs(_opts), do: [...]
@impl true
def register(name, metadata), do: ...
# ... etc
end
Summary
Callbacks
Returns child specs for the registry processes to be started under the supervision tree.
Lists all registered services as {name, pid, metadata} tuples.
Looks up the process registered under name.
Registers the calling process under name with the given metadata.
Unregisters the calling process from name.
Callbacks
@callback child_specs(opts :: keyword()) :: [Supervisor.child_spec() | {module(), term()}]
Returns child specs for the registry processes to be started under the supervision tree.
Lists all registered services as {name, pid, metadata} tuples.
Looks up the process registered under name.
Registers the calling process under name with the given metadata.
@callback unregister(name :: atom()) :: :ok
Unregisters the calling process from name.
Functions
@spec adapter() :: module()
Returns the configured service registry adapter.
Defaults to ExMCP.ServiceRegistry.Local.