node-server #10
Reference in New Issue
Block a user
Delete Branch "node-server"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The previous implementation prefixed base64 with "BASE64:" in a text response. This updates the response to use the proper MCP embedded resource format: { type: "resource", resource: { uri, mimeType, blob } } Changes: - types.ts: extend ToolOutput content union to allow resource items - file-operations.ts: - getMimeType() maps common extensions to MIME types, falling back to application/octet-stream - MIME_TYPES table covers PDF, ZIP, images, Office formats, audio/video - Binary files are now returned as an EmbeddedResource with: uri: obsidian://<vault>/<path> mimeType: detected from file extension blob: base64-encoded raw bytes from the Buffer - Tool descriptions updated to document the resource response shape Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Images (PNG, JPG, GIF, WEBP, SVG) now returned as { type: 'image', data, mimeType } per https://modelcontextprotocol.io/specification/2025-11-25/server/tools#image-content Other binary files continue using embedded resource format { type: 'resource', ... } Added audio content type to ToolOutput union for future use Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>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>