Class: RailVerdict::MCP::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/rail_verdict/mcp/server.rb

Constant Summary collapse

PROTOCOL_VERSION =
"2025-11-25"
SERVER_NAME =
"railverdict"
SERVER_TITLE =
"RailVerdict"
INSTRUCTIONS =
"RailVerdict is a read-only verifier. It never edits source, creates commits, or mutates baselines/waivers. Use verify -> list_findings -> get_finding -> build_repair_packet -> external edit -> verify_repair -> PASS/FAIL/INCOMPLETE. Gate FAIL is a successful result, not a protocol error. AI tools are advisory and off by default."

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository_root: nil) ⇒ Server

Returns a new instance of Server.



15
16
17
18
19
20
# File 'lib/rail_verdict/mcp/server.rb', line 15

def initialize(repository_root: nil)
  @repository_root = RepositoryRoot.resolve(repository_root)
  @mutex = Mutex.new
  @cache = Cache.new
  @mcp_server = build_mcp_server
end

Instance Attribute Details

#repository_rootObject (readonly)

Returns the value of attribute repository_root.



13
14
15
# File 'lib/rail_verdict/mcp/server.rb', line 13

def repository_root
  @repository_root
end

Instance Method Details

#cacheObject



35
36
37
# File 'lib/rail_verdict/mcp/server.rb', line 35

def cache
  @cache
end

#mcp_serverObject



31
32
33
# File 'lib/rail_verdict/mcp/server.rb', line 31

def mcp_server
  @mcp_server
end

#serveObject



22
23
24
25
26
27
28
29
# File 'lib/rail_verdict/mcp/server.rb', line 22

def serve
  diagnostics_to_stderr
  trap_signals
  transport = ::MCP::Server::Transports::StdioTransport.new(@mcp_server)
  transport.open
ensure
  ProcessRunner.registry.terminate_all rescue nil
end

#synchronized_verification(&block) ⇒ Object



39
40
41
# File 'lib/rail_verdict/mcp/server.rb', line 39

def synchronized_verification(&block)
  @mutex.synchronize(&block)
end