Skip to main content

MCP server enabling AI agents to efficiently search and understand PDF documents

Project description

Paper Intelligence

Python MCP License uv ChromaDB LlamaIndex

A local MCP server for intelligent paper/PDF management. Convert PDFs to markdown, then search them with hybrid grep + semantic search. Designed for token efficiency: search first, read only what you need.

🚀 Quick Start

1. Install UV (one-time setup)

curl -LsSf https://astral.sh/uv/install.sh | sh

2. Add to Your MCP Client

Claude Code CLI:

claude mcp add paper-intelligence -- uvx paper-intelligence

VS Code:

code --add-mcp '{"name":"paper-intelligence","command":"uvx","args":["paper-intelligence"]}'

That's it! uvx handles everything automatically.

🔌 MCP Client Integration

Claude Desktop

Add to your Claude Desktop config:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "paper-intelligence": {
      "command": "uvx",
      "args": ["paper-intelligence"]
    }
  }
}
Cursor
  1. Go to Settings → MCP → Add new MCP Server
  2. Select command type
  3. Enter: uvx paper-intelligence

Or add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "paper-intelligence": {
      "command": "uvx",
      "args": ["paper-intelligence"]
    }
  }
}
Windsurf / Other MCP Clients

Any MCP-compatible client can use paper-intelligence:

{
  "mcpServers": {
    "paper-intelligence": {
      "command": "uvx",
      "args": ["paper-intelligence"]
    }
  }
}

✨ Features

  • PDF to Markdown — High-accuracy conversion using Marker
  • Hybrid Search — Combined grep (exact/regex) + semantic RAG search
  • Token Efficient — Search papers instead of reading entire documents
  • GPU Acceleration — MPS (Apple Silicon) and CUDA support
  • Self-Contained — Each paper gets its own directory with all data
  • Header Context — Search results show document structure (e.g., "Methods > Data Collection")

📖 MCP Tools

process_paper

Full pipeline: Convert PDF → Index headers → Create embeddings

Parameters:

  • pdf_path (string): Path to PDF file
  • use_llm (boolean, optional): Enhanced accuracy mode (default: false)
  • chunk_size (integer, optional): Text chunk size for embedding (default: 512)
  • chunk_overlap (integer, optional): Overlap between chunks (default: 50)

Example:

Process the paper at ~/Downloads/attention-is-all-you-need.pdf

Output Structure:

attention-is-all-you-need/
├── attention-is-all-you-need.md   # Converted markdown
├── metadata.json                   # Processing version info
├── index.json                      # Header hierarchy
├── chroma/                         # Embeddings database
└── images/                         # Extracted figures

search

Unified search with grep and/or semantic RAG

Parameters:

  • query (string): Search query (text, regex, or semantic)
  • paper_dirs (array): List of paper directories to search
  • mode (string, optional): "grep", "rag", or "hybrid" (default: hybrid)
  • top_k (integer, optional): Number of results (default: 5)
  • regex (boolean, optional): Treat query as regex (default: false)

Example Queries:

# Semantic search across papers
Search for "attention mechanism implementation" in my processed papers

# Exact text search
Search for "transformer" using grep mode

# Regex search
Search for "BERT|GPT|T5" with regex enabled

Returns: Results with line numbers, surrounding context, and header location.

convert_pdf

Convert PDF to Markdown (without embeddings)

Parameters:

  • pdf_path (string): Path to PDF file
  • output_dir (string, optional): Custom output directory
  • use_llm (boolean, optional): Enhanced accuracy mode

Returns: markdown_path, images_dir, image_count

get_paper_info

Check processing status of a paper

Parameters:

  • paper_dir (string): Path to paper directory

Example Response:

{
  "has_markdown": true,
  "has_index": true,
  "has_embeddings": true,
  "has_images": true,
  "image_count": 12,
  "version": "0.2.0",
  "processed_at": "2025-01-15T10:30:00Z"
}

index_markdown / embed_document

Individual pipeline steps (for advanced use)

index_markdown — Extract header hierarchy into searchable JSON

