Java SDK
The official Java SDK for Model Context Protocol servers and clients. Maintained in collaboration with Spring AI
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
Maintainer
Works with
Installation
Manual Installation
npx java-sdkConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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
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>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>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();
}
}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 -DskipTestsConfigure 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.
Java SDK Alternatives — Similar Developer Tools Servers
Looking for alternatives to Java SDK? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
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.
Set Up Java SDK in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.