Skip to main content
Glama
ypolosov

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
doc_idYesDocument ID to delete

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It correctly states that the deletion affects the local index store, which is useful, but it does not disclose permanence, side effects, or error behavior if the document ID is invalid.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single clear sentence with no redundant information, fully meeting the conciseness requirement.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter delete operation with no output schema, the description adequately covers the action and scope. It could mention that deletion is permanent, but the simplicity of the tool reduces the need for extensive detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the doc_id parameter is fully described in the schema. The description adds no additional parameter semantics beyond what is already provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Removes') and resource ('document from the local index store'), clearly distinguishing it from sibling tools like index_document and get_page_content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The intended usage is implied by the verb and resource, but there is no explicit guidance on when to use this tool over alternatives or any exclusions. It does not mention sibling tools or provide context for appropriate deletion scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_document_treeGet Document TreeA

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

ParametersJSON Schema
NameRequiredDescriptionDefault
doc_idYesDocument ID
max_depthNoMaximum depth to display (default: 4)

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden. It clearly indicates a read-only retrieval of a tree, but it does not disclose error behavior (e.g., invalid doc_id) or any limitations beyond schema hints. The description is adequate but lacks richer detail on edge cases or prerequisites.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences, front-loaded with the primary action and usage context. Every word earns its place, with no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (2 params, no output schema), and the description covers what it returns and a typical use case. It could mention the structure of the returned tree or error conditions, but overall it is sufficiently complete for a tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for both doc_id and max_depth, including defaults and bounds. The description adds no additional parameter meaning beyond what the schema already provides, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns the full hierarchical tree structure of an indexed document, using a specific verb ('Returns') and resource. It is easily distinguished from siblings like get_page_content (page content) and list_documents (document list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Useful to understand document organization before searching' provides clear context for when to use the tool, implying a pre-search orientation use case. It does not explicitly exclude alternatives or name sibling tools, but the context is clear enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
doc_idYesDocument ID (must be indexed first with index_document)
node_idNoTree node ID to extract content from (use get_document_tree to find IDs)
end_pageNoEnd page number (alternative to node_id)
start_pageNoStart page number (alternative to node_id)

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must fully disclose behavior. It does add notable context such as 'this tool just returns raw text' and 'Claude Code handles all reasoning,' which clarifies it is a dumb read-only operation. However, it doesn't disclose potential ambiguity when providing both node_id and page parameters, nor error behavior for unindexed or missing documents. The description covers the core behavior but leaves these edge cases unaddressed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences that are front-loaded with purpose and immediately provide a workflow hint. There is no redundancy or filler; every word adds value. This is an exemplary concise structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no output schema, the description states it returns raw text, which is a minimal but valid return explanation. It also captures the indexing prerequisite and the expected workflow with get_document_tree. It falls short of explicitly explaining parameter exclusivity (node_id vs. pages) or edge cases, but given the simplicity of a content-extraction tool, this is fairly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already provides 100% parameter description coverage, including the note for node_id to 'use get_document_tree to find IDs.' The description adds little new information, only a general mention of 'specific pages or a tree node.' While this reinforces the parameter usage, it doesn't significantly deepen the schema's existing guidance, so a baseline score is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with 'Extracts text content from specific pages or a tree node of an indexed document,' which clearly identifies the action (extracts) and the resource (text content from an indexed document). This distinguishes it from sibling tools like get_document_tree (which returns structure) and index_document (which indexes), making the purpose unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The instruction 'Use get_document_tree first to find relevant node_ids, then call this to read the content' provides an explicit workflow and places the tool in a sequence. It doesn't explicitly state when not to use it, but the complementary relationship with get_document_tree and the contrast with other siblings (list, delete) is clear. This is solid guidance without being overly verbose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
doc_idYesUnique identifier for this document (alphanumeric, hyphens, underscores)
pdf_pathYesAbsolute path to the PDF file on local filesystem
toc_check_pagesNoPages to scan for table of contents (default: 20)
max_pages_per_nodeNoMax pages per tree node (default: 10)

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the one-time nature and external prerequisites, which are important behavioral traits. It doesn't detail filesystem side effects or failure behavior, but the core behavior is clearly stated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two succinct sentences. The first front-loads the main action and output; the second compactly lists prerequisites. Every word earns its place with no redundant content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, prerequisites, and one-time behavior, and the schema fully documents all parameters. It lacks explicit return-value or error semantics, but the tool's moderate complexity doesn't demand much more.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers 100% of parameters with descriptions. The tool description itself adds no parameter-level detail beyond what the schema already provides, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Converts') with a clear resource (local PDF) and output (PageIndex hierarchical tree structure). It clearly distinguishes this indexing/write operation from the sibling read/list/delete tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States this is a one-time operation per document and lists required environment variables (PAGEINDEX_REPO_PATH, OPENAI_API_KEY), giving clear context for when it applies. It doesn't explicitly name alternatives, but the prerequisites and one-time nature imply when it should be used versus read-only siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_documentsList Indexed DocumentsA

Lists all documents in the local PageIndex store with metadata.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the local PageIndex store and that metadata is included, giving some context. However, it does not explicitly state that the operation is read-only or non-mutating, though 'Lists' strongly implies this.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It conveys the essential information efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with no parameters and no output schema, the description is sufficiently complete. It states what is listed and the source store. It could mention a typical use case, but that is not essential for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema already reflects that. With schema description coverage at 100%, the description adds no additional parameter semantics, but the baseline for zero params is 4. There is nothing missing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Lists' with a clear resource: 'all documents in the local PageIndex store with metadata.' This clearly distinguishes it from sibling tools like index_document, get_page_content, get_document_tree, and delete_document, each of which has a different action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies when to use this tool (when you need a list of all indexed documents), but it does not explicitly mention alternatives or exclusions. Sibling tool names are visible, but no direct comparison is made.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv1.0.0
    • First observeddelete_document
    • First observedget_document_tree
    • First observedget_page_content
    • First observedindex_document
    • First observedlist_documents

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 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.
    -
  • 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
    2
    -
  • 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
    D
    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.
    -