Class: Esp::CLI::Mcp

Inherits:
Thor
  • Object
show all
Includes:
Support
Defined in:
lib/esp/cli/mcp.rb

Overview

‘esp mcp` — Model Context Protocol frontend. `serve` speaks JSON-RPC over stdio so an AI client can drive the toolchain as native tools; `install` wires that server into a client’s config.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


12
# File 'lib/esp/cli/mcp.rb', line 12

def self.exit_on_failure? = true

Instance Method Details

#installObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/esp/cli/mcp.rb', line 29

def install
  result = Esp::McpInstaller.install(options[:client], name: options[:name])
  respond(result_payload(result)) do
    say t('mcp.install.result', action: result.action, name: result.name, label: result.label)
    say t('mcp.install.config', path: result.config_path)
    say t('mcp.install.restart') if needs_restart?(result)
  end
rescue ArgumentError => e
  fail_with(e.message)
end

#serveObject



17
18
19
20
21
# File 'lib/esp/cli/mcp.rb', line 17

def serve
  # stdout is the protocol channel — never print to it here.
  warn(t('mcp.serve.listening'))
  Esp::McpServer.new.start
end