continuedev/continue · warning · Error

Continue currently only supports text resources from MCP

Error message

Continue currently only supports text resources from MCP

What it means

While converting MCP resource contents to ContextItems, a returned resource lacks a string `text` field. The MCP resource protocol allows binary/blob resources, but this provider only supports text resources, so it throws on the first non-text content.

Source

Thrown at core/context/providers/MCPContextProvider.ts:83

  async getContextItems(
    query: string,
    extras: ContextProviderExtras,
  ): Promise<ContextItem[]> {
    const { mcpId, uri } = MCPContextProvider.decodeMCPResourceId(query);

    const connection = MCPManagerSingleton.getInstance().getConnection(mcpId);
    if (!connection) {
      throw new Error(`No MCP connection found for ${mcpId}`);
    }

    const resourceuri = this.insertInputToUriTemplate(uri, extras.fullInput);
    const { contents } = await connection.getResource(resourceuri);

    return await Promise.all(
      contents.map(async (resource) => {
        if (!("text" in resource) || typeof resource.text !== "string") {
          throw new Error(
            "Continue currently only supports text resources from MCP",
          );
        }
        return {
          name: resource.uri,
          description: resource.uri,
          content: resource.text,
          uri: {
            type: "url",
            value: resource.uri,
          },
        };
      }),
    );
  }

  async loadSubmenuItems(
    args: LoadSubmenuItemsArgs,

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Point the resource URI at a text file rather than a binary one
  2. Update the MCP server to return text contents for that resource
  3. Catch this error in the caller and skip non-text resources gracefully

Example fix

// before
if (!("text" in resource) || typeof resource.text !== "string") {
  throw new Error("Continue currently only supports text resources from MCP");
}
// after
if (!("text" in resource) || typeof resource.text !== "string") {
  console.warn(`Skipping non-text MCP resource: ${resource.uri}`);
  return null;
}
Defensive patterns

Strategy: type-guard

Type guard

function isTextResource(r: unknown): r is { uri: string; text: string } {
  return typeof r === 'object' && r !== null && 'text' in r && typeof (r as any).text === 'string';
}

Try / catch

const items = (await Promise.all(contents.map(async r => isTextResource(r) ? toContextItem(r) : null))).filter(Boolean);

Prevention

When it happens

Trigger: connection.getResource(uri) returns a resource whose content is a Blob or has no text field (e.g. an image or binary file exposed via an MCP server), and the provider tries to map it.

Common situations: An MCP server exposes files generically and the URI points at a PDF/image; server returns contents in an older/newer MCP SDK shape without a text property.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/08258b28d521a7e5. Report an issue: GitHub.