Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lazy val Versions = new {
val jackson = "2.20.0"
val tapir = "1.11.42"
val jsonSchemaCirce = "0.11.10"
val mcpSdk = "0.11.3"
val mcpSdk = "0.13.1"
val scalaTest = "3.2.19"
}

Expand Down
7 changes: 5 additions & 2 deletions src/main/scala/com/tjclp/fastmcp/core/Types.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tjclp.fastmcp.core

import io.modelcontextprotocol.json.McpJsonMapper
import io.modelcontextprotocol.spec.McpSchema
import io.modelcontextprotocol.spec.McpSchema.Tool
import zio.json.*
Expand Down Expand Up @@ -45,8 +46,10 @@ object ToolDefinition:
// Directly use McpSchema.JsonSchema
baseToolBuilder.inputSchema(mcpSchema)
case Right(stringSchema) =>
// Use string schema - MCP SDK will parse it
baseToolBuilder.inputSchema(stringSchema)
// Parse string schema to JsonSchema using McpJsonMapper
val jsonMapper = McpJsonMapper.createDefault()
val jsonSchema = jsonMapper.readValue(stringSchema, classOf[McpSchema.JsonSchema])
baseToolBuilder.inputSchema(jsonSchema)
}
toolBuilder.build()

Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/com/tjclp/fastmcp/server/FastMcpServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package server

import com.tjclp.fastmcp.core.*
import com.tjclp.fastmcp.server.manager.*
import io.modelcontextprotocol.json.McpJsonMapper
import io.modelcontextprotocol.server.McpAsyncServer
import io.modelcontextprotocol.server.McpAsyncServerExchange
import io.modelcontextprotocol.server.McpServer
Expand Down Expand Up @@ -160,7 +161,8 @@ class FastMcpServer(
ZIO.scoped { // ⬅ drops the `Scope` requirement
ZIO.acquireRelease(
for {
provider <- ZIO.attempt(new StdioServerTransportProvider())
jsonMapper <- ZIO.attempt(McpJsonMapper.createDefault())
provider <- ZIO.attempt(new StdioServerTransportProvider(jsonMapper))
_ <- ZIO.attempt(setupServer(provider))
_ <- ZIO.attempt(
JSystem.err.println(
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/com/tjclp/fastmcp/TestFixtures.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.tjclp.fastmcp

import com.fasterxml.jackson.core.`type`.TypeReference
import com.tjclp.fastmcp.server.McpContext
import io.modelcontextprotocol.json.TypeRef
import io.modelcontextprotocol.server.McpAsyncServerExchange
import io.modelcontextprotocol.spec.McpLoggableSession
import io.modelcontextprotocol.spec.McpSchema
Expand All @@ -19,7 +19,7 @@ object TestFixtures {
override def sendRequest[T](
method: String,
params: Object,
typeRef: TypeReference[T]
typeRef: TypeRef[T]
): Mono[T] = Mono.empty()
override def sendNotification(method: String): Mono[Void] = Mono.empty()
override def sendNotification(method: String, obj: Object): Mono[Void] = Mono.empty()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.tjclp.fastmcp
package macros

import com.fasterxml.jackson.core.`type`.TypeReference
import io.modelcontextprotocol.json.TypeRef
import io.modelcontextprotocol.server.McpAsyncServerExchange
import io.modelcontextprotocol.spec.McpSchema
import org.scalatest.funsuite.AnyFunSuite
Expand Down Expand Up @@ -130,7 +130,7 @@ class NoopLoggableSession extends io.modelcontextprotocol.spec.McpLoggableSessio
override def sendRequest[T](
method: String,
params: Object,
typeRef: TypeReference[T]
typeRef: TypeRef[T]
): reactor.core.publisher.Mono[T] = reactor.core.publisher.Mono.empty()

override def sendNotification(method: String): reactor.core.publisher.Mono[Void] =
Expand Down