Exposing a Java method to an AI agent should take one annotation. When I started using MCP servers daily with Claude Code and Cursor, I noticed that almost every example was written in Python or TypeScript β while most of the systems I'd want an agent to call are Spring Boot services.
So I wrote java-mcp-server : a small toolkit where this is the whole integration:
@Component public class MyTools {
@McpTool ( name = "greet" , description = "Say hello to someone" ) public String greet ( @McpParam ( value = "name" , description = "Person's name" ) String name ) { return "Hello, " + name + "!" ; }
@McpResource ( uri = "config://app/{key}" , description = "Read a config value" ) public String config ( @McpParam ( "key" ) String key ) { return System . getProperty ( key , "(not set)" ); } }
Enter fullscreen mode
Exit fullscreen mode
Start the app, and any MCP client can list and call greet and read config://app/java.version .β¦