docshelf-mcp

v0.5.0
docshelf-mcp Checked 1 day ago Published 1 month ago

MCP server for managing AI-friendly document collections — convert PDFs, split by chapter, index for chat projects.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

docshelf_init_shelf

Bootstrap a new document shelf at ``shelf_path``. Creates the directory layout (``docs/``, ``INDEX.md``, ``.docshelf.json``, ``.gitignore``), pre-creates any ``default_categories``, and stores the ``github_remote`` so generated INDEX entries link to raw GitHub URLs. Idempotent — safe to call on an existing shelf to update metadata.

ParameterTypeDescription
params *

docshelf_add_document

Add a PDF or Markdown file to the shelf and refresh INDEX.md. * ``.pdf`` is converted to Markdown (``pymupdf4llm`` by default — the ``pdf`` extra; pass ``quality='high'`` to use ``marker-pdf``). * Documents larger than 50 KB with multiple H2 headings are split into one file per section (turn this off with ``split=False``). * If a *different* title/category slugifies onto a path an existing document already occupies, the call errors instead of overwriting it — pass ``overwrite=true`` to replace it. Re-adding the same title updates in place. The res…

ParameterTypeDescription
params *

docshelf_add_directory

Add every matching file in a directory, rebuilding INDEX.md once. Scans ``source_dir`` (non-recursively) for ``patterns`` — every supported input type by default (Markdown, PDF, DOCX, HTML, EPUB) — adds each under ``category`` with a title derived from its filename, and regenerates INDEX.md a single time. A corrupt or unreadable file is reported in ``failed`` without aborting the batch.

ParameterTypeDescription
params *

docshelf_read_document

Read a document or section file from inside the shelf's ``docs/``. Returns the file content directly over MCP — useful for private or purely-local shelves where the ``raw.githubusercontent.com`` fetch trick doesn't apply. Pass a ``relative_path`` from ``search`` / ``list_documents``. Large files are truncated to ``max_bytes`` (default 100 KB) with ``truncated: true``; page with the returned ``next_offset`` (slices snap to UTF-8 character boundaries, so it may differ from ``offset + max_bytes`` — using it avoids splitting a multibyte character) or read the i…

ParameterTypeDescription
params *

docshelf_remove_document

Remove a document — its file, split sections, and metadata entry. Accepts the filename, the slug, or the human title used at add time. INDEX.md is regenerated automatically. Pass ``dry_run=true`` to see what would be deleted without touching anything. The caller still owns the git commit / push step.

ParameterTypeDescription
params *

docshelf_rename_document

Retitle, recategorize, or re-describe a document — no re-conversion. Moves the document ``.md``, its split-section directory, and its ``.meta.json`` entry (changing the slug when the title changes, or the directory when the category changes), then regenerates INDEX.md. Give at least one of ``new_title`` / ``new_category`` / ``new_description``. Refuses to clobber an existing target. Pass ``dry_run=true`` to preview. The caller still owns the git commit / push step.

ParameterTypeDescription
params *

docshelf_rebuild_index

Regenerate ``INDEX.md`` from the current on-disk shelf state. Useful after manual edits to ``docs/`` or ``.docshelf.json``.

ParameterTypeDescription
params *

docshelf_doctor

Check the shelf for drift and optionally apply the safe fixes. Reports stale `.meta.json` entries, orphaned split directories, split sections out of sync with their parent, a stale `INDEX.md`, duplicate titles, and empty categories. Read-only by default; pass ``fix=true`` to prune stale meta entries, delete orphaned split dirs, and rebuild the index (other findings stay report-only). Findings are sorted for stable diffing.

ParameterTypeDescription
params *

docshelf_list_documents

List documents grouped by category. Pass a ``category`` to filter; omit it to list everything.

ParameterTypeDescription
params *

docshelf_convert_pdf

Standalone PDF → Markdown conversion (no shelf, no INDEX update). Use when you want the converted file but don't yet want to commit it to a shelf. Optionally splits the result by H2.

ParameterTypeDescription
params *