module Riffer::Mcp::Registry
Thread-safe global store for MCP server registrations, keyed by manifest name.
Public Instance Methods
Source
# File lib/riffer/mcp/registry.rb, line 18 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, replacing any existing registration with the same name.
Source
# File lib/riffer/mcp/registry.rb, line 45 def registrations @mutex.synchronize { @store.dup.freeze } end
Returns a frozen snapshot of all current registrations.
Source
# File lib/riffer/mcp/registry.rb, line 36 def unregister(name) removed = @mutex.synchronize { @store.delete(name.to_s) } removed&.retire! end
Removes a registration by name.