Skip to main content

Paper Library MCP - 文献管理与检索 MCP 服务器

Project description

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/your-org/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

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

paperlib_mcp-0.1.1.tar.gz (226.5 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.1-py3-none-any.whl (94.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: paperlib_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 226.5 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.1.tar.gz
Algorithm Hash digest
SHA256 5d64fdebc36d279555564314a16b52209c3782bc820446cf2a0e141103669bf7
MD5 a95fae9089f543a268e4d07c704b711c
BLAKE2b-256 61845e9f74091647e10020d5c93d375fb2c7fcea4f545ca80bdc454a009efb99

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperlib_mcp-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: paperlib_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 94.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d97d2c590c4998f7abbbf99d03b3ad99427e41cb4f87fa746e4e83fd20fabd
MD5 ea47bf30cfc2d4ef046f18fdf4e63359
BLAKE2b-256 25c94a3587c724fe652e91698ab9983fbf754d09207583e4a32e36d3c382f634

See more details on using hashes here.

Provenance

The following attestation bundles were made for paperlib_mcp-0.1.1-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.

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