Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
PDF RAG MCP server for Cursor
This repo turns a folder of PDFs into a searchable knowledge base for MCP-compatible agents. The backend processes documents into vectors, the frontend manages uploads and search, and the MCP endpoint exposes the data to tools like Cursor.
Builders who want Cursor or another MCP client to search PDF documents from inside their workflow.
You can ask your agent questions about PDFs without manually opening and skimming each file.
What it does
PDF upload and processing
Uploads PDFs, extracts text, chunks it, and stores embeddings for later search.
Semantic search
Searches across processed documents using vector similarity instead of keyword matches.
MCP integration
Exposes the document store through MCP so Cursor can query it directly.
Real-time status updates
Uses WebSockets to show document processing progress in the web UI.
Web interface
Provides a React and Chakra UI app for managing documents and running queries.
How to get it
- 1Clone the repository
git clone https://github.com/yourusername/PdfRagMcpServer.git cd PdfRagMcpServer
- 2Install uv if you don't have it already
curl -sS https://astral.sh/uv/install.sh | bash
- 3Install dependencies using uv
uv init . uv venv source .venv/bin/activate uv pip install -r backend/requirements.txt
- 4Start the application with the convenient script
uv run run.py
- 5Run
# Make the script executable if needed chmod +x build_frontend.py # Run the script ./build_frontend.py
- 6Start the server
cd backend uv pip install -r requirements.txt python -m app.main
README
PDF RAG MCP Server
A powerful document knowledge base system that leverages PDF processing, vector storage, and MCP (Model Context Protocol) to provide semantic search capabilities for PDF documents. This system allows you to upload, process, and query PDF documents through a modern web interface or via the MCP protocol for integration with AI tools like Cursor.
Features
- PDF Document Upload & Processing: Upload PDFs and automatically extract, chunk, and vectorize content
- Real-time Processing Status: WebSocket-based real-time status updates during document processing
- Semantic Search: Vector-based semantic search across all processed documents
- MCP Protocol Support: Integrate with AI tools like Cursor using the Model Context Protocol
- Modern Web Interface: React/Chakra UI frontend for document management and querying
- Fast Dependency Management: Uses uv for efficient Python dependency management
System Architecture
The system consists of:
- FastAPI Backend: Handles API requests, PDF processing, and vector storage
- React Frontend: Provides a user-friendly interface for managing documents
- Vector Database: Stores embeddings for semantic search
- WebSocket Server: Provides real-time updates on document processing
- MCP Server: Exposes knowledge base to MCP-compatible clients
Quick Start
Prerequisites
- Python 3.8 or later
- uv - Fast Python package installer and resolver
- Git
- Cursor (optional, for MCP integration)
Quick Installation and Startup with uv and run.py
-
Clone the repository:
git clone https://github.com/yourusername/PdfRagMcpServer.git cd PdfRagMcpServer -
Install uv if you don't have it already:
curl -sS https://astral.sh/uv/install.sh | bash -
Install dependencies using uv:
uv init . uv venv source .venv/bin/activate uv pip install -r backend/requirements.txt -
Start the application with the convenient script:
uv run run.py -
Access the web interface at http://localhost:8000
-
Using with Cursor
Go Settings -> Cursor Settings -> MCP -> Add new global MCP server, paste below into your Cursor ~/.cursor/mcp.json file. See Cursor MCP docs for more info.
{
"mcpServers": {
"pdf-rag": {
"url": "http://localhost:7800/mcp"
}
}
}
You could also change localhost into the host ip you deployed the service. After this confige added to the mcp json, you will see the mcp server showes at the Cursor mcp config page, switch it on to enable the server:
Building the Frontend (For Developers)
If you need to rebuild the frontend, you have two options:
Option 1: Using the provided script (recommended)
# Make the script executable if needed
chmod +x build_frontend.py
# Run the script
./build_frontend.py
This script will automatically:
- Install frontend dependencies
- Build the frontend
- Copy the build output to the backend's static directory
Option 2: Manual build process
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Build the frontend
npm run build
# Create static directory if it doesn't exist
mkdir -p ../backend/static
# Copy build files
cp -r dist/* ../backend/static/
After building the frontend, you can start the application using the run.py script.
Simple Production Setup
For a production environment where the static files have already been built:
- Place your pre-built frontend in the
backend/staticdirectory - Start the server:
cd backend uv pip install -r requirements.txt python -m app.main
Development Setup (Separate Services)
If you want to run the services separately for development:
Backend
-
Navigate to the backend directory:
cd backend -
Install the dependencies with uv:
uv pip install -r requirements.txt -
Run the backend server:
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
Frontend
-
Navigate to the frontend directory:
cd frontend -
Install the dependencies:
npm install -
Run the development server:
npm run dev
Usage
Uploading Documents
- Access the web interface at http://localhost:8000
- Click on "Upload New PDF" and select a PDF file
- The system will process the file, showing progress in real-time
- Once processed, the document will be available for searching
Searching Documents
- Use the search functionality in the web interface
- Or integrate with Cursor using the MCP protocol
MCP Integration with Cursor
- Open Cursor
- Go to Settings → AI & MCP
- Add Custom MCP Server with URL:
http://localhost:8000/mcp/v1 - Save the settings
- Now you can query your PDF knowledge base directly from Cursor
Troubleshooting
Connection Issues
- Verify that port 8000 is not in use by other applications
- Check that the WebSocket connection is working properly
- Ensure your browser supports WebSockets
Processing Issues
- Check if your PDF contains extractable text (some scanned PDFs may not)
- Ensure the system has sufficient resources (memory and CPU)
- Check the backend logs for detailed error messages
Project Structure
PdfRagMcpServer/
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── __init__.py
│ │ ├── main.py # Main FastAPI application
│ │ ├── database.py # Database models
│ │ ├── pdf_processor.py # PDF processing logic
│ │ ├── vector_store.py # Vector database interface
│ │ └── websocket.py # WebSocket handling
│ ├── static/ # Static files for the web interface
│ └── requirements.txt # Backend dependencies
├── frontend/ # React frontend
│ ├── public/
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── context/ # React context
│ │ ├── pages/ # Page components
│ │ └── App.jsx # Main application component
│ ├── package.json # Frontend dependencies
│ └── vite.config.js # Vite configuration
├── uploads/ # PDF file storage
└── README.md # This documentation
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Files in the repo
- backend
- frontend
- .gitignore
- build_frontend.py
- package-lock.json
- package.json
- README.md
- run.py
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More connectors
High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code
Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.
Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.
Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.