sankett13/MCP-Clinic-Bot
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.
๐ฅ 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:
- createAppointment - Book new appointments
- checkForAppointments - View existing appointments
- updateAppointment - Modify appointment details
- deleteAppointment - Cancel appointments
- 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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the file for details.
๐ Acknowledgments
- Model Context Protocol for the MCP framework
- Google Gemini AI for the language model
- ChromaDB for vector database capabilities
- React and Vite for the frontend framework
Built with โค๏ธ using Model Context Protocol and modern web technologies