Skip to content

mcp: Figma Desktop fails with Error POSTing — ?codemode= causes 404 #45499

Closed

Description

@lukasrakauskas

Summary

Remote MCP connections to Figma Desktop Dev Mode MCP (http://127.0.0.1:3845/mcp) fail with Streamable HTTP error: Error POSTing to endpoint: because OpenCode appends ?codemode=false (or true) to the MCP URL. Figma’s desktop server returns 404 with an empty body for any non-empty query string. The same endpoint works when called without a query string (curl / official MCP SDK).

Environment

  • opencode version: 0.0.0-beta-18371
  • OS: Darwin 25.6.0 (darwin arm64)
  • Terminal: TERM_PROGRAM=ghostty, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: beta (@opencode-ai/cli)
  • Active plugins: nexos-models.ts, herdr-agent-state.js, (workaround) figma-mcp-desktop.ts

Reproduction

  1. Open Figma desktop app → Dev Mode → enable desktop MCP server (listens on http://127.0.0.1:3845/mcp).
  2. Configure a remote MCP server in opencode.json(c):
{
  "mcp": {
    "servers": {
      "figma": {
        "type": "remote",
        "url": "http://127.0.0.1:3845/mcp",
        "oauth": false
      }
    }
  }
}
  1. Run opencode2 mcp list (or start a session so MCP connects).

Expected Behavior

OpenCode connects to the Figma Desktop MCP over Streamable HTTP and catalogs tools (e.g. get_design_context, get_screenshot, …). codemode should only affect how OpenCode exposes MCP tools to the model, not the upstream HTTP URL path/query.

Actual Behavior

✗ figma  failed: Streamable HTTP error: Error POSTing to endpoint: 

Server log:

mcp connect failed server=figma status.error="Streamable HTTP error: Error POSTing to endpoint: "

A local reverse-proxy capture of OpenCode’s request shows:

POST /mcp?codemode=false HTTP/1.1
Host: 127.0.0.1:3845
Accept: application/json, text/event-stream
Content-Type: application/json
User-Agent: opencode2/0.0.0-beta-18371

{"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{...},"clientInfo":{"name":"cli","version":"0.0.0-beta-18371"}},"jsonrpc":"2.0","id":0}

Figma responds with 404, empty body (hence the empty suffix after Error POSTing to endpoint: ).

Additional Context

Control experiments (same machine, Figma listening on :3845)

Request Result
POST http://127.0.0.1:3845/mcp (no query) 200, SSE initialize result, mcp-session-id set
POST http://127.0.0.1:3845/mcp?codemode=false 404 empty body
POST http://127.0.0.1:3845/mcp?codemode=true 404 empty body
Official @modelcontextprotocol/sdk StreamableHTTPClientTransport against clean /mcp OK, 10 tools

Config notes

  • V1-shaped mcp.figma is normalized correctly to mcp.servers.figma (not a config-shape bug).
  • Setting "oauth": false alone does not fix this; the failure is the query string, not OAuth discovery.
  • When Figma desktop is closed, errors are Unable to connect… instead — distinct from this 404.

Suggested fix

Do not append codemode (or any OpenCode-only flag) to the remote MCP HTTP URL. Keep codemode as internal connection metadata when grouping/exposing tools. Alternatively, strip unknown query params only for known-local desktop endpoints — but not putting them on the wire is cleaner.

Workaround

Strip the query string via a tiny local proxy (127.0.0.1:3846 → 127.0.0.1:3845/mcp without ?…), or use Figma’s hosted remote MCP (https://mcp.figma.com/mcp) with OAuth (different feature set).

Activity

  1. rekram1-node commented on Aug 27, 2026

    @rekram1-node
    Collaborator

    fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions