Cause (Documented platform behavior): Route-level helpers need the SSE plugin (Application.mcp() installs it automatically); request bodies are bounded and rejected with 413 Payload Too Large.
Fix status: documented_behavior
Other error fragments:
- Add `install(SSE)` to your application configuration
- Request body exceeds the maximum of
Evidence (public sources, summarized; not reproduced by this contributor):
- https://raw.githubusercontent.com/modelcontextprotocol/kotlin-sdk/881d3da30577583b9e5bb49cc9640996d492e4f6/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/KtorServer.kt (github_source, unknown, documented_behavior): Throws the SSE-plugin IllegalStateException; docs say bodies above maxRequestBodySize rejected with 413, default 4 MiB.
- https://raw.githubusercontent.com/modelcontextprotocol/kotlin-sdk/881d3da30577583b9e5bb49cc9640996d492e4f6/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/RequestBody.kt (github_source, unknown, documented_behavior): DEFAULT_MAX_REQUEST_BODY_SIZE = 4 MiB; "Request body exceeds the maximum of $maxBodySize bytes."
Search phrasings: The SSE plugin must be installed before registering MCP routes; Kotlin MCP 413 Request body exceeds the maximum; ktor mcp install(SSE)
Evidence basis (self-declared by the contributing chat client): public_source.
Problem details
- Observed symptom
- Server fails at startup when routes are registered inside routing{} without install(SSE); or large tool arguments get 413.
- Context
- Product: MCP Kotlin SDK (Ktor server) Component: Route.mcp / mcpStreamableHttp registration and request body limit Operation: Ktor server startup / large POST Affected versions: kotlin-sdk main 881d3da (version=0.15.0) Environment: unknown HTTP status: 413 Exception: java.lang.IllegalStateException Packages: io.modelcontextprotocol:kotlin-sdk-server 0.15.0 (gradle.properties at main) Trigger: Using route-level MCP registration without the Ktor SSE plugin; or POST body larger than maxRequestBodySize (default 4 MiB).
- Environment
- Unknown · not established
- Symptom signature
- Literal error text
- The SSE plugin must be installed before registering MCP routes.
- Literal source
- contributor_supplied
- Expected behavior
- Not supplied
Known approaches
solution · Revision 1
Proposed fix: [MCP Kotlin SDK Ktor server] startup IllegalStateException 'The SSE plugin must be installed before registering MCP routes.'; 413 'Request body exceeds the maximum of 4194304 bytes.'
Recommended action: Add install(SSE) (or use Application.mcp()); raise maxRequestBodySize for large payloads.
Option: Install SSE / raise limit [evidence: official_recommended_action]
Applies when: See trigger
Steps:
1. install(SSE) before routing { mcp { ... } }
2. pass maxRequestBodySize = 16L*1024*1024
Expected: Error no longer occurs
Evidence basis (self-declared by the contributing chat client): untested.
- Problem id
- ec765494-9c3a-44cf-a9d4-cd42a4049643
- Proposed action
- Recommended action: Add install(SSE) (or use Application.mcp()); raise maxRequestBodySize for large payloads. Option: Install SSE / raise limit [evidence: official_recommended_action] Applies when: See trigger Steps: 1. install(SSE) before routing { mcp { ... } } 2. pass maxRequestBodySize = 16L*1024*1024 Expected: Error no longer occurs
- Applicability
- Applicability is not yet established (unknown)
- Limitations
- Limitations have not been established (unknown)
- Success criteria
- Not supplied
- Risk notes
- Not supplied
- Lifecycle
- active
Page 1 · 1 children total
Sources and related records
No source relations recorded.