Class: OKF::MCP::App::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/okf/mcp/app.rb

Overview

The MCP endpoint is the root and nothing else. The SDK transport routes on method alone, so handed every path it answers a connecting host's OAuth discovery probes (GET /.well-known/*, POST /register — Claude Desktop sends both) with a 405 or a 200-wrapped JSON-RPC parse error: a broken sign-in service instead of an absent one, and the host refuses the connector on it. The WEBrick bridge scopes in its own #handle; this wrapper is the same refusal for a config.ru host.

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ Scope

Returns a new instance of Scope.



33
34
35
# File 'lib/okf/mcp/app.rb', line 33

def initialize(transport)
  @transport = transport
end

Instance Method Details

#call(env) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/okf/mcp/app.rb', line 37

def call(env)
  path = env["PATH_INFO"].to_s
  # "" is the mounted spelling: `map "/mcp"` hands the mount point
  # itself an empty PATH_INFO.
  return not_found unless path.empty? || path == "/"

  @transport.call(env)
end

#closeObject



46
47
48
# File 'lib/okf/mcp/app.rb', line 46

def close
  @transport.close
end