@Tool annotation.
- Basic (SSE)
- Advanced (Container App)
Basic calculator server
Located at03-GettingStarted/samples/java/calculator, this Spring Boot application exposes a full-featured calculator through MCP over SSE.Server code
Client code (MCP SDK)
SDKClient.java
LangChain4j client with GitHub models
The sample also includes aLangChain4jClient that connects an AI model to the calculator through MCP:LangChain4jClient.java (excerpt)
Test with MCP Inspector
Run in Docker
Key Maven dependencies
pom.xml (excerpt)