Building an MCP Server in Java with Spring AI: Let Claude Code Use Your Database Without Seeing a Password
Four annotated methods, one security config, and no JSON-RPC code of your own. In my previous article I built an MCP server from scratch in Python. I wrote the JSON-RPC 2.0 message handling, declared tool schemas by hand and wired up the STDIO transport myself. It’s a good way to learn how the protocol works on the wire. Python isn’t the only option, though. Most of the systems I work on are Java and Spring, and that’s where the data lives. So this time I built the same kind of server in Java. ...