Class: Rigor::CLI::McpCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/rigor/cli/mcp_command.rb

Overview

Executes the ‘rigor mcp` command.

Starts a long-running MCP (Model Context Protocol) server over stdio. The server exposes Rigor’s analysis tools as MCP tool calls over a newline-delimited JSON-RPC 2.0 stream. See ADR-33.

Slice 1 ships the stdio transport with seven read-only tools: rigor_check, rigor_type_of, rigor_triage, rigor_annotate, rigor_sig_gen, rigor_explain, rigor_coverage.

Constant Summary collapse

USAGE =
"Usage: rigor mcp [options]"

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Rigor::CLI::Command

Instance Method Details

#runInteger

Returns CLI exit status.

Returns:

  • (Integer)

    CLI exit status.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rigor/cli/mcp_command.rb', line 22

def run
  options = parse_options
  return CLI::EXIT_USAGE if options == :usage_error

  transport = options.fetch(:transport)
  unless transport == "stdio"
    @err.puts("rigor mcp: unsupported transport: #{transport.inspect} (only `stdio` is supported in v1)")
    return CLI::EXIT_USAGE
  end

  require_relative "../mcp"
  require_relative "../version"

  server = MCP::Server.new(config_path: options.fetch(:config), err: $stderr)
  loop_runner = MCP::Loop.new(input: $stdin, output: $stdout, server: server)
  loop_runner.run
  0
end