MCP Annotated Java SDK

v1.0.0โ€ขDeveloper Toolsโ€ขstable

Annotation-driven MCP dev ๐Ÿš€ No Spring, Zero Boilerplate, Pure Java

ai-agentsannotation-drivendeclarativejavamcp
Share:
30
Stars
0
Downloads
0
Weekly
0/5

What is MCP Annotated Java SDK?

MCP Annotated Java SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to annotation-driven mcp dev ๐Ÿš€ no spring, zero boilerplate, pure java

Annotation-driven MCP dev ๐Ÿš€ No Spring, Zero Boilerplate, Pure Java

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

Features

  • Annotation-driven MCP dev ๐Ÿš€ No Spring, Zero Boilerplate, Pur

Use Cases

Build MCP servers in Java using annotations with zero boilerplate.
Develop model context protocol integrations without Spring framework.
Create AI-agent-ready tools with declarative Java syntax.
thought2code

Maintainer

LicenseMIT
Languagejava
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-annotated-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 MCP Annotated Java SDK

The MCP Annotated Java SDK is a lightweight, annotation-driven framework for building MCP servers in pure Java without any dependency on Spring or other heavyweight frameworks. Developers define tools, resources, and prompts by adding annotations like @McpTool, @McpResource, and @McpPrompt to regular Java methods, and the SDK generates the required MCP JSON schemas and wire protocol handling automatically. It requires Java 17+ and is distributed via Maven Central, making it a natural fit for Java developers who want to expose backend logic to AI assistants without learning a new language or runtime.

Prerequisites

  • Java 17 or later (JDK)
  • Maven or Gradle build tool
  • An MCP-compatible client such as Claude Desktop for testing the built server
1

Add the SDK dependency to your project

Add the mcp-annotated-java-sdk dependency to your pom.xml (Maven) or build.gradle (Gradle).

<!-- Maven -->
<dependency>
    <groupId>io.github.thought2code</groupId>
    <artifactId>mcp-annotated-java-sdk</artifactId>
    <version>0.19.0</version>
</dependency>

// Gradle
implementation 'io.github.thought2code:mcp-annotated-java-sdk:0.19.0'
2

Create the server configuration file

Create mcp-server.yml in src/main/resources to configure the server name, version, transport mode, and enabled capabilities.

enabled: true
mode: STDIO
name: my-mcp-server
version: 1.0.0
capabilities:
  resource: true
  tool: true
  prompt: true
3

Write your main entry point

Create a main class annotated with @McpServerApplication and launch it using McpApplication.run().

@McpServerApplication
public class MyMcpServer {
    public static void main(String[] args) {
        McpApplication.run(MyMcpServer.class, args);
    }
}
4

Define tools, resources, and prompts with annotations

Annotate Java methods with @McpTool, @McpResource, or @McpPrompt. Parameters are documented with @McpToolParam or @McpPromptParam.

@McpTool(description = "Add two numbers together")
public int add(
    @McpToolParam(name = "a", description = "First number") int a,
    @McpToolParam(name = "b", description = "Second number") int b
) {
    return a + b;
}

@McpResource(uri = "system://info", description = "System information")
public Map<String, String> getSystemInfo() {
    return Map.of("java.version", System.getProperty("java.version"));
}
5

Build and register with your MCP client

Build a fat JAR with Maven/Gradle and register it in your Claude Desktop config using java -jar.

mvn package -DskipTests
# Then register in claude_desktop_config.json:
# "command": "java", "args": ["-jar", "/path/to/your-server.jar"]

MCP Annotated Java SDK Examples

Client configuration

Claude Desktop JSON configuration for a Java MCP server built with the mcp-annotated-java-sdk.

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

Prompts to try

Example prompts for testing a Java MCP server built with annotated tools and resources.

- "Call the add tool with a=15 and b=27"
- "Read the system://info resource and tell me the Java version"
- "Use the generate-code prompt with language=Java and task='read a file line by line'"
- "List all available tools on the my-java-mcp server"
- "Execute the database query tool with query='SELECT COUNT(*) FROM users'"

Troubleshooting MCP Annotated Java SDK

ClassNotFoundException or NoSuchMethodError at startup

Ensure you are running Java 17 or later. Check with 'java -version'. The SDK uses Java 17 features and will fail to load on older JVMs. Also verify you built a fat/uber JAR that includes all dependencies, not just the compiled classes.

Tools are not discovered โ€” Claude sees an empty tool list

The @McpServerApplication class and @McpTool-annotated methods must be in the same package or sub-packages. Ensure capabilities.tool is set to true in mcp-server.yml. Rebuild and re-deploy the JAR after any annotation changes.

mcp-server.yml not found on classpath

Place mcp-server.yml in src/main/resources so Maven/Gradle includes it in the JAR. Verify it appears at the root of the classpath by running 'jar tf your-server.jar | grep mcp-server'.

Frequently Asked Questions about MCP Annotated Java SDK

What is MCP Annotated Java SDK?

MCP Annotated Java SDK is a Model Context Protocol (MCP) server that annotation-driven mcp dev ๐Ÿš€ no spring, zero boilerplate, pure java It connects AI assistants to external tools and data sources through a standardized interface.

How do I install MCP Annotated Java SDK?

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

Which AI clients work with MCP Annotated Java SDK?

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

Is MCP Annotated Java SDK free to use?

Yes, MCP Annotated 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": { "mcp-annotated-java-sdk": { "command": "npx", "args": ["-y", "mcp-annotated-java-sdk"] } } }

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

Read the full setup guide โ†’

Ready to use MCP Annotated 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