-
Notifications
You must be signed in to change notification settings - Fork 173
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
There is no Route.mcp() method, and this causes issues since Routing.mcp() seems to register the route on the top-level instead of the route where I need it. It seems like the example in the README.md is broken since that registers on the top-level instead of the route.
I had to add this locally to make it work
@KtorDsl
fun Route.mcp(block: () -> Server) {
val transports = ConcurrentMap<String, SseServerTransport>()
sse { mcpSseEndpoint("", transports, block) }
post { mcpPostEndpoint(transports) }
}
Now with this I can actually use it as intended
route("/mcp") {
authenticate("mcp-bearer") { mcp { mcpServer } }
}
But with the Routing.mcp() it did not get registered in the right location. I also had to copy over util methods below to make it work since these we internal
suspend fun ServerSSESession.mcpSseEndpoint
internal fun ServerSSESession.mcpSseTransport
suspend fun RoutingContext.mcpPostEndpoint(transports: ConcurrentMap<String, SseServerTransport>)
Many thanks
schurmann, konrader, wrimle, jeppes-sana, vp-mazekine and 2 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working