continuing the MCP topic: making it work in java with #SpringAI, brought to you by @starbuxman and @jamesward
live stream: https://elastic.zoom.us/j/6372098304

#Java nearly broke without #JDBC. #Hibernate redefined data access. #JPA cleaned it up. Then came #NoSQL #MongoDB #Redis—and everything changed again. Raphael De Lio & Brian Sam-Bodden walk through 30 years of #Database shifts.

Read more: https://javapro.io/2025/05/21/a-look-back-at-javas-30-year-journey-with-databases/
#SpringAI #SQL

A Look Back at Java's 30-year Journey with Databases

Explore the evolution of Java’s data access—from JDBC and EJB to Hibernate, JPA, and Spring Data. Discover how Java adapted to relational and NoSQL databases, and what the future holds with AI, vector databases, and modern data models.

JAVAPRO International

I Finally Understand What MCP Is For

If you’re a developer, you’ve probably heard about MCP — the Model Context Protocol. It’s the hottest thing in AI, and posts and videos about it are appearing everywhere. Maybe you’ve even looked at the documentation, nodded along with the technical explanations (“it’s a protocol for connecting AI models to tools”), and thought, “But why would I want to use this instead of just calling tools directly? Why go through some protocol layer when I could access them myself?”

At any rate, that was my reaction. The MCP documentation was clear about what MCP did, but I couldn’t see why I should care. Then I stumbled across a blog post by Daniela Petruzalek about making your computer respond like the Enterprise computer from Star Trek and everything clicked. Let me show you the moment MCP went from confusing concept to indispensable tool.

This post is a text version of a YouTube video I published recently. If you’d rather watch the video, here it is:

https://youtu.be/04ynaafP1dI?si=jPIuaH_F6jfS3d7m

If you’d rather read the details, please continue. 🙂

The SQL Barrier

The blog post recommended OSQuery, a powerful open source system monitoring tool you can install on a Mac. You can query just about anything about your system state — CPU usage, memory consumption, network connections, temperature sensors, running processes, you name it. There’s just one catch: you have to write SQL to use it.

Say I want to know why my fan is running. I need to know that OSQuery maintains a temperature_sensors table and its columns, so I can write something like:

SELECT name, celsius FROM temperature_sensors WHERE celsius > 70;

SELECT name, celsius FROM temperature_sensors WHERE celsius > 70;

Then I need to cross-reference that with processes using the CPU, which means knowing about the processes table and writing more SQL. It’s powerful, but it requires me to remember table names, column names, and the right syntax for OSQuery (which is a superset of SQLite, in case you were wondering), so there’s a learning curve involved.

But if I wrap OSQuery with an MCP service, I can connect it to an AI client and just ask: “Why is my fan running?” in plain English. The LLM then translates my question into the right SQL queries for OSQuery, runs them through the service, and converts the answers (which come back in JSON form) into conversational English. It’s like having a systems expert who speaks both English, SQL, and JSON (not to mention OSQuery), at your disposal.

This is one of the key reasons why MCP matters. It’s not about replacing your tools — it’s about making them speak your language. The AI becomes your translator between human intent and technical syntax.

Claude Desktop running OSQuery for me

Avoiding The Docker Tax

Once I understood this pattern, I started seeing MCP opportunities everywhere. Take GitHub integration, which is one of the classic examples in the MCP documentation.

The official GitHub MCP service exists, but it suggests using Docker to run it. When you integrate it into something like Claude Desktop, you have to embed your personal access token right inside the config file in plain text.

{ "mcpServers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "mcp/github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } }}

{ "mcpServers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "mcp/github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } }}

