
mcp-java/java-mcp-annotations
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
Java Annotations to describe MCP server features
Обзор
A framework-agnostic Java library providing core annotations and APIs for implementing Model Context Protocol (MCP) servers and clients. 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. 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.
README
Показан фрагмент оригинального 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
mcp-server-api
Framework-agnostic annotations and interfaces for declaratively building MCP servers:
Tools:
@Tool- Mark methods as MCP tools@ToolArg- Configure tool parametersToolResponse- Full control over tool call responses (content, structured content, error status)
Package: org.mcpjava.server.tools
Resources:
@Resource- Expose static resources@ResourceTemplate- Expose dynamic resources with URI templates@ResourceTemplateArg- Configure template URI variablesResourceResponse- Full control over resource read responsesResourceContents- Sealed interface for resource content (text or binary)TextResourceContents- Text resource contentBlobResourceContents- Binary resource content
Package: org.mcpjava.server.resources
Prompts:
@Prompt- Define reusable prompt templates@PromptArg- Configure prompt argumentsPromptResponse- Full control over prompt responsesPromptMessage- A single message within a prompt (role + content)
Package: org.mcpjava.server.prompts
Completion:
@CompletePrompt- Provide completion for prompt arguments@CompleteResourceTemplate- Provide completion for resource template URIs@CompleteArg- Customize completion argument namesCompletionResult- Completion response with suggestions, total count, and paginationCompletionContext- Access to other argument values already provided by the user
Package: org.mcpjava.server.completion
Content:
ContentBlock- Sealed interface for content in responses (text, image, audio, embedded resource, resource link)TextContent- Text content blockImageContent- Image data content blockAudioContent- Audio data content blockEmbeddedResource- Content block embedding a resource with its dataResourceLink- Content block linking to a resource by URIAnnotations- Metadata annotations for content and resources (audience, priority, last modified)
Package: org.mcpjava.server.content
Progress:
Progress- Access to progress reporting capabilities, injectable into tool/prompt/resource methods
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →