1. Conduid
  2. RAG
  3. Spring AI Demos
MCP server · RAG

Spring AI Demos

Spring AI demos: OpenAI & Ollama chat, RAG with pgvector, image generation, text-to-speech, MCP server/client (Java 25, Spring Boot 4, Spring AI 2)

Unclaimed rag
34Low

Scored 25 days ago · breakdown

About Spring AI Demos

Spring AI Demos is an MCP server published by GabsDev in the RAG category: spring AI demos: OpenAI & Ollama chat, RAG with pgvector, image generation, text-to-speech, MCP server/client (Java 25, Spring Boot 4, Spring AI 2).

The repository has 9 stars and 4 forks, with the last commit a month ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

From source
git clone https://github.com/GabsDev/spring-ai-demos

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Spring AI Demos

Powered by Claude · Grounded in docs

I know everything about Spring AI Demos. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 14 hours ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • !Dependencies pinnedNo lockfile. Installs can pull different code over time.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.

1 check has not been run yet.

README

Spring AI Demos

A collection of hands-on demo applications built with Spring AI, Spring Boot 4 and Java 25, showing how to integrate LLMs (OpenAI and Ollama), build a RAG pipeline, generate images and audio, and wire models to external tools through MCP (Model Context Protocol).

Each app is an independent Spring Boot project with its own Maven wrapper, so you can run any of them on its own.

Stack

Technology Version
Java 25
Spring Boot 4.1.x
Spring AI 2.0.x
Models OpenAI (gpt-4o-mini), Ollama (qwen3:4b)
Embeddings Ollama nomic-embed-text
Vector Store PostgreSQL + pgvector
MCP Streamable HTTP (@McpTool)

Apps

1. springai-openai — OpenAI Chat Playground

Free chat, expert personas, code generation/explanation, and structured (typed) outputs with Spring AI's ChatClient.

Key endpoints (AiController):

  • GET /greeting — one-line hello
  • POST /chat, POST /chat-expert — free chat, Java/Spring expert persona
  • POST /generate-code, POST /explain-code — code generation and explanation
  • POST /chat-format, POST /analyze — structured summaries and analysis
  • GET /city-info?city=, POST /classify-typed — typed records (CityInfo, TicketClassification)
  • POST /generate-code-json, POST /explain-code-json, POST /expert-architect-json — typed JSON outputs
  • GET /chat-metadata?prompt= — answer plus raw ChatResponse metadata

Requires: OPENAI_API_KEY (see spring.config.import=optional:file:.env[.properties]).

2. springai-ollama — Ollama Chat Playground (local, no cloud)

The same feature set as the OpenAI app, backed by a local Ollama server with qwen3:4b. No API keys, fully offline.

Requires: Ollama running at http://localhost:11434 with qwen3:4b pulled.

3. springai-rag — RAG with PostgreSQL + pgvector

Upload a PDF, index it into pgvector using Ollama embeddings, then ask questions grounded in your own documents.

Endpoints:

  • POST /index-upload/pdf — multipart PDF upload → PagePdfDocumentReader → TokenTextSplitter (chunk 800, min 350 chars) → pgvector
  • POST /rag/ask — top-4 similaritySearch + grounded prompt (answers only from context)

Requires: PostgreSQL with pgvector (spring_ai_rag database, schema auto-created), Ollama with qwen3:4b and nomic-embed-text.

4. springai-image-generate — Text-to-Image

Generate a PNG from a text prompt via the OpenAI Images API.

  • GET /api/images/generate?prompt= — returns inline PNG bytes (b64_json)

Requires: OPENAI_API_KEY.

5. springai-audio — Text-to-Speech

Convert text to MP3 using the OpenAI TTS API.

  • GET /api/tts?text= — returns audio/mpeg bytes (gpt-4o-mini-tts, voice alloy)

Requires: OPENAI_API_KEY.

6. springai-mcp-server — MCP Server (weather tools)

A Spring AI MCP server exposing weather tools over streamable HTTP on port 8081 (endpoint /mcp).

Tools (@McpTool):

  • getCurrentWeatherTemperature(city) — temperature for Santiago, Madrid, Buenos Aires, Ciudad de México (demo data)
  • getWeatherRecommendation(city) — clothing advice per city

7. springai-mcp-client — MCP Client (LLM + tools)

An Ollama-backed chat client that consumes the MCP server's weather tools via tool-calling.

  • GET /api/weather/ask?question= — natural-language weather question (e.g., "¿qué temperatura hace en Santiago?")

Requires: MCP server (app 6) running on http://localhost:8081/mcp, Ollama with qwen3:4b.

How to run

Each app is self-contained. From the app folder:

# OpenAI / Image / Audio apps: create a .env with your key first
echo "OPENAI_API_KEY=sk-..." > .env

# Ollama / RAG apps: make sure Ollama is running
ollama pull qwen3:4b
ollama pull nomic-embed-text   # only for RAG

# RAG: PostgreSQL with pgvector (e.g. via docker)
docker run -d --name pgvector -p 5432:5432 \
  -e POSTGRES_DB=spring_ai_rag -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres \
  pgvector/pgvector:pg17

# MCP client needs the MCP server on :8081 first, then:
./mvnw spring-boot:run

Notes

  • springai-ollama intentionally mirrors the OpenAI app's controller/service structure — only the model provider changes, which makes it easy to compare cloud vs. local inference.
  • Tests are @SpringBootTest context-load smoke tests (7 total).
  • .env files with real API keys are gitignored — provide your own.

License

Demo material for learning purposes.

README fetched from the repository 14 hours ago. The original is authoritative.

Questions

About Spring AI Demos

How do I install Spring AI Demos?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Spring AI Demos safe to use with an AI agent?

Its trust score is 34 out of 100 (low). It passes 3 of the 5 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Spring AI Demos still maintained?

Yes — the last commit was a month ago. The repository has 9 stars and 4 forks.