A Spring Boot library that exposes your Java methods as Model Context Protocol (MCP) tools over JSON-RPC 2.0. It implements the core MCP 2.0 methods:
initialize
tools/list
tools/call
notifications/initialized
(no-op)
It also provides optional REST helpers for browsing and invoking tools.
Maven:
<dependency>
<groupId>no.webstep.ai</groupId>
<artifactId>mcp-support</artifactId>
<version>0.0.1</version>
</dependency>
Import the provided configuration into your Spring app:
import no.webstep.ai.mcp.McpConfiguration;
@SpringBootApplication
@Import(McpConfiguration.class)
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
@Service
public class DateTimeTool implements McpToolProvider {
@McpTool(description = "Add n units to a ZonedDateTime")
public ZonedDateTime addToZonedDateTime(ZonedDateTime ts, long n, ChronoUnit unit) {
return ts.plus(n, unit);
}
}
mvn spring-boot:run
webstep.ai.mcp.jsonrpc-rest=true
POST /mcp/jsonrpc Accepts single or batch JSON-RPC 2.0 requests. There is no security on the endpoint The handler class can be used in your own controller
no.webstep.ai.mcp.protocol.rpc.rest.McpJsonRpcHandler
curl -s localhost:8080/mcp/jsonrpc -H 'Content-Type: application/json' -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": { "protocolVersion": "2.0", "capabilities": {} }
}'
}'
curl -s localhost:8080/mcp/jsonrpc -H 'Content-Type: application/json' -d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": { "limit": 200 }
}'
curl -s localhost:8080/mcp/jsonrpc -H 'Content-Type: application/json' -d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "datetime.addToZonedDateTime",
"arguments": {
"argsByName": { "ts": "2025-10-03T12:00:00Z", "n": 5, "unit": "MINUTES" }
}
}
}'
Key | Type | Default | Description |
---|---|---|---|
webstep.ai.mcp.jackson-customizer |
Boolean | true |
Should the server configure Spring’s default Jackson customizer. |
webstep.ai.mcp.tool-auto-discoverer |
Boolean | true |
Should the server install all @McpTool from McpToolProvider beans. |
webstep.ai.mcp.rest |
Boolean | false |
Should the server provide default REST endpoint to run tools. |
webstep.ai.mcp.server-name |
String | Webstep-MCP-Server |
The reported server name. Must be non-blank. |
webstep.ai.mcp.server-version |
String | dev |
The reported server version. Must be non-blank. |
webstep.ai.mcp.jsonrpc-rest |
Boolean | false |
Enable JSON-RPC over REST endpoint. |
webstep.ai.mcp.jsonrpc-use-virtual-threads |
Boolean | true |
Execute JSON-RPC requests on virtual threads instead of platform threads. |
webstep.ai.mcp.jsonrpc-min-timeout-seconds |
Integer | 1 |
Minimum per-request timeout in seconds. Values are clamped between 1 and 3600. |
webstep.ai.mcp.jsonrpc-max-timeout-seconds |
Integer | 240 |
Maximum per-request timeout in seconds. Values are clamped between 1 and 3600. |
webstep.ai.mcp.jsonrpc-default-timeout-seconds |
Integer | 60 |
Default per-request timeout in seconds. Values are clamped between 1 and 3600. |
webstep.ai.mcp.jsonrpc-batch-max-thread-count |
Integer | min(max(2, availableProcessors×2), 32) |
Maximum worker threads for JSON-RPC batch execution. Only relevant if not using virtual threads. |
webstep.ai.mcp.jsonrpc-batch-max-queue-size |
Integer | 1000 |
Maximum number of queued JSON-RPC batch requests. Only relevant if not using virtual threads. |