Skip to content

[Bug]: ecm-mcp settings.json api_key field collision — Dispatcharr token gets overwritten by MCP key after image update, causing 401 on all channel/stream operations #273

@swarthyplacebo

Description

@swarthyplacebo

ECM Version

0.16.0 (latest image pull, 2026-05-14)

Priority

Priority 2: ECM is severely degraded

What is the bug?

After pulling the latest ECM image, every channel and stream operation returns 401. ECM itself starts fine and the web UI loads, but nothing that touches Dispatcharr works — GET /api/channels, GET /api/streams, M3U refresh tasks, everything.

The root cause is a field name collision in ecm-mcp:/config/settings.json. The file uses api_key for two completely different purposes depending on who's reading it:

  • ECM reads api_key as its Dispatcharr REST API token
  • The MCP sidecar's "Generate" flow writes the new ECM MCP key into api_key

So when you follow the post-update procedure — ECM Settings → MCP Integration → Revoke → Generate, copy the new key — you end up with the MCP key sitting in api_key. ECM then sends that to Dispatcharr and gets 401 on everything.

There are actually three distinct auth values all living in the same file:

Field in settings.json What it's actually used for
url Dispatcharr base URL
api_key Dispatcharr REST API token (read by ECM to talk to Dispatcharr)
mcp_api_key ECM MCP key (read by ecm-mcp to authenticate calls to ECM)

The README's MCP setup section and the redeployment procedure don't mention this distinction at all, so it's a very easy trap.

Steps to Reproduce

  1. Pull latest ECM image: docker compose pull && docker compose up -d
  2. Follow the README redeployment steps: ECM Settings → MCP Integration → Generate new API key
  3. Update ecm-mcp:/config/settings.json — set api_key to the newly generated MCP key (as the README implies you should)
  4. Restart ecm-mcp
  5. All channel/stream operations now return 401 — ECM is authenticating to Dispatcharr with the MCP key

Workaround

settings.json needs two separate values — the Dispatcharr token in api_key must not be touched when rotating the MCP key:

# Get the correct Dispatcharr API token
docker exec -u dispatch dispatcharr psql -d dispatcharr -t -c \
  "SELECT api_key FROM accounts_user WHERE username='admin';"

# Patch settings.json: restore Dispatcharr token, leave mcp_api_key alone
docker exec ecm-mcp cat /config/settings.json | python3 -c "
import sys, json
d = json.load(sys.stdin)
d['api_key'] = 'YOUR_DISPATCHARR_TOKEN_HERE'
print(json.dumps(d, indent=2))
" > /tmp/fixed_settings.json
docker cp /tmp/fixed_settings.json ecm-mcp:/config/settings.json
docker restart ecm-mcp

Suggested Fix

Either rename the fields so they can't be confused (e.g. dispatcharr_api_key vs mcp_api_key), or at minimum add a clear note to the README's redeployment section clarifying that generating a new MCP key should only update mcp_api_key and must never touch api_key.

Additional Context

ECM version: 0.16.0
Dispatcharr: separate Docker container on same host
OS: OMV7/Debian, Docker

(Written by Claude Sonnet 4.6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions