Class: Llmemory::Cli::Commands::Mcp

Inherits:
Base
  • Object
show all
Defined in:
lib/llmemory/cli/commands/mcp.rb

Instance Method Summary collapse

Methods inherited from Base

#parse_options, #run

Instance Method Details

#execute(argv, _opts) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/llmemory/cli/commands/mcp.rb', line 30

def execute(argv, _opts)
  action = argv.shift || "serve"

  case action
  when "serve"
    run_server
  when "help", "--help", "-h"
    show_help
  else
    $stderr.puts "Unknown MCP action: #{action}"
    $stderr.puts "Usage: llmemory mcp [serve] [options]"
    exit 1
  end
end

#option_parser(parser) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/llmemory/cli/commands/mcp.rb', line 9

def option_parser(parser)
  @server_name = "llmemory"
  @http_mode = false
  @port = 3100
  @host = "0.0.0.0"
  @ssl_cert = nil
  @ssl_key = nil

  parser.banner = "Usage: llmemory mcp [serve] [options]"
  parser.on("--name NAME", "Server name (default: llmemory)") { |v| @server_name = v }
  parser.on("--http", "Run as HTTP server instead of stdio") { @http_mode = true }
  parser.on("--port PORT", Integer, "HTTP port (default: 3100)") { |v| @port = v }
  parser.on("--host HOST", "HTTP host (default: 0.0.0.0)") { |v| @host = v }
  parser.on("--ssl-cert FILE", "SSL certificate file for HTTPS") { |v| @ssl_cert = v }
  parser.on("--ssl-key FILE", "SSL private key file for HTTPS") { |v| @ssl_key = v }
  parser.on("-h", "--help", "Show this help") do
    puts parser
    exit
  end
end