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.3.tar.gz (234.1 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.3-py3-none-any.whl (97.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: paperlib_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 234.1 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.3.tar.gz
Algorithm Hash digest
SHA256 95964879d237307346e79b83eed976340c4dd770b0735c4162f5a7b135507758
MD5 5abc11617a8bb7d808dbdd02cb0757e9
BLAKE2b-256 eca848c741788a0267bc46f4d647c334560ffcd5fd7a0ffc1491055d83c0934f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: paperlib_mcp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 97.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1881b8aa4232bef078b05d7af9bd1e140aa936e93a464a924f52fb3d8d35c0e1
MD5 a08b2338ea618fe8d3387c7016fd2ab8
BLAKE2b-256 a42ea1ed7decd2e4e3362ad39a219068c14016335e270b0473d6dda8af445938

See more details on using hashes here.

Provenance

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