Skip to main content
Glama
mcpdisk

mcpdisk

by atpanos

mcpdisk

Read-only filesystem search for MCP. Find files by name, search their contents, and read text, PDF, Office, notebook, mail, HTML, SQLite and archive content — without giving the model write access.

Built with Python 3.13, uv and the official mcp SDK v2. Works over stdio locally and Streamable HTTP in Docker.

Tools

Tool

Purpose

list_directory

list entries below a path, depth-limited, dirs first

search_files

find files/directories by glob, with ignore rules

search_content

search text contents by literal or regex, with context

read_file

read text with line ranges and encoding fallback

read_document

read PDF, DOCX, PPTX, XLSX, IPYNB, EML, SRT/VTT, HTML, SQLite, ZIP/TAR

stat_path

metadata plus text/binary/document classification

Every tool validates paths against the configured roots. There are no write tools; archives are inspected, never extracted to disk.

Related MCP server: paddock

Quick start (Docker)

cp .env.example .env
$EDITOR .env            # set MCPDISK_TOKEN and MCPDISK_HOST_PATH
docker compose up -d --build
curl http://127.0.0.1:8000/healthz

The host directory in MCPDISK_HOST_PATH is mounted read-only at /data and is the only readable root. The endpoint is http://127.0.0.1:8000/mcp and requires Authorization: Bearer $MCPDISK_TOKEN.

Smoke test (builds, starts, checks health, auth and the MCP handshake):

./scripts/smoke.sh

Quick start (local, stdio)

uv sync
MCPDISK_ROOTS=/home/panos/prj uv run python -m mcpdisk

stdio is the default transport. The process speaks MCP on stdin/stdout.

Local over HTTP

MCPDISK_ROOTS=/home/panos/prj \
MCP_TRANSPORT=http MCP_AUTH_TOKEN=change-me MCP_HTTP_PORT=8000 \
uv run python -m mcpdisk

Without MCP_AUTH_TOKEN, binding to a non-loopback address is refused at startup.

Configuration

Variable

Default

Meaning

MCPDISK_ROOTS

current directory

:-separated allowlist of readable roots

MCP_TRANSPORT

stdio

stdio or http

MCP_HTTP_HOST

127.0.0.1

HTTP bind address

MCP_HTTP_PORT

8000

HTTP port

MCP_AUTH_TOKEN

–

bearer token; required for non-loopback binds

MCP_PUBLIC_URL

–

public URL, added to the Host/Origin allowlist

MCP_MAX_RESULTS

200

default result limit

MCP_MAX_FILE_BYTES

10485760

per-file limit for text search

MCP_MAX_DOC_CHARS

20000

default character budget per document call

MCP_TIMEOUT_S

15

per-tool timeout

MCP_CACHE_ENTRIES

32

LRU size for PDF/Office extraction

Security model

  • Allowlist only. Every path is resolved with realpath and must stay inside MCPDISK_ROOTS. .., absolute paths outside and symlinked directories cannot escape.

  • No write operations. The server never creates, modifies or deletes files.

  • Symlinks are reported, not followed. Reading a symlink that points outside the roots is rejected.

  • Read-only containers. Compose mounts the host directory :ro, runs the container as UID 10001, uses a read-only root filesystem and drops privilege escalation.

  • HTTP auth. /mcp requires a bearer token compared in constant time; /healthz is open for health checks. DNS-rebinding protection validates Host and Origin.

  • Archives. Entry names are checked for zip-slip, entries are capped at 10 MB and compression ratios above 100:1 are refused. Nothing is extracted to disk.

  • Bounded work. Depth, entry counts, match counts, file sizes and run time are all capped; regexes have a per-line timeout.

Client setup

OpenCode (V2)

{
  "mcp": {
    "servers": {
      "mcpdisk": {
        "type": "remote",
        "url": "http://127.0.0.1:8000/mcp",
        "oauth": false,
        "headers": { "Authorization": "Bearer {env:MCPDISK_TOKEN}" }
      }
    }
  }
}

Claude Desktop (stdio)

{
  "mcpServers": {
    "mcpdisk": {
      "command": "/home/panos/prj/mcpdisk/.venv/bin/python",
      "args": ["-m", "mcpdisk"],
      "env": { "MCPDISK_ROOTS": "/home/panos/prj" }
    }
  }
}

Tool reference

list_directory

{"path": "src", "depth": 2, "include_hidden": false, "limit": 500}

depth 1–3; directories sort first. Symlinks appear with symlink_target.

search_files

{"pattern": "*.py", "max_depth": 8, "limit": 200, "sort": "name"}

Gitignore-style patterns relative to the search root: *.py matches at any depth, /main.py only at the top, src/**/*.toml below src. VCS metadata, caches, virtualenvs and build output are always pruned. Extra ignore patterns are supported.

search_content

{"pattern": "TODO", "file_glob": "*.py", "context_lines": 1, "max_results": 100}

Literal by default; set is_regex for a regular expression. Binary and oversized files are skipped and counted. With include_documents: true PDFs and Office files are searched too; those matches carry a page and a section label.

read_file

{"path": "README.md", "start_line": 1, "end_line": 40}

Returns numbered lines. Binary files and PDFs are rejected with a pointer to read_document. Non-UTF-8 files fall back to cp1252.

read_document

{"path": "report.pdf", "sections": "1-5"}
{"path": "deck.pptx", "include_notes": true}
{"path": "book.xlsx", "sheet": "Sales", "rows": "1-100"}
{"path": "notebook.ipynb", "include_outputs": true}
{"path": "store.db", "table": "items"}
{"path": "bundle.zip", "entry": "notes.txt"}

Format

Sections

PDF

pages, "S. 1"

DOCX

blocks of 40 paragraphs/tables

PPTX

slides, optional speaker notes

XLSX

sheets; without sheet only the listing

IPYNB

cells, optional outputs

EML

headers, body parts, attachment list

SRT/VTT

subtitle blocks of 100 cues

HTML

text lines in chunks of 200

SQLite

schema or one table (LIMIT 100)

ZIP/TAR

entry listing or a single text entry

Scanned PDFs without a text layer are reported instead of returning garbage; OCR is not supported.

stat_path

{"path": "data.bin"}

Returns kind, size, mtime, mode, symlink target, content (text/binary/empty), a format subkind and readable. Run it before read_file when unsure.

Limits

  • max. 500 directory entries per listing, 2000 matches per file search

  • max. 20 matches per file, 1000 matches per content search

  • max. 10 MB per file for content search, 50 MB hard cap for reads

  • max. 200 pages/blocks per document call, 500 rows × 40 columns per sheet

  • max. 50 documents per search call, 100 000 characters per extraction

  • 15 s default timeout per tool call

  • 50 ms regex timeout per line

Development

uv sync
uv run pytest
uv run ruff check .
uv run ruff format --check .

Inspect the server interactively with the MCP Inspector:

MCPDISK_ROOTS=/home/panos/prj npx @modelcontextprotocol/inspector uv run python -m mcpdisk

Troubleshooting

Symptom

Cause / fix

401 Unauthorized

missing or wrong Authorization: Bearer …

421 Misdirected Request

Host/Origin not in the allowlist; set MCP_PUBLIC_URL

outside the allowed roots

path is not below MCPDISK_ROOTS (check symlinks)

no text layer detected

scanned PDF; OCR is not supported

search returns nothing

check ignore rules, hidden files and include_documents

timeout stop reason

narrow the path/pattern or raise MCP_TIMEOUT_S

gzip file

only tar archives (including .tgz) are supported

permission denied on /data

UID 10001 needs read access to the mounted files

License

MIT — see LICENSE.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables safe, read-only browsing of allowlisted local directories through MCP, providing tools to list roots, read files, and search text.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      A local filesystem MCP server providing constrained file operations (read/write, directory management, search, metadata) within configurable directories, with read-only mode and zero runtime dependencies.
      4 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP clients to browse and read files, folders, photo albums, and metadata in the user's cloud drive through a read-only stdio server, including folder listing, full-text search, glob-based finding, file reading, item stats, and storage quota reporting.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to search local files by name, path, metadata, and literal text over MCP on Windows, Linux, and macOS, while keeping searches within explicitly configured directories and running locally over stdio.
      7
      1
      MIT