MCP Java SDK Examples
A collection of MCP server examples developed by various Java SDKs
What is MCP Java SDK Examples?
MCP Java SDK Examples is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to collection of mcp server examples developed by various java sdks
A collection of MCP server examples developed by various Java SDKs
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A collection of MCP server examples developed by various Jav
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-java-sdk-examplesConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP Java SDK Examples
MCP Java SDK Examples is a curated repository of Model Context Protocol server implementations using three different Java SDKs: the lightweight Declarative MCP Java SDK, the Official MCP Java SDK, and the Spring AI MCP SDK. It serves as a practical reference for Java developers who want to build their own MCP servers, providing runnable examples that demonstrate resources, tools, and prompt templates. Java teams evaluating which SDK best fits their stack will find side-by-side implementations useful for comparison.
Prerequisites
- Java 17 or later (JDK, not just JRE)
- Maven or Gradle build tool (depending on which example you run)
- Basic familiarity with the Model Context Protocol concepts (resources, tools, prompts)
- An MCP-compatible client such as Claude Desktop for testing the built servers
Clone the repository
Clone the mcp-java-sdk-examples repository to your local machine.
git clone https://github.com/thought2code/mcp-java-sdk-examples.git
cd mcp-java-sdk-examplesExplore the SDK examples
The repository contains subdirectories for each SDK. Browse the directories to find the example that matches your preferred SDK (Declarative, Official, or Spring AI).
ls -laBuild a specific example
Navigate to the chosen example's directory and build it with Maven or Gradle. Adjust the build command to match the build tool used in that subdirectory.
# For a Maven-based example
cd declarative-sdk-example
mvn clean package -DskipTests
# For a Gradle-based example
cd official-sdk-example
./gradlew buildRun the built MCP server
Start the compiled server JAR. The server communicates over stdio by default, making it compatible with any stdio-based MCP client.
java -jar target/mcp-example.jarConfigure your MCP client to connect
Point your MCP client at the running Java server by configuring it to launch the JAR via the java command. Adjust the path to match your built artifact.
{
"mcpServers": {
"java-mcp-example": {
"command": "java",
"args": ["-jar", "/path/to/mcp-java-sdk-examples/declarative-sdk-example/target/mcp-example.jar"]
}
}
}MCP Java SDK Examples Examples
Client configuration
Claude Desktop configuration for connecting to a built Java MCP SDK example server.
{
"mcpServers": {
"java-mcp-example": {
"command": "java",
"args": ["-jar", "/path/to/mcp-java-sdk-examples/declarative-sdk-example/target/mcp-example.jar"]
}
}
}Prompts to try
After connecting a built example server, these prompts test the MCP capabilities it exposes.
- "List all available tools exposed by the connected Java MCP server."
- "List all resources available from the server."
- "Execute the sample tool and show me its output."
- "Retrieve the example resource and summarize its content."Troubleshooting MCP Java SDK Examples
Build fails with 'source release 17 requires target release 17'
Your JAVA_HOME points to an older JDK. Install JDK 17+ and update JAVA_HOME, or use 'sdk use java 17' if you have SDKMAN installed. Verify with 'java -version'.
MCP client cannot launch the server — 'No such file or directory'
Ensure the JAR was built successfully (check for it in target/ or build/libs/) and that the path in the MCP config is absolute and correct. Run 'java -jar /full/path/to/mcp-example.jar' directly in a terminal to confirm it starts.
Spring AI example fails to start with dependency resolution errors
Spring AI MCP SDK dependencies may require a specific Spring Boot version. Check the pom.xml or build.gradle for the required Spring Boot BOM version and ensure you have network access to Maven Central during the build.
Frequently Asked Questions about MCP Java SDK Examples
What is MCP Java SDK Examples?
MCP Java SDK Examples is a Model Context Protocol (MCP) server that collection of mcp server examples developed by various java sdks It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP Java SDK Examples?
Follow the installation instructions on the MCP Java SDK Examples GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP Java SDK Examples?
MCP Java SDK Examples works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP Java SDK Examples free to use?
Yes, MCP Java SDK Examples is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
MCP Java SDK Examples Alternatives — Similar Developer Tools Servers
Looking for alternatives to MCP Java SDK Examples? 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 MCP Java SDK Examples 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 MCP Java SDK Examples?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.