Skip to main content
Glama
pageindex-mcp

pageindex-mcp

by ypolosov

pageindex-mcp

Self-hosted MCP server для Claude Code, реализующий PageIndex vectorless RAG полностью локально.

Архитектура

Claude Code (Max plan — handles all reasoning)
    │  stdio
    ▼
pageindex-mcp (TypeScript)
    ├── index_document    ──→ run_pageindex.py (Python, local)
    │                           └── OpenAI API (tree generation, one-time)
    ├── get_document_tree ──→ local JSON
    ├── get_page_content  ──→ pdftotext (local)
    ├── list_documents    ──→ local filesystem
    └── delete_document   ──→ local filesystem

Никаких LLM-вызовов внутри сервера — Claude Code сам навигирует дерево и анализирует контент. Не нужен ANTHROPIC_API_KEY.

Related MCP server: pageindex-local-mcp

Предварительные требования

# 1. Node.js ≥ 18
node --version

# 2. Python PageIndex repo
git clone https://github.com/VectifyAI/PageIndex /opt/pageindex
cd /opt/pageindex && pip install -r requirements.txt

# 3. poppler-utils для извлечения текста из PDF
# Ubuntu/Debian:
sudo apt install poppler-utils
# macOS:
brew install poppler

Установка и сборка

npm install
npm run build

Переменные окружения

Переменная

Обязательна

Описание

OPENAI_API_KEY

да (для индексации)

PageIndex генерирует дерево через OpenAI

PAGEINDEX_REPO_PATH

да

Путь к клонированному репозиторию PageIndex

INDEX_STORE_PATH

нет

Где хранить JSON индексы (default: ~/.pageindex-store)

PAGEINDEX_MODEL

нет

OpenAI модель (default: gpt-4o-2024-11-20)

Для OpenRouter вместо прямого OpenAI:

OPENAI_BASE_URL=https://openrouter.ai/api/v1
OPENAI_API_KEY=sk-or-v1-...
PAGEINDEX_MODEL=openai/gpt-4o

Подключение к Claude Code

Вариант A: локальный stdio (рекомендуется)

Добавить в ~/.claude.json или .mcp.json в проекте:

{
  "mcpServers": {
    "pageindex-local": {
      "command": "node",
      "args": ["/absolute/path/to/pageindex-mcp/build/index.js"],
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "PAGEINDEX_REPO_PATH": "/opt/pageindex"
      }
    }
  }
}

Вариант B: dev-режим (tsx, без сборки)

{
  "mcpServers": {
    "pageindex-local": {
      "command": "npx",
      "args": ["tsx", "/absolute/path/to/pageindex-mcp/src/index.ts"],
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "PAGEINDEX_REPO_PATH": "/opt/pageindex"
      }
    }
  }
}

Использование в Claude Code

# 1. Индексировать документ (один раз)
"Проиндексируй PDF /path/to/spec.pdf с id pam-spec"

# 2. Посмотреть структуру документа
"Покажи структуру документа pam-spec"

# 3. Извлечь контент конкретной секции
"Покажи содержимое ноды 0005 в документе pam-spec"

# 4. Список всех документов
"Какие документы проиндексированы?"

# 5. Удалить индекс
"Удали индекс pam-spec"

Claude Code сам навигирует дерево, выбирает нужные секции и отвечает — не нужны отдельные API-вызовы.

Инструменты MCP

Инструмент

Описание

index_document

Генерирует PageIndex tree из PDF (один раз, затем переиспользуется)

get_document_tree

Иерархическая структура документа для навигации

get_page_content

Извлечение текста по node_id или диапазону страниц

list_documents

Список проиндексированных документов с метаданными

delete_document

Удалить документ из индекса

Стоимость

  • Индексация (разово): ~$0.10–0.50 за документ (OpenAI gpt-4o)

  • Поиск: бесплатно на Claude Code Max plan

  • Хранение: локальные JSON файлы

Ограничения

  • Генерация дерева требует OpenAI API (hardcoded в Python PageIndex)

  • Для больших PDF (500+ стр.) индексация может занять несколько минут

  • Без poppler-utils текст страниц не извлекается (только метаданные дерева)

Available Tools

5 tools
delete_documentDelete Indexed DocumentA

Removes a document from the local index store.

Inputs: doc_id (required).

get_document_treeGet Document TreeA

Returns the full hierarchical tree structure of an indexed document. Useful to understand document organization before searching.

Inputs: doc_id (required), max_depth.

get_page_contentGet Page ContentA

Extracts text content from specific pages or a tree node of an indexed document. Use get_document_tree first to find relevant node_ids, then call this to read the content. Claude Code handles all reasoning — this tool just returns raw text.

Inputs: doc_id (required), node_id, end_page, start_page.

index_documentIndex PDF DocumentA

Converts a local PDF into a PageIndex hierarchical tree structure. This is a one-time operation per document. Requires: PAGEINDEX_REPO_PATH env var pointing to cloned VectifyAI/PageIndex repo, and OPENAI_API_KEY for tree generation.

Inputs: doc_id (required), pdf_path (required), toc_check_pages, max_pages_per_node.

list_documentsList Indexed DocumentsA

Lists all documents in the local PageIndex store with metadata.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a distinct action: indexing, reading content, listing documents, retrieving structure, and deleting. No overlap or confusion between tools.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern: index_document, get_page_content, list_documents, get_document_tree, delete_document.

    Tool Count5/5

    With 5 tools, the set is well-scoped for the domain of document indexing and retrieval. Every tool serves a clear, necessary function without redundancy.

    Completeness5/5

    The tools cover the full lifecycle of a document in the index: create (index), read (list, tree, content), and delete. No critical operations are missing given the stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A local-first MCP server that enables semantic search over PDF and DOCX documents using structure-aware parsing and vector storage. It allows users to query their local knowledge base through Claude Code without cloud dependencies or GPU requirements.
      1
      -
    • F
      license
      B
      quality
      D
      maintenance
      A local-first MCP server for PageIndex — the vectorless, reasoning-based RAG framework. It lets local AI agents index and query local PDF and Markdown documents through a self-hosted PageIndex installation, without requiring any PageIndex cloud API key.
      8
      3
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Local MCP server that indexes folders of documents into a hybrid vector + keyword search index for Claude Desktop, with support for PDFs, Office files, and images via OCR.
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      A self-hosted MCP server for PageIndex's vectorless, reasoning-based document retrieval. It ingests PDFs into a hierarchical table of contents using an LLM and serves documents, structure, and page content via MCP tools.
      -