AnimaApp / AnimaApp/mcp-server-guide

MCP: Image media type mismatch in tool_result causes Claude API rejection

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
6
Forks
2
Avg merge
1h 9m
Merged PRs (30d)
2

Description

Description

When using the Anima MCP server (https://public-api.animaapp.com/v1/mcp), the codegen-figma_to_code tool returns snapshot images with an incorrect media type, causing the Claude API to reject the entire request.

Error Message

messages.164.content.0.tool_result.content.1.image.source.base64: The image was specified using the image/png media type, but the image appears to be a image/jpeg image

Root Cause

The MCP server appears to hardcode the media type as image/png for all snapshot images returned in tool_result. However, the actual image data (likely fetched from the Figma Image API) can be JPEG. The Claude API validates the base64 image content against the declared media type and rejects the request when they don't match.

Steps to Reproduce

  1. Configure the Anima MCP server in any MCP-compatible client (Claude Code, Cursor, OpenCode, etc.)
  2. Call the figma_to_code tool with a Figma design URL that contains nodes without transparency (Figma tends to return JPEG for these)
  3. The MCP server returns a tool_result containing the snapshot image with media_type: "image/png" while the actual image bytes are JPEG
  4. The AI provider API rejects the request due to the media type mismatch

Expected Behavior

The MCP server should detect the actual image format (by inspecting magic bytes or the Content-Type header from Figma) and set the correct media type (image/jpeg or image/png) accordingly. Alternatively, the server could convert all images to PNG before returning them.

Impact

This is a blocking issue — when it occurs, the entire Figma-to-code flow fails because the AI never receives the tool result. There is no client-side workaround since the MCP client transparently forwards the tool_result to the AI provider.

Environment

  • MCP endpoint: https://public-api.animaapp.com/v1/mcp
  • MCP transport: HTTP (Streamable)
  • Client: OpenCode (also reproducible with other MCP clients)
  • AI provider: Anthropic Claude API

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure against https://public-api.animaapp.com/v1/mcp with the codegen-figma_to_code tool and a Figma design containing nodes without transparency. Inspect the returned tool_result snapshot image and compare its declared media_type with the image bytes or Figma response. Done means JPEG and PNG snapshots are declared correctly so the Claude API accepts the complete request.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.