The Spring AI MCP Annotations Server demonstrates how to implement the four core MCP capabilities using a declarative, annotation-driven approach.
Tools
Tools allow the model to perform actions. They are implemented using @Tool (via SpringAiToolProvider) or @McpTool (via McpToolProvider, DocumentProvider, or ToolProvider2).
Resources
Resources provide data to the model via URIs. Examples include:
user-profile://{username}docs://documents/{docId}static://hello
Prompts
Prompts are pre-defined templates for interactions, such as greeting, personalized-message, or conversation-starter.
Completions
Completions provide suggestions for text input, implemented using the @McpComplete annotation (e.g., for username or country name suggestions).