MCP resources mimeType errors #6500

Open
opened 2026-02-16 18:04:24 -05:00 by yindo · 0 comments
Owner

Originally created by @dan-kwiat on GitHub (Jan 16, 2026).

Originally assigned to: @rekram1-node on GitHub.

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

  1. Run a minimal MCP server which exposes a resource with mimeType text/markdown, as above
  2. Connect the MCP server to opencode
  3. Try to @ the MCP resource in opencode

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Ghostty

Originally created by @dan-kwiat on GitHub (Jan 16, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description It seems that only MCP resources with mimeType `text/plain` are supported. E.g. take a basic MCP server with a singe resource: ```ts 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 1. Run a minimal MCP server which exposes a resource with mimeType `text/markdown`, as above 2. Connect the MCP server to opencode 3. Try to @ the MCP resource in opencode ### Screenshot and/or share link _No response_ ### Operating System macOS ### Terminal Ghostty
yindo added the bug label 2026-02-16 18:04:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6500