Class: Coverband::MCP::HttpHandler
- Inherits:
-
Object
- Object
- Coverband::MCP::HttpHandler
- Defined in:
- lib/coverband/mcp/http_handler.rb
Overview
Rack middleware that adds MCP HTTP endpoint support using StreamableHTTPTransport. Can be used to wrap the existing Coverband::Reporters::Web app or mounted standalone.
Usage with existing web UI:
map "/coverage" do
run Coverband::MCP::HttpHandler.new(Coverband::Reporters::Web.new)
end
# MCP endpoint available at /coverage/mcp with full Streamable HTTP transport support
Usage standalone:
map "/mcp" do
run Coverband::MCP::HttpHandler.new
end
Constant Summary collapse
- MCP_PATH =
"/mcp"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app = nil) ⇒ HttpHandler
constructor
A new instance of HttpHandler.
Constructor Details
#initialize(app = nil) ⇒ HttpHandler
Returns a new instance of HttpHandler.
23 24 25 26 27 |
# File 'lib/coverband/mcp/http_handler.rb', line 23 def initialize(app = nil) @app = app @server = nil @transport = nil end |
Instance Method Details
#call(env) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/coverband/mcp/http_handler.rb', line 29 def call(env) request = Rack::Request.new(env) if mcp_request?(request) handle_mcp_request(request) elsif @app @app.call(env) else not_found_response end end |