1. Conduid
  2. Developer Tools
  3. Java MCP Annotations
MCP server · Developer Tools

Java MCP Annotations

Java Annotations to describe MCP server features

Unclaimed devtools
34Low

Scored 6 months ago · breakdown

About Java MCP Annotations

Java MCP Annotations is an MCP server published by mcp-java in the Developer Tools category: java Annotations to describe MCP server features.

The repository has 3 stars and 6 forks, with the last commit 3 months ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

From source
git clone https://github.com/mcp-java/java-mcp-annotations

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Java MCP Annotations

Powered by Claude · Grounded in docs

I know everything about Java MCP Annotations. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.

5 checks have not been run yet.

README

Java MCP Annotations & APIs

A framework-agnostic Java library providing core annotations and APIs for implementing Model Context Protocol (MCP) servers and clients.

Overview

This repository provides common Java building blocks for MCP implementations without tying you to any specific runtime framework (Spring, Quarkus, Micronaut, WildFly, Open Liberty, etc.). It enables developers to create portable MCP integrations that can work across different Java ecosystems.

What is MCP?

The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It enables secure, controlled interactions between AI assistants and data sources, tools, and services.

Project Structure

This repository is organized into three core modules:

mcp-model

Complete Java model representing the MCP protocol specification:

  • JSON-RPC: Request, response, notification, and error types
  • Tools: Tool definitions, call requests/results, schemas
  • Prompts: Prompt messages, arguments, and responses
  • Resources: Resource contents, templates, and subscriptions
  • Content: Text, image, audio, and embedded resource content types
  • Completion: Auto-completion support for prompts and resources
  • Sampling & Elicitation: LLM sampling and user interaction requests
  • Common types: Roles, roots, icons, metadata, progress tracking

Package: org.mcp_java.model.*

mcp-annotations

Framework-agnostic annotations for declaratively building MCP servers:

Tools:

  • @Tool - Mark methods as MCP tools
  • @ToolArg - Configure tool parameters

Package: org.mcp_java.annotations.tools

Resources:

  • @Resource - Expose static resources
  • @ResourceTemplate - Expose dynamic resources with URI templates
  • @ResourceTemplateArg - Configure template URI variables

Package: org.mcp_java.annotations.resources

Prompts:

  • @Prompt - Define reusable prompt templates
  • @PromptArg - Configure prompt arguments

Package: org.mcp_java.annotations.prompts

Completion:

  • @CompleteArg - Customize completion argument names
  • @CompletePrompt - Provide completion for prompt arguments
  • @CompleteResourceTemplate - Provide completion for resource template URIs

Package: org.mcp_java.annotations.completion

Core:

  • @McpServer - Mark classes as MCP server components
  • @MetaField - Add custom metadata to definitions

Package: org.mcp_java.annotations

mcp-server-api

Basic framework-agnostic runtime APIs for MCP server implementations:

  • Cancellation - Interface for handling request cancellation
  • ClientCapability - Representation of client capabilities
  • ContentEncoder<T> - Interface for custom content encoding
  • McpException - Base exception for MCP-related errors
  • Package documentation and contracts

Package: org.mcp_java.server

Design Principles

  • Framework Agnostic: Zero dependencies on Spring, Quarkus, or other frameworks
  • Portable: Use these annotations and models with any Java runtime
  • Clean Separation: Annotations, models, and server APIs in separate modules
  • Extensible: Framework-specific implementations can build on these foundations
  • Standards-Based: Fully aligned with the official MCP specification
  • Modern Java: Uses Java 17+ features (records, sealed interfaces, etc.)

Module Dependency Graph

mcp-server-api
    ↓ (depends on)
mcp-annotations
    ↓ (depends on)
mcp-model

Framework implementations (Quarkus, Spring, etc.) typically depend on all three modules.

Getting Started

Note: This project provides the foundational annotations and models. Framework-specific runtime implementations (connection handling, JSON-RPC processing, etc.) are provided by separate projects like Quarkus MCP Server.

Requirements

  • Java 17 or higher
  • Maven 3.9+

Building

mvn clean install

Running Tests

mvn test

Usage Example

Here's a simple example of using the annotations:

import org.mcp_java.annotations.McpServer;
import org.mcp_java.annotations.tools.Tool;
import org.mcp_java.annotations.tools.ToolArg;
import org.mcp_java.annotations.resources.Resource;
import org.mcp_java.annotations.prompts.Prompt;
import org.mcp_java.annotations.prompts.PromptArg;

@McpServer(name = "my-server", description = "Example MCP server")
public class MyMcpServer {

    @Tool(
        name = "calculate",
        description = "Perform a calculation"
    )
    public int calculate(
            @ToolArg(name = "a", description = "First number") int a,
            @ToolArg(name = "b", description = "Second number") int b) {
        return a + b;
    }

    @Resource(
        uri = "config://settings",
        name = "Application Settings",
        description = "Current application configuration"
    )
    public String getSettings() {
        return "{ \"theme\": \"dark\", \"language\": \"en\" }";
    }

    @Prompt(
        name = "greet",
        description = "Generate a greeting message"
    )
    public String greet(@PromptArg(name = "name") String name) {
        return "Hello, " + name + "!";
    }
}

Framework implementations will process these annotations and expose them via the MCP protocol.

Relationship to Other Projects

This library is inspired by and designed to be compatible with:

Framework-specific extensions can build on these core annotations to provide runtime-specific features like dependency injection, lifecycle management, and protocol handling.

Contributing

We welcome contributions! This project aims to serve the broader Java MCP ecosystem.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Maintain framework independence - no framework-specific dependencies
  • Follow Java naming conventions and code style
  • Add tests for new functionality
  • Update documentation as needed
  • Keep the API surface minimal and focused

Continuous Integration

This project uses GitHub Actions for continuous integration, running:

  • Compilation checks
  • Unit and integration tests
  • Code quality analysis

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About Java MCP Annotations

How do I install Java MCP Annotations?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Java MCP Annotations safe to use with an AI agent?

Its trust score is 34 out of 100 (low). It passes 1 of the 1 static security checks run so far. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Java MCP Annotations still maintained?

Yes — the last commit was 3 months ago. The repository has 3 stars and 6 forks.