Skip to content

Commit 1384a8f

Browse files
committed
Fix for initialization in non-osgi environment case
1 parent d4bf65e commit 1384a8f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mcp-core/src/main/java/io/modelcontextprotocol/json/internal/DefaultMcpJson.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ void unsetMcpJsonMapperSupplier(McpJsonMapperSupplier supplier) {
2626
}
2727

2828
public synchronized static McpJsonMapper getDefaultMcpJsonMapper() {
29+
if (mcpMapperServiceLoader == null) {
30+
new DefaultMcpJson();
31+
}
2932
return mcpMapperServiceLoader.getDefault();
3033
}
3134

@@ -38,6 +41,9 @@ void unsetJsonSchemaValidatorSupplier(JsonSchemaValidatorSupplier supplier) {
3841
}
3942

4043
public synchronized static JsonSchemaValidator getDefaultJsonSchemaValidator() {
44+
if (mcpValidatorServiceLoader == null) {
45+
new DefaultMcpJson();
46+
}
4147
return mcpValidatorServiceLoader.getDefault();
4248
}
4349

0 commit comments

Comments
 (0)