Skip to content

[Windows] MCP tool interface cannot recognize existing local PDF files #6

@iiishop

Description

@iiishop

Environment: Windows 10, Python 3.11, poetry installation, latest mcp-document-reader.

Problem Description:

  • In the poetry virtual environment, all path formats (absolute, relative, forward slash, backslash) can be correctly recognized by Python's Path().exists(), and the file does exist.
  • However, when calling the MCP tool interface of mcp-document-reader (such as get_pdf_metadata), no matter which path is passed, it always reports "The file ... does not exist."
  • File permissions, cwd, and path formats have all been checked and are correct. Directly calling PDFReader in readers.py with Python works fine.

Reproduction Steps:

  1. Place the PDF file (e.g., 1.pdf) in the cwd directory of mcp-document-reader.
  2. Enter the poetry shell, and manually test Path('1.pdf').exists(), which returns True.
  3. Use the MCP tool interface get_pdf_metadata to read the same path, and it always reports the file does not exist.

Expected Result:

  • The MCP tool interface should be able to recognize local files just like Python code does.

Additional Info:

  • This issue always occurs on Windows. Not tested on Linux.
  • Detailed troubleshooting process and test code are attached below.

Appendix:

from pathlib import Path
print(Path("D:/mcp/mcp-document-reader/1.pdf").exists())  # True
print(Path("D:\\mcp\\mcp-document-reader\\1.pdf").exists())  # True
print(Path("1.pdf").exists())  # True
print(Path("./1.pdf").exists())  # True
print(Path(".\\1.pdf").exists())  # True

Thank you for your attention! Please let me know if you need more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions