HealthcareRAGTools

HealthcareRAGTools

An agentic AI system that enables healthcare professionals to log patient symptoms, retrieve similar clinical cases, and search medical documents using RAG. It integrates a Chroma vector database with the Model Context Protocol to provide real-time clinical decision support.

Category
Visit Server

README

HealthcareRAGTools Project

Overview

The HealthcareRAGTools project is an agentic AI system designed to assist healthcare professionals by leveraging Retrieval-Augmented Generation (RAG) techniques. This project integrates a Model Context Protocol (MCP) server with a Chroma vector database to log patient symptoms, retrieve similar cases, and search medical documents. It supports interactive queries via a terminal-based client and can also be used within the Cursor IDE’s agent chat interface.

Project Description

This project enables the following key functionalities:

  1. Log Patient Symptoms: Logs patient symptoms (e.g., "fever and cough") with severity levels (e.g., "Moderate") and retrieves similar cases from a database for comparison.
  2. Search Documents: Searches a collection of medical documents (e.g., flu or asthma symptom descriptions) to provide relevant information based on user queries. The system uses the Groq API for natural language processing, with the llama-3.3-70b-versatile model. It is built to support real-time healthcare data management and retrieval, making it a valuable tool for clinical decision support.

Tools Used

The project relies on the following tools and technologies:

Python 3.8+: The primary programming language for scripting and server logic. FastMCP: A modular compute platform framework for building and running agentic systems. LangChain: A library for building context-aware language models and agents. LangChain-Groq: Integration with Groq’s API for advanced language model capabilities. Chroma: An open-source vector database for storing and retrieving embeddings of medical documents and patient data. Sentence-Transformers: Used to generate embeddings for text data in the Chroma database. HTTpx: For handling HTTP requests within the system. Python-Dotenv: Manages environment variables, such as the Groq API key. LangChain-Community: Additional community-supported LangChain tools. Requests: For making HTTP requests to external services. UV: A package and virtual environment manager for dependency management. Cursor IDE: The development environment, with plans to enable agent chat functionality.

Directory Structure

The project is organized as follows:

\Desktop\mcpserver\ragmcp
├── .env # Stores the GROQ_API_KEY environment variable ├── .gitignore # Excludes venv, chroma_db, and .env from version control ├── server.py # Main MCP server script with HealthcareRAGTools logic ├── setup_db.py # Script to initialize the Chroma vector database ├── healthcare_client.py # Terminal-based client for interactive queries ├── healthcare.json # Configuration file for the MCP server ├── requirements.txt # Lists project dependencies ├── documents\ # Directory for sample medical documents │ ├── doc1.txt # Example document: Flu symptoms │ ├── doc2.txt # Example document: Asthma symptoms ├── patient_records.json # JSON file storing patient symptom data ├── chroma_db\ # Directory for the Chroma vector database └── ragmcp\ # Virtual environment directory

Setup and Installation

To set up the project on your local machine, follow these steps:

Prerequisites Windows 10/11 with Command Prompt. Python 3.8+ installed. UV (Universal Virtual Environment) installed: pip install uv. A Groq API key from console.groq.com. Steps Create and Activate the Virtual Environment: uv venv ragmcp\Scripts\activate Confirm the prompt shows (ragmcp). Install Dependencies: Ensure requirements.txt exists with the listed dependencies: set UV_LINK_MODE=copy uv pip install -r requirements.txt Configure Environment Variables: Create or edit .env with your Groq API key: GROQ_API_KEY=your-groq-api-key Initialize the Database: Run the setup script to populate the Chroma database with sample documents: uv run python setup_db.py Expected output: Vector database initialized with sample medical documents. Running the Project Terminal-Based Client Start the Client: uv run python healthcare_client.py Expected Output: Loading environment variables... Loading config file: C:\Users\sniki\OneDrive\Desktop\mcpserver\ragmcp\healthcare.json Initializing HealthcareRAGTools chat... MCPClient initialized ChatGroq initialized

===== Interactive HealthcareRAGTools Chat ===== Type 'exit' or 'quit' to end the conversation Type 'clear' to clear conversation history Example queries:

  • Log symptoms for patient P123: fever and cough, severity Moderate, show similar cases
  • Search documents for flu symptoms ==================================

You:

Test a Query: Type: Log symptoms for patient P123: fever and cough, severity Moderate, show similar cases Expected response: Assistant: Symptoms logged for Patient P123: 'fever and cough' (Moderate). Similar cases: None Exit: Type exit or quit.

To run it in Cursor's Agent chat:

Copy the json code into File>Preferences>Cursor Settings>MCP/MCP Tools and run the server as follows:

uv run python server.py

You can use the same queries here as well.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured