Skip to content

Direct Streamable HTTP MCP client with discovery and DCR #1265

Closed

Description

@jbeda

Problem

Mecatl can connect to protected Streamable HTTP MCP servers through the ToolHive broker, and the broker now supports DCR. It does not yet provide a direct MCP-client path that lets a desktop operator configure only an MCP endpoint and have mecatl discover the resource/OAuth metadata, dynamically register a client, complete the interactive authorization flow through a localhost callback, and persist the resulting client/credential lifecycle without ToolHive.

The trigger endpoint is https://connector-gateway.stacklok.dev/gw/mcp, which publishes RFC 9728 protected-resource metadata at https://connector-gateway.stacklok.dev/.well-known/oauth-protected-resource/gw/mcp and uses OAuth 2.1 DCR.

Desired outcome

For a supported remote Streamable HTTP MCP server, a desktop operator supplies the endpoint URL as the only initial per-server configuration. Mecatl discovers and validates all protocol metadata required for OAuth/DCR, drives the first interactive authorization flow through a localhost callback, and stores the client registration, tokens, and other lifecycle state in the local auth.yaml credential file so it can reconnect and refresh without manually pasted client IDs/tokens.

auth.yaml is the operator-machine-local secret/state store for this desktop flow; no remote provisioning API, Kubernetes secret writer, or headless/browserless enrollment is implied.

Implementation options

  1. Direct desktop MCP client (baseline). Mecatl owns protected-resource and authorization-server discovery, DCR, the localhost PKCE callback, and the durable auth.yaml lifecycle. This is the smallest conceptual match for endpoint-only desktop onboarding and has no ToolHive runtime dependency.

  2. Adapt the bundled ToolHive broker from feat(mcp): DCR client mode for the broker's MCP OAuth surface #1244 for a local single-user mode. The recent DCR support was primarily delivered for the mecak8s broker deployment, using ToolHive memory/Redis state and a public HTTPS callback. The broker runtime itself is shared by mecated and mecak8s, so a desktop adaptation is technically possible. It would retain ToolHive's multi-upstream OAuth/DCR coordinator, authorization sequencing, callback state handling, registration cache, refresh, and backend token injection.

    This is not a configuration-only change: current broker DCR requires explicit authorization and token endpoints alongside its DCR discovery URL, requires a canonical public HTTPS callback, and uses ToolHive-owned storage. A local mode would need a localhost callback topology, auth.yaml-backed durable state or a documented separate state store, a single-user authority model, and protected-resource discovery before it could offer endpoint-only onboarding. Evaluate this alternative against the direct-client design rather than assuming feat(mcp): DCR client mode for the broker's MCP OAuth surface #1244 can simply be enabled locally.

Scope to clarify

  • Select the direct-client baseline or local ToolHive-broker adaptation; either is a sibling of, not a replacement for, the deployed ToolHive-backed MCP broker.
  • The exact discovery chain and bindings: MCP endpoint, RFC 9728 protected-resource metadata, authorization-server metadata, DCR registration endpoint, localhost redirect URI, scopes, and token endpoint.
  • Safe auth.yaml schema, owner-only permissions, atomic/CAS update behavior, refresh rotation, revocation/logout, retry/reconnect, metadata drift, and migration behavior.
  • Configuration shape that keeps endpoint-only onboarding while retaining necessary operator security policy controls.

Existing related work

Activity

  1. self-assigned this
    on Sep 10, 2026
  2. jhrozek commented on Sep 10, 2026

    @jhrozek
    Contributor

    self-assigned, I ahve a branch that I'm going to PR today

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

Metadata

Metadata

Assignees

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