class Riffer::Rig::Runtime::McpRegistrar
Attributes
tag
[R]
Symbol
@dynamic tag
Public Class Methods
(String runtime_id, registry: Riffer::Rig::Mcp::_Registry, host: Riffer::Rig::Hosts::_Host, env: Riffer::Rig::Env, auth_path: String) → void
Source
# File lib/riffer/rig/runtime/mcp_registrar.rb, line 19 def initialize(runtime_id, registry:, host:, env:, auth_path:) # Upstream candidate: riffer's MCP registry is process-wide and keyed by # server name alone, so each Runtime tags its registrations, and two # Runtimes declaring the same name replace each other's. @tag = :"riffer_rig_#{runtime_id}" @registry = registry @host = host @env = env @auth_path = auth_path @servers = {} end
@rbs runtime_id: String @rbs registry: Riffer::Rig::Mcp::_Registry @rbs host: Riffer::Rig::Hosts::_Host @rbs env: Riffer::Rig::Env @rbs auth_path: String @rbs return: void
Public Instance Methods
(Hash[String, Riffer::Rig::Mcp::Declaration] declarations) → Hash[String, Riffer::Rig::Mcp::Server]
Source
# File lib/riffer/rig/runtime/mcp_registrar.rb, line 33 def register(declarations) declarations.filter_map do |name, declaration| resolved = resolve(name, declaration) next nil unless resolved live = @servers[name] server = live && live.declaration == resolved ? live : register_server(name, resolved) [name, server] if server end.to_h end
@rbs declarations: Hash[String, Riffer::Rig::Mcp::Declaration] @rbs return: Hash[String, Riffer::Rig::Mcp::Server]
(Hash[String, Riffer::Rig::Mcp::Server] servers) → void
Source
# File lib/riffer/rig/runtime/mcp_registrar.rb, line 46 def retain(servers) dropped = @servers.except(*servers.keys) @servers = servers # A retired registration was replaced under the same name, by another # Runtime or a later declaration, and is no longer this Runtime's to remove. dropped.each { |name, server| @registry.unregister(name) unless server.registration.retired? } end
@rbs servers: Hash[String, Riffer::Rig::Mcp::Server] @rbs return: void