PDF Search MCP server

Built for Zed to enable semantic searching of PDF documents using a Qdrant vector database and OpenAI embeddings.
Back to servers
Setup instructions
Provider
stano
Release date
Dec 31, 2024
Language
Rust
Stats
3 stars

PDF Search for Zed is a document search extension that enables semantic searching through PDF documents and integrates results with Zed's AI Assistant. This extension helps you find and reference specific information from your PDFs directly within your editing environment.

Prerequisites

To use this extension, you'll need:

  1. An OpenAI API key (for generating embeddings)
  2. uv installed on your system

Installation

  1. Clone the repository:
git clone https://github.com/freespirit/pdfsearch-zed.git
  1. Set up the Python environment for the MCP server:
cd pdfsearch-zed/pdf_rag
uv venv
uv sync
  1. Install the extension as a Dev Extension in Zed

  2. Build the search database:

cd /path/to/pdfsearch-zed/pdf_rag

# Create a .env file with your OpenAI API key
echo "OPENAI_API_KEY=sk-..." > src/pdf_rag/.env

# Build the search index (may take a few minutes depending on document size)
uv run src/pdf_rag/rag.py build "file1.pdf" "dir1" "file2.md" ...

Note: You can provide multiple files and directories as arguments:

  • Files will be chunked automatically
  • Directories will be treated as if their files already contain chunks (no further splitting)
  1. Configure Zed by adding the following to your settings:
"context_servers": {
    "pdfsearch-context-server": {
        "settings": {
            "extension_path": "/path/to/pdfsearch-zed"
        }
    }
}

Using the PDF Search

  1. Open Zed's AI Assistant panel
  2. Type /pdfsearch followed by your search query
  3. The extension will search through your indexed PDFs and add relevant sections to the AI Assistant's context

For example:

/pdfsearch how to implement vector search

This will find the most relevant sections about vector search implementation in your indexed PDFs and make them available to the AI Assistant for reference in its responses.

Supported File Formats

While primarily designed for PDFs, this extension also supports:

  • PDF files
  • Markdown files
  • Additional file formats

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "pdfsearch-context-server" '{"command":"uv","args":["run","src/pdf_rag/rag.py","serve"],"cwd":"${extensionPath}"}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "pdfsearch-context-server": {
            "command": "uv",
            "args": [
                "run",
                "src/pdf_rag/rag.py",
                "serve"
            ],
            "cwd": "${extensionPath}"
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "pdfsearch-context-server": {
            "command": "uv",
            "args": [
                "run",
                "src/pdf_rag/rag.py",
                "serve"
            ],
            "cwd": "${extensionPath}"
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later