Java SDK

v1.0.0Developer Toolsstable

The official Java SDK for Model Context Protocol servers and clients. Maintained in collaboration with Spring AI

java-sdkmcpai-integration
Share:
3,430
Stars
0
Downloads
0
Weekly
0/5

What is Java SDK?

Java SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to official java sdk for model context protocol servers and clients. maintained in collaboration with spring ai

The official Java SDK for Model Context Protocol servers and clients. Maintained in collaboration with Spring AI

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • The official Java SDK for Model Context Protocol servers and

Use Cases

Build MCP servers and clients with official Java SDK.
Integrate Spring AI with Model Context Protocol (Spring-maintained).
LicenseMIT
Languagejava
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx java-sdk

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Java SDK

The MCP Java SDK is the official Java implementation of the Model Context Protocol, maintained in collaboration with Spring AI. It enables Java developers to build both MCP servers and clients using familiar patterns, supporting synchronous and asynchronous communication, Server-Sent Events, Streamable HTTP, and deep Spring Boot integration via Spring AI 2.0+. Teams already invested in the Java/Spring ecosystem can use this SDK to expose their existing services and data sources as MCP tools and resources consumable by AI clients.

Prerequisites

  • Java 17 or later (Java 21+ recommended for virtual threads)
  • Maven or Gradle build tool
  • Docker (required to run the SDK test suite)
  • Node.js and npx (required for MCP conformance testing)
  • An MCP-compatible client such as Claude Desktop to test your server
1

Add the MCP Java SDK BOM to your Maven project

Import the Bill of Materials in your pom.xml to manage consistent versions across all SDK modules without specifying versions individually.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.modelcontextprotocol.sdk</groupId>
      <artifactId>mcp-bom</artifactId>
      <version>0.10.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
2

Add the mcp dependency

Add the convenience bundle that includes the core MCP implementation plus Jackson 3 serialization. This is the recommended starting point for most projects.

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

Implement an MCP server with stdio transport

Create a server that listens on stdio so an MCP client can launch it as a subprocess. Register tools, resources, and prompts using the SDK's builder APIs.

import io.modelcontextprotocol.sdk.McpServer;
import io.modelcontextprotocol.sdk.transport.StdioServerTransport;

public class MyMcpServer {
    public static void main(String[] args) throws Exception {
        var server = McpServer.sync(new StdioServerTransport())
            .serverInfo("my-server", "1.0.0")
            .tool("greet", "Say hello",
                Map.of("name", McpSchema.STRING),
                req -> new CallToolResult("Hello, " + req.arguments().get("name")))
            .build();
        server.awaitClose();
    }
}
4

Build a runnable JAR

Package your server as an executable JAR using the Maven Shade or Spring Boot plugin so it can be launched as a subprocess by Claude Desktop.

mvn clean package -DskipTests
5

Configure Claude Desktop

Register the JAR in your Claude Desktop configuration. The server communicates via stdin/stdout so no network ports are needed.

Java SDK Examples

Client configuration

Register your compiled Java MCP server JAR in Claude Desktop. Adjust the jar path to match your build output.

{
  "mcpServers": {
    "my-java-server": {
      "command": "java",
      "args": ["-jar", "/path/to/my-mcp-server.jar"]
    }
  }
}

Prompts to try

After registering your Java MCP server, test it by asking your AI client to invoke the tools you exposed.

- "List all available tools from the Java MCP server"
- "Call the greet tool with name set to 'Alice'"
- "What resources does this server expose?"

Troubleshooting Java SDK

Tests fail with Docker not found

The SDK test suite uses Testcontainers, which requires Docker to be running. Start Docker Desktop and re-run ./mvnw test.

ClassNotFoundException at runtime for Jackson classes

Ensure you are using the correct Jackson module. The SDK offers both mcp-json-jackson2 and mcp-json-jackson3. The mcp bundle defaults to jackson3; if your project uses Jackson 2, explicitly depend on mcp-core and mcp-json-jackson2 instead.

Spring Boot auto-configuration conflicts with manual McpServer setup

When using Spring AI 2.0+ starters, remove any manual McpServer bean definitions. The Spring Boot auto-configuration creates and registers the server for you based on @Tool-annotated methods.

Frequently Asked Questions about Java SDK

What is Java SDK?

Java SDK is a Model Context Protocol (MCP) server that official java sdk for model context protocol servers and clients. maintained in collaboration with spring ai It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Java SDK?

Follow the installation instructions on the Java SDK GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Java SDK?

Java SDK works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Java SDK free to use?

Yes, Java SDK is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "java-sdk": { "command": "npx", "args": ["-y", "java-sdk"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Java SDK?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides