Doc Index MCP
What is This For?
A local-first semantic search server for your documents. Index PDFs, Word docs, PowerPoints, Excel files, and text/markdown, then search them using natural language via the Model Context Protocol (MCP).
- Semantic search - Find relevant content using natural language queries
- Boundary-aware chunking - Respects document structure (chapters, sections, headers)
- Table extraction - Extract tables from documents as CSV
- Fully local - No external APIs, no cloud services, no Docker containers, no PyTorch
- Lightweight - ONNX-based embeddings (~50MB vs ~2GB for PyTorch)
Quick Start
1. Add to your MCP config
Requires uv. If you don't have uv, see Alternative Installation below.
Add to .mcp.json in your project root (for Claude Code) or your Claude Desktop config:
{
"mcpServers": {
"doc-index": {
"command": "uvx",
"args": ["doc-index-mcp"]
}
}
}
2. Install the Claude skill (optional)
The skill teaches Claude how to use the search tools effectively (token budgets, boundary expansion, etc.):
uvx --from doc-index-mcp doc-index-install-skill
That's it — start asking Claude to index and search your documents.
Supported Formats
| Format | Extensions | Notes |
|---|---|---|
| Text | .txt |
Plain text |
| Markdown | .md, .markdown |
Preserves headers for boundaries |
.pdf |
Text extraction with page markers | |
| Word | .docx |
Paragraphs, headings, tables |
| PowerPoint | .pptx |
Slides, notes, tables |
| Excel | .xlsx, .xls |
Sheets as tables |
Why No External Services?
| Component | Traditional RAG | This Server |
|---|---|---|
| Embeddings | OpenAI API / hosted model | Local ONNX model (fastembed) |
| Vector DB | Pinecone / Weaviate / Qdrant | Local file (usearch) |
| Storage | Cloud / managed DB | Local .docindex/ directory |
| Dependencies | PyTorch (~2GB) | ONNX Runtime (~50MB) |
Tools
doc_index
Index a document for semantic search.
{
"file_path": "docs/manual.pdf",
"source_name": "manual"
}
doc_search
Search indexed documents using natural language.
{
"query": "how to configure authentication",
"top_k": 5,
"expand_to_boundary": "section",
"max_return_tokens": 4096
}
Parameters:
query- Search querysources- Filter to specific sources (optional)top_k- Number of results (default: 5)expand_to_boundary- Expand results to full "chapter", "section", "subsection", or "page"max_return_tokens- Token budget for results (default: 4096)include_siblings- Include sibling sections when expanding
doc_list
List all indexed sources.
doc_chunk
Retrieve a specific chunk by ID with optional neighbors.
{
"chunk_id": "manual:42",
"neighbors": 2
}
doc_toc
Get the table of contents (chapters, sections, subsections) for an indexed document. Use this to understand document structure before retrieving specific content.
{
"source_name": "manual",
"max_depth": 3
}
doc_get_content
Retrieve document content by structural location. Provide exactly one locator: boundary_id, chapter, section, or pages.
{
"source_name": "manual",
"chapter": "3",
"max_return_tokens": 8192
}
read_document
Read a document without indexing. Returns formatted text.
{
"file_path": "report.pdf",
"max_chars": 100000
}
list_tables
List all tables in a document.
{
"file_path": "data.xlsx"
}
extract_table
Extract a specific table as CSV.
{
"file_path": "data.xlsx",
"table_index": 0,
"max_rows": 100
}
Environment Variables
| Variable | Description | Default |
|---|---|---|
MCP_WORKING_DIR |
Base directory for resolving file paths | Current working directory |
DOC_INDEX_DIR |
Directory for storing vector indices | .docindex in working dir |
Alternative Installation
Install globally with pip
pip install doc-index-mcp
Then in your .mcp.json:
{
"mcpServers": {
"doc-index": {
"command": "doc-index-mcp"
}
}
}
Install from source
Clone the repo and install dependencies:
git clone https://github.com/mike-anderson/doc-index-mcp.git
cd doc-index-mcp
pip install -e .
Then point your .mcp.json at the server entrypoint:
{
"mcpServers": {
"doc-index": {
"command": "python",
"args": ["/path/to/doc-index-mcp/src/server.py"]
}
}
}
Architecture
Everything runs locally - no external APIs, databases, or embedding servers required.
flowchart TB
subgraph Client["MCP Client (Claude Desktop, etc.)"]
LLM[LLM]
end
subgraph MCP["Doc Index MCP Server"]
Server[server.py]
subgraph Services["Local Services"]
Loader[Document Loader<br/>PDF, DOCX, PPTX, XLSX]
Chunker[Boundary-Aware<br/>Chunker]
Embedder[Embedder<br/>ONNX Runtime]
VectorStore[Vector Store<br/>usearch]
end
end
subgraph Storage["Local Filesystem"]
Docs[(Source<br/>Documents)]
Index[(".docindex/<br/>├── manifest.json<br/>└── vectors/<br/> ├── index.usearch<br/> ├── chunks.jsonl<br/> └── boundaries.json")]
end
subgraph Models["Embedded Model (downloaded once)"]
ONNX[BAAI/bge-small-en-v1.5<br/>ONNX format ~50MB]
end
LLM <-->|MCP Protocol| Server
Server --> Loader
Server --> Chunker
Server --> Embedder
Server --> VectorStore
Loader -->|read| Docs
VectorStore <-->|read/write| Index
Embedder -->|load once| ONNX
style Client fill:#e1f5fe
style Storage fill:#fff3e0
style Models fill:#f3e5f5
style MCP fill:#e8f5e9
Data Flow
flowchart LR
subgraph Index["Indexing"]
direction TB
A[Document] --> B[Load & Extract Text]
B --> C[Detect Boundaries]
C --> D[Chunk ~256 tokens]
D --> E[Generate Embeddings]
E --> F[Save to Disk]
end
subgraph Search["Searching"]
direction TB
G[Query] --> H[Embed Query]
H --> I[Vector Similarity Search]
I --> J[Expand to Boundaries]
J --> K[Return Results]
end
Index -.->|stored in .docindex/| Search
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file doc_index_mcp-0.1.1.tar.gz.
File metadata
- Download URL: doc_index_mcp-0.1.1.tar.gz
- Upload date:
- Size: 198.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb6d11d77769103126e36d5289f6f049a4d8b3a6a5ff8c81e0f5b772bcf41805
|
|
| MD5 |
17de160c08e9896959daa222f48c190f
|
|
| BLAKE2b-256 |
093793f6dc0057960a7d88e7e2ab2d7bea291787ae229eac06ef8f244f7d1698
|
Provenance
The following attestation bundles were made for doc_index_mcp-0.1.1.tar.gz:
Publisher:
publish.yml on mike-anderson/doc-index-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
doc_index_mcp-0.1.1.tar.gz -
Subject digest:
cb6d11d77769103126e36d5289f6f049a4d8b3a6a5ff8c81e0f5b772bcf41805 - Sigstore transparency entry: 2387468511
- Sigstore integration time:
-
Permalink:
mike-anderson/doc-index-mcp@473a4aed86572abe91eaa981d9871513b54fd181 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mike-anderson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@473a4aed86572abe91eaa981d9871513b54fd181 -
Trigger Event:
push
-
Statement type:
File details
Details for the file doc_index_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: doc_index_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 73.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf926645de7a45c6330219f650a53bde124be1a9e27a807dc24c4ce258c0631d
|
|
| MD5 |
5fedecaa46258fca5aa749eb3378667a
|
|
| BLAKE2b-256 |
39d21d4ffa974fe8541b01e8156e0918776f145973d78bf187f83be04a21ddf8
|
Provenance
The following attestation bundles were made for doc_index_mcp-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on mike-anderson/doc-index-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
doc_index_mcp-0.1.1-py3-none-any.whl -
Subject digest:
bf926645de7a45c6330219f650a53bde124be1a9e27a807dc24c4ce258c0631d - Sigstore transparency entry: 2387468516
- Sigstore integration time:
-
Permalink:
mike-anderson/doc-index-mcp@473a4aed86572abe91eaa981d9871513b54fd181 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mike-anderson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@473a4aed86572abe91eaa981d9871513b54fd181 -
Trigger Event:
push
-
Statement type: