GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remote MCP with custom headers returning 401 Unauthorized despite oauth: false · Issue #30428 · anomalyco/opencode

Remote MCP with custom headers returning 401 Unauthorized despite oauth: false #30428

New issue
Copy link
New issue
Copy link
Closed
Closed
Remote MCP with custom headers returning 401 Unauthorized despite oauth: false#30428
Copy link
Assignees
rekram1-node

Description

@andresparilli
andresparilli
opened on Jun 2, 2026
Issue body actions

OpenCode version: 1.15.13
OS: Linux
MCP Server: Custom JSON-RPC server on VPS (Streamable HTTP)

Configuration

"mcp": {
  "Bot": {
    "type": "remote",
    "url": "http://<vps-ip>:8899/jsonrpc",
    "headers": {
      "X-Bot-Token": "<token>"
    },
    "oauth": false
  }
}

Expected behavior

With oauth: false explicitly set, OpenCode should send the static headers on every request to the remote MCP server.

Actual behavior

  1. opencode mcp list shows "✓ Bot connected"
  2. opencode mcp debug Bot returns "401 Unauthorized"
  3. Tools from this MCP are not available to agents
  4. Direct curl to the same endpoint with same headers WORKS:
    curl -X POST http://<vps-ip>:8899/jsonrpc \
      -H "Content-Type: application/json" \
      -H "X-Bot-Token: <token>" \
      -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"run_bot","arguments":{"message":"test"}},"id":1}' \
    # Returns successful response from MCP server

Analysis

This appears similar to:

  • The mcp auth and mcp debug don't send configured headers during OAuth flow #20286 (headers not sent during OAuth flow/debug)
  • Remote MCP servers with Bearer headers fail on Linux (SSE 400, no Streamable HTTP fallback) #24946 (Bearer headers fail on Linux with SSE 400)
  • Remote MCP headers: {env:...} interpolation not working #23664 ({env:...} interpolation not working)

But the specific case of static custom headers with oauth: false returning 401 does not match exactly.

The server appears "connected" in mcp list but the actual tool calls fail with 401. This suggests OpenCode may be trying OAuth anyway despite oauth: false, or headers are being dropped during the tool call request phase.

Workaround

Using curl directly works:

curl -s -X POST http://<vps-ip>:8899/jsonrpc \
  -H "Content-Type: application/json" \
  -H "X-Bot-Token: <token>" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"run_bot","arguments":{"message":"\$1"}},"id":1}'

Activity

  1. github-actions
    assigned
    rekram1-node
    on Jun 2, 2026
  2. rekram1-node commented on Jun 11, 2026

    @rekram1-node
    rekram1-node
    on Jun 11, 2026
    Member
    More actions

    fixed: bf05e8a

  3. rekram1-node
    closed this as completedon Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.