Quickstart - MCP Java SDK

The convenience mcp module bundles mcp-core with Jackson 3.x JSON serialization:

<dependency>
    <groupId>io.modelcontextprotocol.sdk</groupId>
    <artifactId>mcp</artifactId>
</dependency>

This includes default STDIO, SSE, and Streamable HTTP transport implementations without requiring external web frameworks.

If you need only the core module without a JSON implementation (e.g., to bring your own):

<dependency>
    <groupId>io.modelcontextprotocol.sdk</groupId>
    <artifactId>mcp-core</artifactId>
</dependency>

For Jackson 2.x instead of Jackson 3.x:

<dependency>
    <groupId>io.modelcontextprotocol.sdk</groupId>
    <artifactId>mcp-core</artifactId>
</dependency>
<dependency>
    <groupId>io.modelcontextprotocol.sdk</groupId>
    <artifactId>mcp-json-jackson2</artifactId>
</dependency>

If you're using Spring Framework, the Spring-specific transport implementations are now part of Spring AI 2.0+ (group org.springframework.ai):

<!-- Optional: Spring WebFlux-based SSE and Streamable HTTP client and server transport (Spring AI 2.0+) -->
<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>mcp-spring-webflux</artifactId>
</dependency>

<!-- Optional: Spring WebMVC-based SSE and Streamable HTTP server transport (Spring AI 2.0+) -->
<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>mcp-spring-webmvc</artifactId>
</dependency>

Note

When using the spring-ai-bom or Spring AI starter dependencies (spring-ai-starter-mcp-server-webflux, spring-ai-starter-mcp-server-webmvc, spring-ai-starter-mcp-client-webflux) no explicit version is needed — the BOM manages it automatically.

The convenience mcp module bundles mcp-core with Jackson 3.x JSON serialization:

dependencies {
    implementation "io.modelcontextprotocol.sdk:mcp"
}

This includes default STDIO, SSE, and Streamable HTTP transport implementations without requiring external web frameworks.

If you need only the core module without a JSON implementation (e.g., to bring your own):

dependencies {
    implementation "io.modelcontextprotocol.sdk:mcp-core"
}

For Jackson 2.x instead of Jackson 3.x:

dependencies {
    implementation "io.modelcontextprotocol.sdk:mcp-core"
    implementation "io.modelcontextprotocol.sdk:mcp-json-jackson2"
}

If you're using Spring Framework, the Spring-specific transport implementations are now part of Spring AI 2.0+ (group org.springframework.ai):

// Optional: Spring WebFlux-based SSE and Streamable HTTP client and server transport (Spring AI 2.0+)
dependencies {
    implementation "org.springframework.ai:mcp-spring-webflux"
}

// Optional: Spring WebMVC-based SSE and Streamable HTTP server transport (Spring AI 2.0+)
dependencies {
    implementation "org.springframework.ai:mcp-spring-webmvc"
}