Class: Rubino::Commands::Handlers::MCP
- Inherits:
-
Object
- Object
- Rubino::Commands::Handlers::MCP
- Defined in:
- lib/rubino/commands/handlers/mcp.rb
Overview
The ‘/mcp` in-chat management of MCP servers (#182), extracted from Commands::Executor (batch B). Shaped like /skills:
/mcp → server list: status, transport, tool count
/mcp <server> → drill-in: transport/target, health, its tools
/mcp <server> off → stop the client + deregister its tools (session)
/mcp <server> on → (re)start the client + register its tools
/mcp reload → re-read config.yml and reconnect every server
List/drill-in read the LIVE booted manager (Rubino::MCP.manager) and never re-spawn stdio servers — doctor’s start/stop dance is wrong inside a session that already holds clients. ‘off` is session-scoped, like /skills activation; persistent disable stays a config edit (mcp.enabled or removing the server).
Instance Method Summary collapse
- #handle_mcp(arguments) ⇒ Object
-
#initialize(ui:) ⇒ MCP
constructor
A new instance of MCP.
Constructor Details
#initialize(ui:) ⇒ MCP
Returns a new instance of MCP.
23 24 25 |
# File 'lib/rubino/commands/handlers/mcp.rb', line 23 def initialize(ui:) @ui = ui end |
Instance Method Details
#handle_mcp(arguments) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rubino/commands/handlers/mcp.rb', line 27 def handle_mcp(arguments) server, action = arguments.to_s.strip.split(/\s+/) # reload must work BEFORE the enabled? gate: its whole point is picking # up a config edit (e.g. a first server added mid-session). return reload_mcp if server == "reload" unless Rubino::MCP.enabled? show_mcp_empty_state return end server.nil? ? show_mcp_list : handle_mcp_server(server, action) end |