MCP Configuration
CLI
docslicer-mcp [--transport stdio|http|sse] [--host HOST] [--port PORT] [--root DIR]| Flag | Default | Description |
|---|---|---|
--transport | stdio | stdio for local clients, http for a networked server, sse for legacy clients |
--host | 127.0.0.1 | Bind host for http/sse |
--port | 8000 | Bind port for http/sse |
--root | — | Restrict file sources and outputs to this directory tree (sets DOCSLICER_MCP_ROOT) |
--version | — | Print the DocSlicer version |
Desktop clients launch the server over stdio — they spawn the process and speak to it on its pipes. Use http only when the server runs somewhere the client cannot spawn it.
Environment variables
| Variable | Default | Effect |
|---|---|---|
DOCSLICER_MCP_ROOT | unset | Restrict file sources and written output to this directory tree |
DOCSLICER_MCP_ALLOW_URLS | 1 | Set to 0 to reject http(s) sources |
DOCSLICER_MCP_CACHE | ~/.cache/docslicer-mcp | Where parsed results are persisted |
DOCSLICER_MCP_CACHE_MAX_MB | 2048 | Cache size ceiling, oldest pruned first; 0 disables pruning |
DOCSLICER_MCP_FULL_TEXT | 6000 | Token ceiling under which parse returns the whole document instead of an outline; 0 always returns the outline |
Set them in the client's env block:
{
"mcpServers": {
"docslicer": {
"command": "uvx",
"args": ["--from", "docslicer[mcp]", "docslicer-mcp"],
"env": {
"DOCSLICER_MCP_ROOT": "/Users/you/Documents",
"DOCSLICER_MCP_ALLOW_URLS": "0",
"DOCSLICER_MCP_CACHE_MAX_MB": "512"
}
}
}
}Sandboxing
Set DOCSLICER_MCP_ROOT when exposing the server to anything but yourself. Without it, any path the server process can read is parseable, and to_markdown can write anywhere that process can write.
With a root set, parse refuses sources outside the tree and to_markdown refuses destinations outside it, both with an error telling the caller to move the file or adjust the root. Symlinks are resolved before the check, so a link pointing out of the tree does not escape it.
DOCSLICER_MCP_ALLOW_URLS=0 additionally closes off http(s) sources — worth pairing with a root on a shared or networked server, since parse is otherwise the one tool that reaches off the machine.
The Claude Desktop .mcpb extension asks for the allowed folder during install and sets the root for you.
Cache
Parsed results are persisted under DOCSLICER_MCP_CACHE so re-parsing the same file with the same options is free. The cache key includes the file's size and mtime, so editing a document invalidates its entry automatically — refresh: true on parse forces a re-parse regardless.
When the directory exceeds DOCSLICER_MCP_CACHE_MAX_MB, the oldest entries are pruned first. Set it to 0 to disable pruning entirely.
Full-text threshold
DOCSLICER_MCP_FULL_TEXT sets the token count under which parse returns the document itself rather than an outline. The default of 6000 reflects the tradeoff: an outline earns its round trip by letting most of a document go unread, and on a short document there is nothing to leave out, so the outline plus a read call costs more than the text did.
Raise it if your clients have large context windows and you would rather trade tokens for round trips. Set it to 0 to always return the outline.
A second rule sits above the threshold: a document up to twice the budget (capped at 12,000 tokens) also comes back whole if its outline says nothing useful — fewer than three headings, or headings so dense they cost a quarter of the text they index. Such an outline is not merely wasteful but actively misleading, offering a structure to choose from that does not carve the document anywhere.
Next steps
- Tools — parameter and response reference
- MCP Server — install and design