Skip to main content
Glama
ajay800800

MCP Hospital Assistant

by ajay800800

πŸ₯ MCP Hospital Assistant

A full-stack intelligent hospital appointment management system powered by React, Node.js, PostgreSQL, and Mistral LLM (via Ollama).

πŸ”₯ Preview

πŸŽ₯ Demo Video

▢️ Click here to watch the demo

🏠 Dashboard

Dashboard

πŸ’¬ LLM Chat Assistant

LLM Chat

πŸ’¬ Mannual Booking

LLM Chat

πŸ” Node.js + Express 🎨 React.js (frontend) 🧠 LLM (Ollama - Mistral) πŸ’Ύ PostgreSQL πŸ›‘οΈ Session-based login

πŸ“· UI Preview

Login / Register Page Dashboard with buttons to manage system manually Book Appointment (manual) LLM-powered auto assistant interface

πŸ“ Project Structure

β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ server.js # Node.js + Express backend β”‚ β”œβ”€β”€ config/config.js # PostgreSQL config β”‚ β”œβ”€β”€ mcp/ # All business logic handlers β”‚ β”œβ”€β”€ auth/ # Login, register, session routes β”œβ”€β”€ frontend/ β”‚ └── mcp-ui/ # React frontend β”‚ β”œβ”€β”€ components/ # AddDoctor, Chat, Login, Home etc. β”‚ └── App.js # Main route controller

βš™οΈ Setup Instructions

  1. βœ… Install PostgreSQL and create DB

sudo apt install postgresql postgresql-contrib sudo -u postgres psql

Then run:

CREATE DATABASE mcp; CREATE USER mcpuser WITH PASSWORD 'mcppass'; GRANT ALL PRIVILEGES ON DATABASE mcp TO mcpuser;

  1. πŸ“¦ Create Schema

Connect:

psql -U mcpuser -d mcp -h localhost

CREATE TABLE doctors ( doctor_id SERIAL PRIMARY KEY, name TEXT, department TEXT, available_slots JSONB );

CREATE TABLE patients ( patient_id SERIAL PRIMARY KEY, name TEXT, age INTEGER, contact TEXT );

CREATE TABLE appointments ( appointment_id SERIAL PRIMARY KEY, doctor_id INTEGER REFERENCES doctors(doctor_id), patient_id INTEGER REFERENCES patients(patient_id), appointment_time TEXT );

CREATE TABLE users ( id SERIAL PRIMARY KEY, username TEXT UNIQUE, password TEXT );

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO mcpuser; GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO mcpuser;

  1. 🧠 Install Ollama with Mistral

curl -fsSL https://ollama.com/install.sh | sh ollama run mistral

Make sure the local Ollama server is running and available on default port 11434. 4. πŸš€ Backend Setup (Node.js)

cd backend/ npm install node server.js

This starts backend on: http://localhost:3007 5. πŸ’» Frontend Setup (React)

cd frontend/mcp-ui npm install npm start

This starts frontend at: http://localhost:3000 🧠 Key Functionalities ✨ Mode 1: Manual via UI

You can click on homepage icons to:

βž• Add Doctor βž• Add Patient πŸ“… Book Appointment πŸ“‹ View Doctors πŸ“‹ View Appointments

These UI features directly use API endpoints (/api/execute, /api/book, etc.) πŸ” Mode 2: Smart Assistant (LLM-enabled)

From the "Ask Assistant" chat interface:

Type: Show all appointments Or: Book appointment for patient John with doctor 2 at 10:00

βœ… If MCP Tools is enabled (checkbox at top), the LLM will:

πŸ”Ž Understand user command πŸ”§ Choose correct tool from tools.json 🧠 Generate SQL πŸ” Automatically execute API calls behind the scenes

❌ If disabled, LLM simply gives plain answers (no system change). πŸ” Authentication

Only authenticated users can access core pages. Register page stores hashed credentials securely in PostgreSQL. Session stored using express-session.

πŸ“ Example Prompts for LLM

Show all the doctors in doctor table Show appointments after 11:00 Book an appointment with Dr. Renu at 09:00 for John (age 30)

βœ… Summary Feature Manual UI LLM Tools Add Doctor βœ… Yes βœ… via prompt Book Appointment βœ… Yes βœ… if slot available View Doctors/Appointments βœ… Yes βœ… via prompt Edit Slots βœ… Yes (via query) βœ… via prompt Security πŸ” Session Login πŸ” Session Protected

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ajay800800/doc_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server