Enables the storage and querying of complex cardiology entities and relationships in a graph database, allowing for natural language queries and graph analytics.
Supports the use of local LLMs for the extraction of cardiology-specific entities and relationships from documents and raw text.
Utilizes OpenAI's GPT-4 for intelligent extraction of cardiology entities like conditions, medications, and anatomical structures from text and PDF files.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Cardiology Knowledge Graph MCPWhat medications are used to treat atrial fibrillation?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Cardiology Knowledge Graph MCP Server
A Model Context Protocol (MCP) server that creates and queries a cardiology knowledge graph using Neo4j and LLM-powered entity extraction.
Features
📚 Document Ingestion: Process PDF files or raw text to extract cardiology entities and relationships
🧠 LLM-Powered Extraction: Uses GPT-4 (or customizable models like BioGPT) for intelligent extraction
📊 Knowledge Graph: Stores data in Neo4j with proper relationships
🔍 Natural Language Queries: Query the graph using plain English
✏️ Human-in-the-Loop: Review and edit extractions before adding to graph
📈 Graph Analytics: Get statistics and insights about your knowledge graph
Prerequisites
1. Neo4j Setup
Option A (Recommended): Download Neo4j Desktop for Mac
Create a new database with these credentials:
URI:
bolt://localhost:7687Username:
neo4jPassword:
password(or your choice)
Start the database
Option B: Use Neo4j Aura (free cloud instance)
Update connection details in your environment variables
2. API Key
Get an OpenAI API key from OpenAI Platform
Or set up alternative models (see Configuration section)
Installation
Clone and setup:
git clone <your-repo> cd "Cardiology Knowledge Graph MCP"Install dependencies:
pip install -r requirements.txtSet up environment variables:
cp .env.example .env # Edit .env with your actual valuesTest the server:
python mcp_server.py
Claude Desktop Configuration
Find your Claude Desktop config:
Mac:
~/Library/Application Support/Claude/claude_desktop_config.jsonCreate the file if it doesn't exist
Add the MCP server configuration:
{ "mcpServers": { "cardiology-kg": { "command": "python", "args": ["/full/path/to/your/mcp_server.py"], "env": { "NEO4J_URI": "bolt://localhost:7687", "NEO4J_USERNAME": "neo4j", "NEO4J_PASSWORD": "your-password", "OPENAI_API_KEY": "your-openai-key" } } } }Restart Claude Desktop and look for the 🔨 hammer icon to confirm the server is connected.
Usage
1. Document Ingestion
Process a PDF file:
Process raw text:
The system will:
Extract entities (conditions, medications, procedures, anatomy)
Identify relationships (causes, treats, affects, etc.)
Return a draft JSON for your review
2. Review and Edit Extractions
After ingestion, you'll get a draft like:
Edit as needed, then add to graph:
3. Query the Knowledge Graph
Ask natural language questions:
4. Graph Management
Get statistics:
Clear the graph (caution!):
Advanced Configuration
Using Alternative LLMs
BioGPT (specialized medical model):
Local Ollama model:
Custom Entity Types and Relationships
Edit the extraction prompt in mcp_server.py to focus on specific:
Anatomical structures
Drug classes
Diagnostic criteria
Treatment protocols
Integration with Neo4j Official MCP Servers
Install additional Neo4j MCP servers for enhanced capabilities:
Add to Claude config:
Example Workflow
Start with a textbook chapter:
Ingest this PDF: /Users/you/Downloads/cardiac-physiology-chapter.pdfReview the extraction - you might see entities like:
Anatomy: "left ventricle", "aortic valve"
Processes: "cardiac cycle", "systole", "diastole"
Relationships: "systole FOLLOWS atrial contraction"
Edit and refine the JSON to add missing details or correct relationships
Add to graph:
Add this to my knowledge graph: [your refined JSON]Query for insights:
Explain the cardiac cycle based on my knowledge graph What anatomical structures are involved in systole? How do beta-blockers affect the cardiac cycle?
Troubleshooting
Common Issues
"Connection refused" error:
Ensure Neo4j database is running
Check connection details in environment variables
"API key not found":
Verify OPENAI_API_KEY is set correctly
Check Claude Desktop config environment variables
"Module not found" errors:
Run
pip install -r requirements.txtagainCheck Python virtual environment
MCP server not appearing in Claude:
Verify the full path to
mcp_server.pyin configRestart Claude Desktop completely
Check logs in Claude Desktop (Help → Show Logs)
Logs and Debugging
The server logs helpful information. To see detailed logs:
Contributing
Fork the repository
Create a feature branch
Add tests for new functionality
Submit a pull request
License
MIT License - see LICENSE file for details.
Acknowledgments
Built on the Model Context Protocol by Anthropic
Uses Neo4j for graph database capabilities
Powered by LangChain for LLM integration
Inspired by medical informatics and knowledge representation research