Enable Explicit Api (#21)

This commit is contained in:
Alexander Sysoev 2024-12-16 20:59:53 +01:00 • committed by GitHub
commit 852a4a3d5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 291 additions and 272 deletions

View file

@ -1,5 +1,3 @@
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
import org.jetbrains.kotlinx.mcp.JSONRPCMessage
import org.jetbrains.kotlinx.mcp.shared.Transport
@ -7,8 +5,6 @@ import org.jetbrains.kotlinx.mcp.shared.Transport
* In-memory transport for creating clients and servers that talk to each other within the same process.
*/
class InMemoryTransport : Transport {
private val scope = CoroutineScope(SupervisorJob())
private var otherTransport: InMemoryTransport? = null
private val messageQueue: MutableList<JSONRPCMessage> = mutableListOf()
@ -55,4 +51,4 @@ class InMemoryTransport : Transport {
other.messageQueue.add(message)
}
}
}
}

View file

@ -11,13 +11,13 @@ import io.ktor.util.AttributeKey
import io.ktor.util.Attributes
import kotlinx.coroutines.CompletableDeferred
import org.jetbrains.kotlinx.mcp.Implementation
import org.jetbrains.kotlinx.mcp.LIB_VERSION
import org.jetbrains.kotlinx.mcp.ServerCapabilities
import org.jetbrains.kotlinx.mcp.server.SESSION_ID_PARAM
import org.jetbrains.kotlinx.mcp.server.SSEServerTransport
import org.jetbrains.kotlinx.mcp.server.Server
import org.jetbrains.kotlinx.mcp.server.ServerOptions
import org.jetbrains.kotlinx.mcp.shared.IMPLEMENTATION_NAME
import shared.LIB_VERSION
typealias IncomingHandler = suspend RoutingContext.(forward: suspend () -> Unit) -> Unit