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
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.0.tar.gz (225.3 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.0-py3-none-any.whl (93.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: paperlib_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 225.3 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.0.tar.gz
Algorithm Hash digest
SHA256 caad43f8b000161c55f3f5f9c49873f90b9b4fcfd6879b04c2af4ec91b627284
MD5 63244b4d6d9253724352cc4b4bfd00d0
BLAKE2b-256 045323ef3fa1a65529813dd3de34d3839c36387cf53b272bed48810be2f801f3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: paperlib_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 93.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00fddb1a2e879668637d9669abbf52aa426c4a8e5951825b68eb189b468fdaf0
MD5 fcfbc588bca11c3459c9337fca4d6bd2
BLAKE2b-256 a18223681b426c6b161cc752c341ac3e1c618fa553f95ef300c3d339cf2a17e1

See more details on using hashes here.

Provenance

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