Skip to main content

Paperlib MCP

Academic literature management and retrieval MCP server - supporting PDF import, hybrid search, knowledge graph construction, and literature review generation.

Python 3.11+ License: MIT

中文 README

✨ Features

Feature Description
PDF Import Auto-extract text, chunk by page, generate vector embeddings
Hybrid Search FTS full-text search + pgvector semantic search
Knowledge Graph LLM-driven entity/relation/claim extraction, Leiden community detection
Review Generation Structured literature review auto-generation based on evidence packs

📋 Prerequisites

  • PostgreSQL 16+ with pgvector extension
  • MinIO or S3-compatible storage
  • OpenRouter API Key

🚀 Installation & Usage

Method 1: Docker Compose (Recommended for Beginners)

One-click launch of complete environment (PostgreSQL + MinIO + MCP):

git clone https://github.com/h-lu/paperlib-mcp.git
cd paperlib-mcp

# Configure API Key
cp .env.example .env
# Edit .env and fill in OPENROUTER_API_KEY

# Start services
docker-compose up -d

Configure in Cursor

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "paperlib-docker": {
      "command": "docker",
      "args": [
        "exec",
        "-i",
        "paperlib-mcp",
        "python",
        "-m",
        "paperlib_mcp.server"
      ]
    }
  }
}

Method 2: uvx Install (Recommended)

Prerequisites: Requires available PostgreSQL (with pgvector) and MinIO/S3-compatible storage service.

💡 Quick Start Local Services (Optional)
docker-compose up -d postgres minio minio-init

Configure in Cursor/Claude Desktop, modify environment variables according to your actual service addresses:

{
  "mcpServers": {
    "paperlib": {
      "command": "uvx",
      "args": ["paperlib-mcp"],
      "env": {
        "POSTGRES_HOST": "localhost",
        "POSTGRES_USER": "paper",
        "POSTGRES_PASSWORD": "paper",
        "POSTGRES_DB": "paperlib",
        "S3_ENDPOINT": "http://localhost:9000",
        "MINIO_ROOT_USER": "minio",
        "MINIO_ROOT_PASSWORD": "minio123",
        "OPENROUTER_API_KEY": "your-api-key"
      }
    }
  }
}

Method 3: pip Install

Prerequisites: Same as Method 2, requires available PostgreSQL and MinIO/S3 services.

pip install paperlib-mcp

Configure MCP client (modify according to your actual service addresses):

{
  "mcpServers": {
    "paperlib": {
      "command": "paperlib-mcp",
      "args": [],
      "env": {
        "POSTGRES_HOST": "localhost",
        "POSTGRES_USER": "paper",
        "POSTGRES_PASSWORD": "paper",
        "POSTGRES_DB": "paperlib",
        "S3_ENDPOINT": "http://localhost:9000",
        "MINIO_ROOT_USER": "minio",
        "MINIO_ROOT_PASSWORD": "minio123",
        "OPENROUTER_API_KEY": "your-api-key"
      }
    }
  }
}

Method 4: Local Development

git clone https://github.com/your-org/paperlib-mcp.git
cd paperlib-mcp

uv sync
cp .env.example .env
# Edit .env

uv run python -m paperlib_mcp.server

📖 Available Tools

Basic Tools

Tool Description
health_check System health check
import_pdf Import PDF documents
download_pdf Download PDF by title to local directory
search_hybrid Hybrid search (recommended)
get_document Get document metadata
list_documents List all documents

Graph Tools

Tool Description
extract_graph_v1 Extract knowledge graph
build_communities_v1 Build topic communities
summarize_community_v1 Generate community summaries

Writing Tools

Tool Description
build_evidence_pack Build evidence pack
draft_lit_review_v1 Generate review draft

Full tool list (48+) available at docs/MCP_TOOLS_REFERENCE.md


💡 Usage Examples

# Import PDF
> import_pdf file_path="/papers/study.pdf" title="Study Title"

# Search literature
> search_hybrid query="monetary policy" k=10

# Build knowledge graph
> extract_graph_v1 doc_id="abc123"
> build_communities_v1 level="macro"

# Generate review
> build_evidence_pack query="CBDC" k=40
> draft_lit_review_v1 pack_id=1

📚 Documentation

Document Description
DEPLOYMENT.md Deployment Guide
ARCHITECTURE.md System Architecture
EMBEDDING_SYSTEM.md Embedding & Retrieval
KNOWLEDGE_GRAPH.md Knowledge Graph
DATABASE_SCHEMA.md Database Schema
MCP_TOOLS_REFERENCE.md Tools API Reference

🛠️ Tech Stack

Component Technology
MCP Protocol FastMCP
Database PostgreSQL 16 + pgvector
Object Storage MinIO (S3 Compatible)
PDF Processing PyMuPDF4LLM
Embedding Model OpenRouter (text-embedding-3-small)
Graph Clustering igraph + Leiden

Environment Variables

Variable Required Default Description
OPENROUTER_API_KEY - OpenRouter API key
POSTGRES_HOST localhost Database host
POSTGRES_USER paper Database user
POSTGRES_PASSWORD paper Database password
POSTGRES_DB paperlib Database name
S3_ENDPOINT http://localhost:9000 MinIO endpoint
MINIO_ROOT_USER minio MinIO user
MINIO_ROOT_PASSWORD minio123 MinIO password

📄 License

MIT

Download files

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

Source Distribution

paperlib_mcp-0.1.5.tar.gz (215.4 kB view details)

Uploaded Source

Built Distribution

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

paperlib_mcp-0.1.5-py3-none-any.whl (98.8 kB view details)

Uploaded Python 3

File details

Details for the file paperlib_mcp-0.1.5.tar.gz.

File metadata

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

File hashes

Hashes for paperlib_mcp-0.1.5.tar.gz
Algorithm Hash digest
SHA256 96ccf24ed859dedc6d9eb70f85c38f9b91e771b3073fc6ee2f94cc991723abca
MD5 5405497d8f3c344a7f2a03ea20b9e14e
BLAKE2b-256 dacb3753442903c37cf6f066c232a011f8596a26c3a084ef1eae63df1e0e6057

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperlib_mcp-0.1.5.tar.gz:

Publisher: publish.yml on h-lu/paperlib-mcp

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

File details

Details for the file paperlib_mcp-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: paperlib_mcp-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 98.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paperlib_mcp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 de49f53bfe8dc52b5afc453eef76743685fa6973c6de9d921201d14ad6c5c5e7
MD5 1f6fee4877252136024bc22ee4fa9fe0
BLAKE2b-256 ef32fb9489f43e9a75773dcf89c50f06da921166d441c8a23807a7f8f4150d7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperlib_mcp-0.1.5-py3-none-any.whl:

Publisher: publish.yml on h-lu/paperlib-mcp

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

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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