Skip to content

Commit 121cdf5

Browse files
Bruce Haumanclaude
andcommitted
Fix MCP SDK 0.15.0 compatibility issues
Update core.clj to work with MCP SDK 0.15.0 API changes: - Replace ObjectMapper with McpJsonMapper in imports and usage - Use Builder pattern for McpSchema$Tool construction - Update StdioServerTransportProvider to use McpJsonMapper This fixes compilation errors introduced by the SDK update in commit 5e297a1. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fbb4caf commit 121cdf5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/clojure_mcp/core.clj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
McpServerFeatures$AsyncToolSpecification
3737
McpServerFeatures$AsyncPromptSpecification]
3838
[reactor.core.publisher Mono]
39-
[com.fasterxml.jackson.databind ObjectMapper]))
39+
[io.modelcontextprotocol.json McpJsonMapper]))
4040

4141
(defn create-mono-from-callback
4242
"Creates a function that takes the exchange and the arguments map and
@@ -82,14 +82,20 @@
8282
* clj-result-k - continuation fn taking vector of strings and boolean error flag."
8383
[{:keys [name description schema tool-fn]}]
8484
(let [schema-json (json/write-str schema)
85+
json-mapper (McpJsonMapper/getDefault)
86+
mcp-tool (-> (McpSchema$Tool/builder)
87+
(.name name)
88+
(.description description)
89+
(.inputSchema json-mapper schema-json)
90+
(.build))
8591
mono-fn (create-mono-from-callback
8692
(fn [exchange arg-map mono-fill-k]
8793
(let [clj-result-k
8894
(fn [res-list error?]
8995
(mono-fill-k (adapt-results res-list error?)))]
9096
(tool-fn exchange arg-map clj-result-k))))]
9197
(McpServerFeatures$AsyncToolSpecification.
92-
(McpSchema$Tool. name description schema-json)
98+
mcp-tool
9399
(reify java.util.function.BiFunction
94100
(apply [this exchange arguments]
95101
(log/debug (str "Args from MCP: " (pr-str arguments)))
@@ -217,7 +223,7 @@
217223
[]
218224
(log/info "Starting MCP server")
219225
(try
220-
(let [transport-provider (StdioServerTransportProvider. (ObjectMapper.))
226+
(let [transport-provider (StdioServerTransportProvider. (McpJsonMapper/getDefault))
221227
server (-> (McpServer/async transport-provider)
222228
(.serverInfo "clojure-server" "0.1.11")
223229
(.capabilities (-> (McpSchema$ServerCapabilities/builder)

0 commit comments

Comments
 (0)