module Riffer::Mcp::Registry
Thread-safe global store for MCP server registrations.
Keyed by manifest name. All public methods are mutex-guarded.
Public Class Methods
Source
# File lib/riffer/mcp/registry.rb, line 20 def register(manifest_or_hash) # steep cannot verify that an untyped Hash splat supplies Manifest's # required name:/endpoint: keywords; Manifest validates them at runtime. manifest = manifest_or_hash.is_a?(Riffer::Mcp::Manifest) ? manifest_or_hash : Riffer::Mcp::Manifest.new(**manifest_or_hash) # steep:ignore InsufficientKeywordArguments registration = Riffer::Mcp::Registration.new(manifest) old = @mutex.synchronize do previous = @store[manifest.name] @store[manifest.name] = registration previous end old&.retire! registration end
Registers an MCP server and starts async tool discovery.
Accepts a Manifest instance or a hash of manifest keyword arguments. Replaces any existing registration with the same name.
Source
# File lib/riffer/mcp/registry.rb, line 47 def registrations @mutex.synchronize { @store.dup.freeze } end
Returns a frozen snapshot of all current registrations.
Source
# File lib/riffer/mcp/registry.rb, line 38 def unregister(name) removed = @mutex.synchronize { @store.delete(name.to_s) } removed&.retire! end
Removes a registration by name.