That gives me two issues:

  • Docker can be a the resource hog
  • I don’t want my personal access token sitting in a plain text config file
  • (Note: Recently Docker introduced its own Docker MCP Toolkit, which allows you to work through that instead. That avoids embedding the secret key in plain text, but still, of course, runs through Docker.)

    So instead of using their service, I wrapped the local gh command (GitHub CLI, which I installed using homebrew) inside my own MCP service. Now I can do all my authentication right at the command line. No secrets in config files, and no Docker required.

    For example, I can ask: “What are the last five commits on my OSQuery MCP server project?” The LLM translates that into the right gh commands, runs them locally with my existing authentication, and formats the results nicely.

    Claude Desktop running gh commands for me

    No Docker, no exposed tokens, just clean local execution with a simple interface.

    Building MCP Services with Spring AI

    Here’s where it gets interesting for Java developers. I implemented my MCP services using Spring AI, which provides starters for both MCP servers and MCP clients.

    Spring Boot Initializr starters filtered by MCP

    If you already know Spring, you can use all the regular Spring patterns and mechanisms. The key for MCP is the @Tool annotation:

    @Tool("Get system temperature information")public String getTemperatureInfo() { // call executeOsquery with the proper SQL}@Tool(description = """ Execute osquery SQL queries to inspect system state. Query processes, users, network connections, and other OS data. Example: SELECT name, pid FROM processes""")public String executeOsquery(String sql) { // ...}

    @Tool("Get system temperature information")public String getTemperatureInfo() { // call executeOsquery with the proper SQL}@Tool(description = """ Execute osquery SQL queries to inspect system state. Query processes, users, network connections, and other OS data. Example: SELECT name, pid FROM processes""")public String executeOsquery(String sql) { // ...}

    Each method annotated with @Tool gets exposed to clients as an available MCP tool (function). The LLM reads the description and parameter info and invokes the method when appropriate.

    The architecture for creating your own MCP service wrapper is straightforward:

    • Write a Spring AI service exposing as many of the useful methods as you want with @Tool annotations.
    • Authenticate through normal Spring system mechanisms.
    • Build the service (in Java, an executable jar file) you can access in your MCP client.
    • Configure the client to access the service, and you’re done.

    You get normal dependency injection, configuration management, and all the enterprise patterns you’re used to in Spring. Spring AI handles all the MCP protocol conversions under the hood, and returns responses in a readable form.

    Going Full Star Trek

    Remember that blog post about the Enterprise computer? I figured, what the heck, I’ll build a Spring AI-based client with a JavaFX front-end and throw in voice command translation.

    My MCP client recorded my voice, transcribed the command, sent it to the OSQuery MCP service, and returned the results

    I have code that records my microphone, translates the audio file into English, figures out what commands to invoke, and displays the results. I can literally hold down a button and say: “Computer, run a level one diagnostic.”

    It works. It’s not terribly elegant (and, like always, my UI could use some work), but I am literally talking to my computer like it’s on the Enterprise and it responds with actual system information.

    (I did not add in voice capabilities for the UI to read the response back to me. I don’t think I want that wall of text read out loud. I might, however, have the LLM summarize it and read me the summary. We’ll see.)

    When to Write an MCP wrapper

    The idea here is that MCP shines when you need to bridge natural language with technical interfaces. You’re putting a conversational face on complicated tools. Look for tools in your workflow that require translation between what you want and the technical syntax:

    • Complex command line utilities
    • SQL databases with complicated queries
    • APIs with dozens of parameters
    • Configuration systems
    • Build tools

    Anything that could benefit from a conversation in front of it is a good candidate. If you find yourself thinking, “How do I call this? What are the details? I wish the computer would just go ahead and invoke it for me,” is a good candidate for MCP.

    So, what have we learned?

    MCP isn’t about replacing your tools or your development job. It’s about making those tools speak your language. It’s about putting a friendly, conversational interface on these tools. Instead of learning each new API parameter and command line flag, you focus on what you want to accomplish and let the AI handle the translation. That’s the real breakthrough with MCP. It’s not just some protocol — it’s a way to make the tools in your toolchain understand you.

    MCP changed how I think about AI integration. It’s not about the AI doing the work — it’s about the AI understanding what I want and translating that into the technical details I’d otherwise have to remember or look up.

    If you’d like to access the code for all these applications, here are my GitHub repositories referenced above:

    Good luck! For more information on this and related topics, see my free weekly Tales from the jar side newsletter and YouTube channel.

    #AI #Java #MCP #spring #SpringAI

    🚀 New in #LangGraph4j: PostgreSQL checkpointing support!
    Build even more resilient & scalable stateful LLM agentic workflow in Java.
    Docs & details 👉 https://langgraph4j.github.io/langgraph4j/core/checkpoint-postgres/

    #Java #Langchain4j #SpringAI #PostgreSQL #AI #AgenticWorkflow

    Checkpoint (Postgres) - LangGraph4j

    You think only Python can do #AI? Think again. Timo Salm reveals a #Java power move for #GenAI that flips the game. The twist? It actually works. Discover the #SpringAI surprise

    👇https://javapro.io/2025/04/22/building-ai-driven-applications-with-spring-ai/

    @springcentral #LLM #CloudAI #SpringBoot #AIApplications #AIEngineering

    Building AI-Driven Applications With Spring AI - JAVAPRO International

    Artificial intelligence (AI) is becoming increasingly essential to modern applications. While AI encompasses many different techniques, the current…

    JAVAPRO International

    Dive into the latest releases from #Spring 👉 https://bit.ly/3STMS0b

    GA releases of Spring Boot, Spring Security, Spring Authorization Server, Spring Session, Spring Integration, Spring for GraphQL, Spring AI and Spring Web Services.

    #Java #SpringBoot #SpringSecurity #SpringAI

    Why was #JDBC a breakthrough? What made #Hibernate change everything? How is #Java adapting to AI and vector #Databases? Raphael DeLio & Brian Sam-Bodden trace Java’s 30-year path in data.

    Catch up here: https://javapro.io/2025/05/21/a-look-back-at-javas-30-year-journey-with-databases/

    #Hibernate #SpringAI #ProjectLoom #SQL #NoSQL

    A Look Back at Java's 30-year Journey with Databases

    Explore the evolution of Java’s data access—from JDBC and EJB to Hibernate, JPA, and Spring Data. Discover how Java adapted to relational and NoSQL databases, and what the future holds with AI, vector databases, and modern data models.

    JAVAPRO International
    2/n #elastic announcements this week:
    #SpringAI launched their 1.0 and #elasticsearch part of it — putting the "intelligence" into AI ;)
    here is how to get going with it in no time 🧵

    #SpringAI 1.0 is officially here!

    Developers can now build scalable, production-ready AI applications by aligning with established Spring patterns and the broader Spring ecosystem.

    Dive into the key features of this release on #InfoQ 👉 https://bit.ly/45kLPxF

    #Java #SpringBoot #AI

    Spring AI 1.0 Released, Streamlines AI Application Development with Broad Model Support

    Introducing Spring AI 1.0: a groundbreaking framework that streamlines the creation of AI-driven applications in Java. Seamlessly integrate with top AI models for chat, image generation, and more. Wit

    InfoQ