#springai

Philipp Krennxeraa
2025-06-26

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

getting startedoverview
JAVAPROjavapro
2025-06-24

nearly broke without . redefined data access. cleaned it up. Then came —and everything changed again. Raphael De Lio & Brian Sam-Bodden walk through 30 years of shifts.

Read more: javapro.io/2025/05/21/a-look-b

2025-06-22

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:

  1. Docker can be a the resource hog
  2. 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

Screenshot of a diagnostic tool interface displaying system temperature and memory usage information, highlighting the reasons for high fan activity.Screenshot of a chat interface showing a conversation with an AI assistant asking for the five most recent commits on the OsqueryMcpServer repository. The response includes a list of recent commits with dates and descriptions of changes made.Screenshot displaying options for 'Model Context Protocol Server' and 'Model Context Protocol Client' with descriptions related to Spring AI support for both servers and clients.A user interface design for a Starfleet voice command system displaying system diagnostics, including uptime, system information, and running processes.
Bartolomeo Sorrentinobsorrentino@mastodon.world
2025-06-20

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

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

JAVAPROjavapro
2025-05-29

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

👇javapro.io/2025/04/22/building

@springcentral

2025-05-28

Dive into the latest releases from #Spring 👉 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

JAVAPROjavapro
2025-05-26

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

Catch up here: javapro.io/2025/05/21/a-look-b

Philipp Krennxeraa
2025-05-22

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

Spring AI with elasticarchitecture
2025-05-22

#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 👉 bit.ly/45kLPxF

#Java #SpringBoot #AI

Thomas Vitale ☀️thomasvitale@mastodon.online
2025-05-21

Spring AI 1.0 is now GA 🎉 It’s been a long and exciting journey for me, contributing several features like modular RAG, declarative tool calling, observability and OpenTelemetry support, Kubernetes service bindings, and more! 113 pull requests. 57 316 lines of code added. 18 198 lines of code removed. And many insightful and interesting conversations with the awesome Spring AI team!

#Java #AI #SpringAI

Spring AI 1.0 goes GA.  Upgrade your application to Spring AI 1.0 using OpenRewrite and Arconia's experimental, open-source recipes: "arconia update spring-ai"  Visit arconia.io for more information.  By @thomasvitale.com
JAVAPROjavapro
2025-05-21

Vector , , ’s next data era is coming fast. Raphael De Lio & Brian Sam-Bodden trace the path from 1996 to what’s next.
From to , from to —this shift matters.

Be ready for what’s ahead: javapro.io/2025/05/21/a-look-b

JAVAPROjavapro
2025-05-21

Vector ’s next data era is coming fast. Raphael De Lio & Brian Sam-Bodden trace the path from 1996 to what’s next. From to , from to —this shift matters.

Be ready for what’s ahead: javapro.io/2025/05/21/a-look-b

JAVAPROjavapro
2025-05-19

Prompt Engineering in ? Vektor-Datenbanken per Autokonfiguration? Tool-Calling & RAG out of the box? klingt zu gut, um wahr zu sein. Timo Salm zeigt, dass es geht:

Lies jetzt den Artikel: 👇 javapro.io/de/entwicklung-von-

Thomas Vitale ☀️thomasvitale@mastodon.online
2025-05-15

Devoxx UK was amazing 🤩 The recording of my session is already available! Combining live music composition and live coding, I cover topics like prompt injection attacks, structured outputs, tools, agents, modular RAG, guardrails, and MCP. Using Java and AI.

#DevoxxUK #Java #AI #SpringAI

youtube.com/watch?v=CVsYMIpuFIU

JCONjcon
2025-05-06

Want to add superpowers to your Spring apps? At , Timo Salm & Sandra Ahlgrimm dive into frameworks like and that make it easy.

Curious? Then read Timo’s article on this talk in advance: javapro.io/2025/04/22/building

JCONjcon
2025-04-26

Excited for EUROPE 2025? See Kevin Wittek at in Cologne talking about 'Familiar Tools in Unknown Territory: Exploring GenAI with and '

As Generative (GenAI) takes the landscape by storm, are searching …

Get your free Ticket: www.jcon.one

JAVAPROjavapro
2025-04-23

Prompt engineering in Java? Vector DBs via autoconfig? Tool calling & RAG out of the box? sounds too good to be true. But Timo Salm proves it works:
👉 Read the article: javapro.io/2025/04/22/building

@SpringAICentral

Harald KlinkeHxxxKxxx@det.social
2025-04-19

Neo4j treibt mit GraphRAG, Vektor-Indizes & Agentic RAG die #KI-Entwicklung voran. Ob #LangChain, #LlamaIndex, #SpringAI oder #VertexAI – das neue Python-Paket und das Model Context Protocol (MCP) verknüpfen Graphdaten nahtlos mit #LLM-Anwendungen.
#Neo4j #GenAI #RAG #GraphQL #Cypher #VectorSearch #AgenticAI
bigdata-insider.de/leistungssp

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst