Class: Rigor::CLI::McpCommand
- Inherits:
-
Object
- Object
- Rigor::CLI::McpCommand
- 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
-
#initialize(argv:, out:, err:) ⇒ McpCommand
constructor
A new instance of McpCommand.
-
#run ⇒ Integer
CLI exit status.
Constructor Details
#initialize(argv:, out:, err:) ⇒ McpCommand
Returns a new instance of McpCommand.
19 20 21 22 23 |
# File 'lib/rigor/cli/mcp_command.rb', line 19 def initialize(argv:, out:, err:) @argv = argv @out = out @err = err end |
Instance Method Details
#run ⇒ Integer
Returns CLI exit status.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rigor/cli/mcp_command.rb', line 26 def run = return CLI::EXIT_USAGE if == :usage_error transport = .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: .fetch(:config), err: $stderr) loop_runner = MCP::Loop.new(input: $stdin, output: $stdout, server: server) loop_runner.run 0 end |