class CrystalMcp::Server

Overview

The main server class that handles JSON-RPC requests over standard I/O.

Defined in:

server.cr

Constant Summary

Log = ::Log.for("server")

Class Method Summary

Class Method Detail

def self.dispatch_request(request) #

Dispatches the parsed JSON-RPC request to the appropriate handler.


[View source]
def self.output : IO #

The IO to write responses to.


[View source]
def self.output=(output : IO) #

The IO to write responses to.


[View source]
def self.process_request(line : String) #

Processes a single request line.


[View source]
def self.run(config : Config = Config.new) #

Starts the server and begins processing requests from standard input.

Spawns a fiber for each incoming request line and waits for all in-flight fibers to complete before returning, ensuring no responses are lost when stdin reaches EOF.

Parameters:

  • config: The server configuration.

[View source]