Class: Yorishiro::MCP::ServerManager
- Inherits:
-
Object
- Object
- Yorishiro::MCP::ServerManager
- Defined in:
- lib/yorishiro/mcp/server_manager.rb
Instance Attribute Summary collapse
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
Instance Method Summary collapse
-
#initialize(server_configs:, configuration:) ⇒ ServerManager
constructor
A new instance of ServerManager.
- #start_all ⇒ Object
- #stop_all ⇒ Object
Constructor Details
#initialize(server_configs:, configuration:) ⇒ ServerManager
Returns a new instance of ServerManager.
10 11 12 13 14 |
# File 'lib/yorishiro/mcp/server_manager.rb', line 10 def initialize(server_configs:, configuration:) @server_configs = server_configs @configuration = configuration @servers = {} end |
Instance Attribute Details
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
8 9 10 |
# File 'lib/yorishiro/mcp/server_manager.rb', line 8 def servers @servers end |
Instance Method Details
#start_all ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/yorishiro/mcp/server_manager.rb', line 16 def start_all @server_configs.each do |name, config| start_server(name, config) rescue StandardError => e warn "[MCP] Failed to start server '#{name}': #{e.}" end end |
#stop_all ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/yorishiro/mcp/server_manager.rb', line 24 def stop_all @servers.each_value do |server| server[:transport].close rescue StandardError => e warn "[MCP] Error stopping server: #{e.}" end @servers.clear end |