MCP-Clinic-Bot

sankett13/MCP-Clinic-Bot

3.2

If you are the rightful owner of MCP-Clinic-Bot and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is a sophisticated tool designed to facilitate communication and execution of AI-driven tasks, particularly in environments that require seamless integration of various AI models and databases.

Tools
5
Resources
0
Prompts
0

๐Ÿฅ CareWell Medical Clinic ChatBot

An AI-powered medical clinic chatbot built with Model Context Protocol (MCP) that provides intelligent appointment management and clinic information retrieval through a modern, responsive interface.

โœจ Features

  • Smart Appointment Management: Book, check, update, and cancel appointments
  • Intelligent Information Retrieval: ChromaDB-powered vector search for clinic information
  • 24/7 Availability: AI assistant available round the clock
  • Mobile-First Design: Fully responsive interface with mobile optimization
  • Real-time Chat: Instant responses with typing indicators
  • Function Tracking: Visual indicators showing which AI functions were used
  • Error Handling: Graceful error handling with user-friendly messages

๐Ÿš€ Tech Stack

Frontend

  • React 19 - Modern UI library
  • Vite - Fast build tool and dev server
  • TailwindCSS - Utility-first CSS framework
  • Lucide React - Beautiful icon library
  • Responsive Design - Mobile-first approach

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - Database for appointment storage
  • ChromaDB - Vector database for clinic information
  • Model Context Protocol (MCP) - AI agent communication protocol

AI & ML

  • Google Gemini AI - Large language model
  • MCP Server - Tool execution and management
  • Vector Search - Semantic information retrieval

๐Ÿ“‹ Prerequisites

  • Node.js (v18 or higher)
  • MongoDB (local or cloud instance)
  • Google Gemini API key
  • npm or yarn package manager

๐Ÿ› ๏ธ Installation & Setup

1. Clone the Repository

git clone https://github.com/sankett13/MCP-Clinic-Bot.git
cd MCP-Clinic-Bot

2. Backend Setup

cd backend
npm install

Create a .env file in the backend directory:

GEMINI_API_KEY=your_gemini_api_key
MONGODB_URI=mongodb://localhost:27017/clinic_chatbot
PORT=5000

3. Frontend Setup

cd frontend/mcp_chatbot
npm install

4. Start the Application

Backend (Terminal 1):

cd backend
npm run dev

Frontend (Terminal 2):

cd frontend/mcp_chatbot
npm run dev

MCP Server Inspector (Terminal 3 - Optional):

cd backend
npm run inspector

The application will be available at:

  • Frontend: http://localhost:5173
  • Backend API: http://localhost:5000
  • MCP Inspector: http://localhost:3000

๐Ÿ—๏ธ Project Structure

MCP_ChatBot_Clinic/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ controllers/
โ”‚   โ”‚   โ””โ”€โ”€ chatManager.js
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ””โ”€โ”€ appointment.js
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ””โ”€โ”€ mcpRouter.js
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ initializeChromaDB.js
โ”‚   โ”‚   โ”œโ”€โ”€ initializeMcpServer.js
โ”‚   โ”‚   โ””โ”€โ”€ mcpServer.js
โ”‚   โ”œโ”€โ”€ chromaDB_store.js
โ”‚   โ”œโ”€โ”€ connection.js
โ”‚   โ”œโ”€โ”€ server.js
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ frontend/
โ”‚   โ””โ”€โ”€ mcp_chatbot/
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ components/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ ChatBot.jsx
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Header.jsx
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Hero.jsx
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Services.jsx
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ About.jsx
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Contact.jsx
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ Footer.jsx
โ”‚       โ”‚   โ”œโ”€โ”€ assets/
โ”‚       โ”‚   โ”œโ”€โ”€ App.jsx
โ”‚       โ”‚   โ””โ”€โ”€ main.jsx
โ”‚       โ””โ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿ”ง Available MCP Tools

The chatbot uses the following MCP tools:

  1. createAppointment - Book new appointments
  2. checkForAppointments - View existing appointments
  3. updateAppointment - Modify appointment details
  4. deleteAppointment - Cancel appointments
  5. ClinicInfo - Retrieve clinic information using vector search

๐Ÿ’ฌ Usage Examples

Book an Appointment:

User: "I'd like to book an appointment for tomorrow at 2 PM"
Bot: "I'll help you book an appointment. Could you please provide your name, email, and phone number?"

Check Appointments:

User: "Do I have any appointments this week?"
Bot: "Let me check your appointments. What's your name?"

Clinic Information:

User: "What services do you provide?"
Bot: "CareWell Medical Clinic offers comprehensive healthcare services including..."

๐ŸŽฏ Key Components

ChatBot Component

  • Real-time messaging interface
  • Mobile-responsive design
  • Quick action buttons
  • Function usage tracking
  • Error handling with retry logic

MCP Server

  • Tool registration and execution
  • Database operations
  • Vector search capabilities
  • Error handling and validation

ChromaDB Integration

  • Semantic search for clinic information
  • Vector embeddings for improved relevance
  • Fast query responses

๐Ÿ”’ Environment Variables

Backend (.env)

GEMINI_API_KEY=your_gemini_api_key_here
MONGODB_URI=mongodb://localhost:27017/clinic_chatbot
PORT=5000
NODE_ENV=development

๐Ÿ“ฑ Features in Detail

Responsive Design

  • Mobile-first approach with touch-optimized interactions
  • Adaptive chat window sizing
  • Optimized quick actions for different screen sizes

Error Handling

  • Network error recovery
  • Graceful API failure handling
  • User-friendly error messages
  • Retry mechanisms

Performance Optimizations

  • Lazy loading of components
  • Optimized re-renders
  • Efficient state management
  • Vector search optimization

๐Ÿงช Development

Running Tests

# Backend tests
cd backend
npm test

# Frontend tests
cd frontend/mcp_chatbot
npm test

MCP Inspector

Use the MCP Inspector to debug and test MCP tools:

cd backend
npm run inspector

๐Ÿš€ Deployment

Production Build

# Frontend
cd frontend/mcp_chatbot
npm run build

# Backend
cd backend
npm start

Environment Setup

Ensure all environment variables are properly configured for production:

  • Database connection strings
  • API keys
  • CORS settings
  • Port configurations

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the file for details.

๐Ÿ™ Acknowledgments


Built with โค๏ธ using Model Context Protocol and modern web technologies