Medical AI Assistant MCP

Medical AI Assistant MCP

Enables querying medical documents stored in Qdrant using semantic retrieval, allowing users to search PubMed articles through the Model Context Protocol.

Category
Visit Server

README

Medical AI Assistant

Sistema RAG desarrollado como proyecto final de AI Engineering.

El proyecto implementa un sistema de Inteligencia Artificial preparado para producción, utilizando recuperación semántica, re-ranking, un agente cíclico con LangGraph, observabilidad mediante LangSmith y Arize Phoenix, y un adaptador MCP para exponer herramientas externas.


Objetivo

Construir un asistente médico capaz de responder preguntas utilizando artículos científicos de PubMed, combinando Retrieval-Augmented Generation (RAG) con un agente basado en LangGraph.

El sistema recupera información desde una base vectorial, prioriza los documentos mediante re-ranking y genera respuestas utilizando un modelo de lenguaje (LLM).


Arquitectura general

Usuario
    │
    ▼
main.py
    │
    ▼
pipeline.py
    │
    ▼
MedicalAIAgent
    │
    ▼
LangGraph
    │
    ├───────────────┐
    ▼               │
Retrieval           │
    ▼               │
Re-ranking          │
    ▼               │
Construcción        │
de contexto         │
    ▼               │
LLM                 │
    ▼               │
Evaluación          │
    │               │
    └──── Retry ◄───┘
    │
    ▼
Respuesta final

Estructura del proyecto

Medical_AI_Assistant/

├── retrieval/
├── ranking/
├── orquestacion/
├── agente/
├── adaptadores_mcp/
├── observabilidad/
├── despliegue/
├── data/
├── scripts/
├── test/

├── main.py
├── pipeline.py
├── requirements.txt
├── README.md
└── .env.example

Tecnologías utilizadas

  • Python 3.11
  • LangChain
  • LangGraph
  • Google Gemini
  • Sentence Transformers
  • CrossEncoder (MS MARCO)
  • Qdrant
  • LangSmith
  • Arize Phoenix
  • OpenTelemetry
  • MCP (Model Context Protocol)
  • Docker
  • Kubernetes

Componentes implementados

Retrieval

  • Base vectorial Qdrant
  • Embeddings Sentence Transformers
  • Recuperación semántica

Ranking

Re-ranking mediante:

cross-encoder/ms-marco-MiniLM-L-6-v2

Orquestación

Implementada utilizando:

  • LangChain

Agente

Implementado mediante:

  • LangGraph

Flujo del agente:

Retrieval
    ↓
Re-ranking
    ↓
Contexto
    ↓
LLM
    ↓
Evaluación
    ↓
Retry (si es necesario)

Observabilidad

Implementada mediante:

  • ✅ LangSmith
  • ✅ Arize Phoenix (OpenTelemetry)

Permite visualizar la ejecución completa del pipeline, las llamadas al modelo, tiempos de ejecución y trazabilidad del agente.


MCP

Se implementó un servidor MCP utilizando FastMCP.

Herramienta disponible:

search_medical_documents()

Permite consultar documentos almacenados en Qdrant desde clientes compatibles con Model Context Protocol.


Despliegue

El proyecto incluye:

  • Dockerfile
  • Kubernetes Deployment
  • Kubernetes Service

Los archivos de despliegue están preparados para ejecutarse en un entorno con Docker Engine y un clúster Kubernetes configurado.


Instalación

Crear el entorno:

conda create -n medical_ai python=3.11

Activarlo:

conda activate medical_ai

Instalar dependencias:

pip install -r requirements.txt

Variables de entorno

Crear un archivo .env:

GEMINI_API_KEY=

LANGSMITH_TRACING=true
LANGSMITH_API_KEY=
LANGSMITH_PROJECT=medical-ai-assistant

PHOENIX_TRACING=true
PHOENIX_API_KEY=
PHOENIX_COLLECTOR_ENDPOINT=
PHOENIX_PROJECT_NAME=medical-ai-assistant

Ejecución

python main.py

Pruebas

Grafo:

python test/test_graph.py

Servidor MCP:

python test/test_mcp.py

Prueba del LLM:

python test/test_llm.py

Prueba de Gemini:

python test/test_gemini.py

Estado de implementación

Componente Estado
Retrieval
Ranking
LangChain
LangGraph
MCP
LangSmith
Arize Phoenix
Docker
Kubernetes

Autor

Gonzalo Matos

Proyecto desarrollado como trabajo final de la asignatura AI Engineering.

El repositorio implementa una arquitectura modular basada en Retrieval-Augmented Generation (RAG), LangChain, LangGraph, Model Context Protocol (MCP) y herramientas de observabilidad para sistemas de IA en producción.

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
E2B

E2B

Using MCP to run code via e2b.

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
Qdrant Server

Qdrant Server

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

Official
Featured