← All projects
Project case study

Virtual AI Doctor: a Spring AI & MCP health assistant

An AI-powered virtual doctor built with Java, Spring Boot, Spring AI and the Model Context Protocol, where the model fetches patient context and flags emergencies through tool calls.

Spring BootSpring AIMCPJWTMySQLGroq AI
Live Demo View Code
Virtual AI Doctor app by Swayam Verma

Overview

Virtual AI Doctor lets users describe their symptoms in Hindi or English and get medical guidance in the same language. It is a learning and portfolio project and does not replace a real doctor.

The design change that mattered

The first version built one large prompt for every message: instructions, the full health profile, the conversation so far and the new symptoms. Every request carried data it often didn't need, prompts kept growing, and detecting emergencies meant parsing a severity tag out of plain text.

I re-architected the AI layer around Spring AI's Model Context Protocol (MCP) server/client integration, built on the official MCP Java SDK, so the model can call tools only when it needs them:

Features

Tech stack

LayerTechnology
BackendJava 17, Spring Boot 3.5, Spring Security, Spring Data JPA, Hibernate
AISpring AI, MCP, Groq API (LLaMA 3.1)
DatabaseMySQL (Railway)
AlertsSpring Mail, Brevo API
Frontend / hostingHTML, CSS, JavaScript on Vercel; backend on Render

What's next

A MEDIUM-severity MCP tool, a React frontend, real-time chat with WebSockets and voice input for symptoms.

Read more

I wrote about this redesign on Dev.to: How I Rebuilt My AI Doctor App with Spring AI and MCP.

About the developer

Built by Swayam Verma, a Java & Spring Boot backend developer and B.Tech CSE student from Bhopal, India. See my portfolio, GitHub and LinkedIn.