fix: read binary files via native FS instead of Obsidian CLI
The Obsidian CLI does not support binary file output, causing corrupted
or empty results for images, PDFs, ZIPs, etc.
New approach for binary files (known MIME type from extension):
- Run 'obsidian vault info=path' to get the vault root filesystem path
- If 'file' param: run 'obsidian file file=<name>' and parse the 'path'
field from its output to get the vault-relative path
- If 'path' param: use it directly as the vault-relative path
- Read the file with Node fs.readFile() and return as MCP content
Images -> { type: 'image', data, mimeType }
Other binary -> { type: 'resource', resource: { uri, mimeType, blob } }
Unknown extensions fall through to the CLI with a runtime binary
detection fallback that also uses native FS if triggered.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1
banner.base64
Normal file
1
banner.base64
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user