Skip to main content
Glama
PATH_HANDLING_FIX.md1.76 kB
# Path Handling Fix for Claude Desktop ## Problem When Claude Desktop runs the MCP server, relative paths like `hallucinations_report.docx` were being resolved relative to the current working directory (which could be `/` or other read-only locations), causing the error: ``` Error: [Errno 30] Read-only file system: '/hallucinations_report.docx' ``` ## Solution Updated `src/docx_mcp/utils/path_utils.py` to intelligently handle relative paths: 1. **Relative paths** (e.g., `hallucinations_report.docx`) → automatically resolved relative to user's home directory - Example: `hallucinations_report.docx` → `/Users/rajesh/hallucinations_report.docx` - Example: `Documents/report.docx` → `/Users/rajesh/Documents/report.docx` 2. **Absolute paths** (e.g., `/Users/rajesh/...`) → validated against configured allowed directories (security) 3. **Working when MCP server is in read-only locations** → relative paths now work regardless of server CWD ## Usage Examples in Claude Desktop ### Simple filename (creates in home directory) ``` create_docx with filepath "myreport.docx" ``` → Creates `/Users/rajesh/myreport.docx` ### Nested relative path (creates in Documents subdirectory) ``` create_docx with filepath "Documents/reports/hallucinations_report.docx" ``` → Creates `/Users/rajesh/Documents/reports/hallucinations_report.docx` ### Absolute path (must be in allowed directories) ``` create_docx with filepath "/Users/rajesh/Github/docx_creation_mcp/report.docx" ``` → Creates at specified absolute path (if in allowed directory) ## Testing All path normalization tests pass: - ✓ Relative paths resolve to home directory - ✓ Nested relative paths work correctly - ✓ Absolute paths are validated against security rules

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Andrew82106/LLM_Docx_Agent_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server