Skip to content

doc sources: local: and okf: list the files of a tree without a directory they cannot list; what should they do? #1207

Todo

Description

@antonwolfy

LocalMarkdownClient._collect_files (mcp/local_markdown.py) and OKFClient._iter_candidate_files (mcp/okf_client.py) list with Path.rglob("*"), which skips a directory that cannot be listed (mode 0o111, as a non-root user) without an error. A source whose docs hold a.md and sub/b.md, with sub unlistable, returns ['a.md']: the measured docs are a smaller set and nothing says so.

The contract does not settle what a user should see. Today: a path that does not exist raises MCPConnectionError; a directory with no doc files logs a warning and returns []; a file that cannot be read is skipped with a debug log (# noqa: BLE001 - ... one unreadable file is skipped). docs/adding-doc-source.md says nothing about an unreadable directory.

Options: (a) raise MCPConnectionError for the directory, as for a missing path, so a preflight and the run refuse it; (b) skip it with a warning that names it, as for an empty source; (c) keep the silent skip and document it. digest_entries.listed_entries lists what rglob("*") lists and raises the OSError, so (a) is a few lines per client; check_connection would need to decide too. Which one?

Found while fixing #1168. The fix's PR is #1211.

Activity

  1. self-assigned this
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions