class
ActionController::MCPServer::Transport
- ActionController::MCPServer::Transport
- Reference
- Object
Overview
implements the Streamable HTTP transport, statelessly. Each POST is handled on its own, so the requests of a client can be served by any instance of the application.
2026-07-28 requests carry their protocol version and client capabilities in _meta,
earlier versions start with initialize and no session is created
Defined in:
action-controller/mcp/transport.crConstant Summary
-
META_CAPABILITIES =
"io.modelcontextprotocol/clientCapabilities" -
META_SERVER_INFO =
"io.modelcontextprotocol/serverInfo" -
META_SUBSCRIPTION =
"io.modelcontextprotocol/subscriptionId" -
META_VERSION =
"io.modelcontextprotocol/protocolVersion" -
METHOD_HEADER =
"Mcp-Method" -
NAME_HEADER =
"Mcp-Name" -
NAMED_METHODS =
{"tools/call" => "name", "prompts/get" => "name", "resources/read" => "uri"} -
methods that name a tool, prompt or resource in the
Mcp-Nameheader -
RESOURCE_METADATA_PATH =
"/.well-known/oauth-protected-resource" -
VERSION_HEADER =
"MCP-Protocol-Version"
Constructors
-
.new(route_handler : Router::RouteHandler, path : String = "/mcp", endpoint : Bool = false, composition : Composition = Composition.default)
endpoint: trueserves the controller endpoint mounted at#path
Instance Method Summary
- #auth_cache : AuthCache
-
#bound : Array(String)
the path params bound from the URL, for controller endpoints
-
#close_subscriptions : Nil
completes every open
subscriptions/listenstream, i.e. -
#method_not_allowed(context : HTTP::Server::Context) : HTTP::Server::Context
there are no event streams or sessions, so GET and DELETE aren't supported
-
#path : String
the path the transport is mounted at, a template for controller endpoints
-
#post(context : HTTP::Server::Context) : HTTP::Server::Context
client to server messages
- #protocol : Protocol
-
#resource_metadata(context : HTTP::Server::Context) : HTTP::Server::Context
OAuth 2.0 protected resource metadata, see
MCPServer.resource_metadata
Constructor Detail
endpoint: true serves the controller endpoint mounted at #path
Instance Method Detail
completes every open subscriptions/listen stream, i.e. when shutting down. Clients
listen again, to another instance
there are no event streams or sessions, so GET and DELETE aren't supported
client to server messages
OAuth 2.0 protected resource metadata, see MCPServer.resource_metadata