Description
It seems that only MCP resources with mimeType text/plain are supported.
E.g. take a basic MCP server with a singe resource:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
const server = new McpServer(...)
const name = "my-file.md"
const uri = "file:///docs/my-file.md"
const mimeType = "text/markdown"
server.registerResource(
name,
uri,
{ mimeType, description: "" }, // <-- this results in opencode error if mimeType !== "text/plain"
async () => {
return {
contents: [{ uri, text: "# Some Markdown Content", mimeType }], // <-- this mimeType seems to be ignored by opencode
}
}
)
After connecting to the server in opencode and selecting the resource with @file:///docs/my-file.md we get:
AI_DownloadError: Failed to download file:///docs/my-file.md: Error: ENOENT: no such file or directory, open '/docs/my-file.md'
And the same error with mimeType inode/directory. But it works if the server has mimeType text/plain.
Plugins
None
OpenCode version
1.1.23
Steps to reproduce
- Run a minimal MCP server which exposes a resource with mimeType
text/markdown, as above
- Connect the MCP server to opencode
- Try to @ the MCP resource in opencode
Screenshot and/or share link
No response
Operating System
macOS
Terminal
Ghostty
Description
It seems that only MCP resources with mimeType
text/plainare supported.E.g. take a basic MCP server with a singe resource:
After connecting to the server in opencode and selecting the resource with
@file:///docs/my-file.mdwe get:And the same error with mimeType
inode/directory. But it works if the server has mimeTypetext/plain.Plugins
None
OpenCode version
1.1.23
Steps to reproduce
text/markdown, as aboveScreenshot and/or share link
No response
Operating System
macOS
Terminal
Ghostty