index_markdown(markdown_path="~/Downloads/paper/paper.md")

embed_document — Create embeddings for semantic search

embed_document(
    markdown_path="~/Downloads/paper/paper.md",
    chunk_size=512,
    chunk_overlap=50
)

📊 Example Output

Search Result

{
  "source": "attention-is-all-you-need.md",
  "line_number": 142,
  "header_path": "Model Architecture > Attention",
  "content": "An attention function can be described as mapping a query and a set of key-value pairs to an output...",
  "score": 0.89
}

🎯 Typical Workflow

  1. Process a paper:

    Process the PDF at ~/Downloads/transformer-paper.pdf

  2. Search across papers:

    Search for "positional encoding" in my papers

  3. Read specific sections:

    Show me the Methods section from the transformer paper

The agent reads search results (a few hundred tokens) instead of entire papers (tens of thousands of tokens).

🛠️ Installation Options

Install from PyPI
# Install with pip
pip install paper-intelligence

# Or run directly with uvx (no install needed)
uvx paper-intelligence
Install from GitHub
pip install "paper-intelligence @ git+https://github.com/Strand-AI/paper-intelligence.git"
Local Development
git clone https://github.com/Strand-AI/paper-intelligence.git
cd paper-intelligence

# Create virtual environment
python3.11 -m venv .venv
source .venv/bin/activate

# Install in development mode
pip install -e ".[dev]"

# Run the server
python -m paper_intelligence.server

Development MCP config:

{
  "mcpServers": {
    "paper-intelligence": {
      "command": "python",
      "args": ["-m", "paper_intelligence.server"],
      "cwd": "/path/to/paper-intelligence"
    }
  }
}

Run tests:

# Unit tests (fast)
pytest tests/test_markdown_parser.py

# Integration tests (slow, requires ML models)
pytest tests/test_integration.py -v

🔧 Debugging

Use the MCP Inspector to debug the server:

npx @modelcontextprotocol/inspector uvx paper-intelligence

🆘 Troubleshooting

Server not starting?
  • Ensure Python 3.11+ is installed
  • Try uvx paper-intelligence directly to see error messages
  • Check that all dependencies installed correctly
Windows encoding issues?

Add to your MCP config:

"env": {
  "PYTHONIOENCODING": "utf-8"
}
Claude Desktop not detecting changes?

Claude Desktop only reads configuration on startup. Fully restart the app after config changes.

🏗️ Technical Stack

Component Technology
MCP Server Official Python SDK with FastMCP
PDF Conversion marker-pdf
Embeddings LlamaIndex + HuggingFace (BAAI/bge-small-en-v1.5)
Vector Store ChromaDB (persistent, local per-paper)
GPU Support PyTorch with MPS (Apple) or CUDA

🙏 Acknowledgments

📄 License

MIT — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paper_intelligence-0.2.0.tar.gz (737.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paper_intelligence-0.2.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file paper_intelligence-0.2.0.tar.gz.

File metadata

  • Download URL: paper_intelligence-0.2.0.tar.gz
  • Upload date:
  • Size: 737.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paper_intelligence-0.2.0.tar.gz
Algorithm Hash digest
SHA256 def05639829c3205d2f41cf58ae34f6ed0004687575691f3d4e6c1ead2f63bc6
MD5 f9751d976f3bbac60c58f2dfc325de36
BLAKE2b-256 9b772b1c483794917e8a18b6d4b7435d56c39131cca745f80200b37067a32523

See more details on using hashes here.

Provenance

The following attestation bundles were made for paper_intelligence-0.2.0.tar.gz:

Publisher: publish.yml on Strand-AI/paper-intelligence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paper_intelligence-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for paper_intelligence-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45f552bb93819723d814349a56b55af56b1652ca0171d7d7adee4c090b34dccd
MD5 6b192f3e051542783b1a8f901ee26512
BLAKE2b-256 ad66692b663e30e1a8a78e86c109277826fbe56764edb97a239f594432945702

See more details on using hashes here.

Provenance

The following attestation bundles were made for paper_intelligence-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Strand-AI/paper-intelligence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page