Crawl4AI RAG MCP Server
Enables AI assistants to crawl, index, and retrieve information from technical documentation using semantic search, with optional knowledge graph validation for code hallucination detection.
README
Crawl4AI RAG MCP Server
A Retrieval-Augmented Generation (RAG) MCP server built with Python that enables AI assistants to crawl, index, and retrieve information from technical documentation using semantic search.
The server integrates Crawl4AI for web crawling, Supabase (pgvector) for vector storage, OpenAI embeddings for semantic retrieval, and Neo4j for repository knowledge graph validation.
Features
- Model Context Protocol (MCP) server
- Intelligent web crawling with Crawl4AI
- Recursive website indexing
- Automatic document chunking
- OpenAI embedding generation
- Supabase pgvector vector database
- Semantic document retrieval
- Optional Hybrid Search
- Optional Contextual Embeddings
- Optional Agentic RAG
- Optional Cross-Encoder Reranking
- Neo4j Knowledge Graph integration
- AI code hallucination detection
- Repository structure validation
- Docker support
- SSE & STDIO transport support
Tech Stack
| Category | Technologies |
|---|---|
| Language | Python |
| AI | OpenAI API |
| Protocol | Model Context Protocol (MCP) |
| Web Crawling | Crawl4AI |
| Vector Database | Supabase + pgvector |
| Knowledge Graph | Neo4j |
| Containerization | Docker |
| Retrieval | RAG |
Architecture
AI Assistant
│
▼
MCP Server (Python)
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
Crawl4AI Knowledge Graph RAG Pipeline
│ (Neo4j) │
▼ ▼
Crawl Websites Document Chunking
│
▼
OpenAI Embeddings
│
▼
Supabase (pgvector)
│
▼
Semantic Search
│
▼
Generated Response
MCP Tools
Crawling
- Crawl a single page
- Crawl complete documentation websites
- Recursive crawling
- Sitemap crawling
Retrieval
- Semantic RAG search
- Source filtering
- Hybrid retrieval
- Context-aware retrieval
Knowledge Graph
- Parse GitHub repositories
- Validate AI-generated Python code
- Detect hallucinated imports
- Detect invalid methods/classes
- Query repository graph
Project Structure
src/
├── crawl4ai_mcp.py
├── tools/
├── knowledge_graphs/
├── rag/
├── utils/
public/
docker/
.env
README.md
Installation
Clone the repository
git clone <repository-url>
cd crawl4ai-rag-mcp-server
Install dependencies
pip install -r requirements.txt
Environment Variables
Create a .env file.
OPENAI_API_KEY=
SUPABASE_URL=
SUPABASE_SERVICE_KEY=
NEO4J_URI=
NEO4J_USER=
NEO4J_PASSWORD=
Running
Using Python
python src/crawl4ai_mcp.py
Using Docker
docker build -t crawl4ai-rag .
docker run --env-file .env -p 8051:8051 crawl4ai-rag
Retrieval Pipeline
- Crawl technical documentation
- Clean extracted content
- Split documents into chunks
- Generate embeddings
- Store vectors in pgvector
- Perform semantic similarity search
- Inject retrieved context into prompts
- Generate grounded responses
Knowledge Graph Pipeline
- Parse GitHub repositories
- Extract classes
- Extract methods
- Extract imports
- Build Neo4j graph
- Validate AI-generated code
- Detect hallucinated APIs
Future Improvements
- Multiple embedding model support
- Local embedding models
- Incremental indexing
- Authentication
- Citation support
- Multi-user support
- Document upload
- PDF ingestion
- Monitoring & Observability
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.