Coder's MCP OAuth2 client never sent the RFC 8707 `resource` parameter, which the MCP authorization spec requires on authorization and token requests. Authorization servers that enforce it cannot be connected: with Dagster+, discovery and dynamic client registration succeed, then the authorize request fails with "MCP OAuth requests must include resource". MCP server configs get an `oauth2_resource` field (migration 000618, admin-only in API responses, audited). Coder sends it on the authorize redirect, the authorization-code exchange, and token refresh. Refresh now goes through `clientcredentials` with `grant_type=refresh_token`, because `oauth2.Config` cannot add parameters to refresh requests; it keeps the same auth-style detection and error types, and adds no dependency. Auto-discovery fills the field with the most specific Protected Resource Metadata `resource` that covers the server URL, stored as advertised. As in the MCP SDKs, a resource covers URLs on its origin at or under its path, so `/mcp` covers `/mcp/` but `/mcp/` does not cover `/mcp`. URLs compare in RFC 3986 normal form (default ports, percent-encodings, dot segments, and an empty path as `/`), ports ignore leading zeros, IPv6 literals compare by address, and `%2F` stays inside its segment. Unlike the SDKs, a resource with a query, even an empty one, only covers a server URL with the same query. When none covers it, Coder uses the server URL with the scheme and host lowercased and user information and fragment removed, or sends no resource when that is not a valid resource indicator. An explicit value in the create request wins. Manual configurations send no `resource` unless an admin sets one, because some providers reject it (Microsoft Entra ID v2 fails with AADSTS901002). Values must be absolute RFC 3986 URIs without a fragment, user information, or an IPv6 zone identifier. The resource binds grants like the other OAuth settings: changing it deletes stored user tokens, and a callback whose config resource changed after the user started connecting returns 409 before the code is redeemed. The connect step records the resource in a callback-scoped cookie for that check. Discovery only runs when a configuration is created, so existing auto-discovered configurations, including the Dagster+ one that prompted this, keep an empty resource until an admin sets the new "Resource URL" field or re-creates the server.  ## Testing - Go: discovery (most specific match, path and trailing-slash boundaries, query matching including empty queries, equivalent ports, IPv6 literals, escapes, and dot segments including escaped ones, the normalized fallback and an invalid one, explicit override), validation (URI characters, brackets, IP literals, user information, trimming), grant deletion on change, clearing on an auth type change, redaction for members, refresh with and without a resource, the 409 when the resource changes mid-flow (the authorization server never receives the code), and a connect and callback flow against an authorization server that rejects requests without the resource. Each new test was checked to fail when the behavior it covers is broken, except two malformed IP literal hosts that Go's URL parser already rejects. - Vitest: the form round-trips the stored value, and clearing the field sends `""` on update. - Remote UAT through Coder Agents ([chat](https://dogfood.cdr.dev/agents/58695d5b-2112-400b-88f7-ab64c678f756)) on a test deployment with loopback MCP and authorization server mocks: - Round 1 on2b875068e0: literal verdict FAIL. When the resource changed between connect and callback, the callback redeemed the code for the new resource and stored a grant. The 409 binding fixes it. - Round 2 on4b54ffb5f9: PASS. The mid-flow change returned 409 with no token request in every variant (strict and lenient servers, set, cleared, abandoned flows, parallel configs); auto-discovery, connect, refresh, validation, and the docs matched. Minor observations: the binding cookie is an unkeyed digest, so a member who edits their own HttpOnly cookie can redeem a code with the current resource, which a fresh connect also gives them; other settings changed mid-flow still reach the token endpoint, as on main; the 409 popup shows raw JSON; the UI does not warn that a resource change disconnects users; validation toasts omit the server's detail. - Round 3 on the final head2d6abfac49: PASS. The head moved during the round, so it ran in four parts, the last on2d6abfac49. That part covered the matching rules (queries including empty ones, default and zero-padded ports, `%2F`, escaped dot segments, trailing slashes, IPv6 literals), the invalid fallback (stored empty, no `resource` sent), every validation value through the API and the UI, and the discovery, connect, refresh, and mid-flow 409 flows. The equivalent-encoding cases last ran live on 5c23fe00dca; unit tests cover them on the final head. Observation: the path-aware metadata URL is built from the decoded path, so `/mcp%2Ftenant` fetches metadata for `/mcp/tenant`, as on main. - `frontend-review` and the eight-role `coder-frontend-review` ran on the `site/` diff; every role passes after the label, help text, row layout, API doc wording, and form test fixes. Declined: linking field descriptions with `aria-describedby`, because the form's shared `Field` primitive renders every description without one, so it belongs in a change to all fields. ## Review record | Review | Commit | Findings | Disposition | |---|---|---|---| | [Codex round 1](https://github.com/coder/coder/pull/30651#pullrequestreview-5492085359) |4b54ffb5f9| P2: a resource with another query was treated as covering the server URL | Reproduced with a failing test, fixed inbf0879560c, resolved | | [Codex round 2](https://github.com/coder/coder/pull/30651#pullrequestreview-5492305363) |bf0879560c| P2: explicit default ports; P2: `%2F` treated as a segment boundary; P2: `url.Parse` accepts spaces and invalid escapes | Each reproduced with a failing test, fixed in16a1d783fa, resolved | | [Codex round 3](https://github.com/coder/coder/pull/30651#pullrequestreview-5492677517) |16a1d783fa| P1: docs wrapped mid-sentence (DOC1); P2: equivalent percent-encodings compared unequal; P2: brackets accepted outside an IP literal host | Fixed in8d617f0528(the P2s reproduced with failing tests; the same pass also covers the query, dot segment, and user information cases), resolved | | [Codex round 4](https://github.com/coder/coder/pull/30651#pullrequestreview-5493033885) |8d617f0528| P2: the server URL fallback was not validated; P2: escaped dot segments were compared before decoding | Each reproduced with a failing test, fixed in5c23fe00dc, resolved | | [Codex round 5](https://github.com/coder/coder/pull/30651#pullrequestreview-5493342889) |5c23fe00dc| P2: an empty query (`?`) was treated as no query | Reproduced with a failing test, fixed in72c019ff5e, resolved | | [Codex round 6](https://github.com/coder/coder/pull/30651#pullrequestreview-5493524846) |72c019ff5e| P2: `/mcp/` covered `/mcp`; P2: equivalent IPv6 literals compared unequal; P2: malformed IP literals accepted | The first two reproduced with failing tests. Go 1.26.5 `url.Parse` already rejects the hosts named in the third, but it accepted an IPv6 zone identifier. All fixed inef2df2c4e7, resolved | | [Codex round 7](https://github.com/coder/coder/pull/30651#pullrequestreview-5493668131) |ef2df2c4e7| P2: leading zeros in a port made equal origins differ | Reproduced with a failing test, fixed in2d6abfac49, resolved | | [Codex round 8](https://github.com/coder/coder/pull/30651#issuecomment-6128743972) |2d6abfac49| None: "Didn't find any major issues" | Clean verdict on the current head | > Xum opened this PR on behalf of @ibetitsmike.
Coder is a self-hosted platform for cloud development environments and AI coding agents. Workspaces are defined with Terraform, connected through a secure Wireguard® tunnel, and automatically shut down when not used. Coder Agents runs a native AI coding agent whose loop executes in the control plane on your infrastructure, with no API keys in workspaces.
- Define cloud development environments in Terraform
- EC2 VMs, Kubernetes Pods, Docker Containers, etc.
- Automatically shutdown idle resources to save on costs
- Onboard developers in seconds instead of days
- Delegate coding work to AI agents on your infrastructure
- Bring any model (Anthropic, OpenAI, Google, Bedrock, self-hosted)
- No LLM credentials in workspaces, user identity on every action
- Centralized model governance, cost tracking, and audit logging
Quickstart
Check out our install guides for other methods and a complete tutorial.
Try Coder with the install script on Linux and macOS, or grab the latest binary or installer from GitHub Releases on Windows:
curl -fsSL https://coder.com/install.sh | sh
Start the server and open http://localhost:3000 to create your initial user, create a Docker template, and provision your first workspace:
coder server
For a production deployment, add a PostgreSQL database (version 13 or later) and an external access URL, and see our validated architectures for sizing and infrastructure guidance:
coder server --postgres-url <url> --access-url <url>
Without these flags, Coder uses a built-in database and sets up a *.try.coder.app access URL for evaluation. Use coder --help for the full list of flags and environment variables.
Documentation
Browse the documentation or visit a specific section below:
- Workspaces: Workspaces contain the IDEs, dependencies, and configuration information needed for software development
- Templates: Templates are written in Terraform and describe the infrastructure for workspaces
- Coder Agents: Delegate coding work to AI agents running on your self-hosted infrastructure
- AI Gateway: Centralize authentication, auditing, and cost controls for AI tooling
- Administration: Learn how to operate Coder
- Premium: Learn about paid features built for large teams
- IDEs: Connect your existing editor to a workspace
Support
Open an issue for bugs and feature requests.
For community support, showcasing what you built, and feedback on in-progress features, join our Discord or GitHub Discussions.
Dedicated support is included in Coder Premium. For more information, visit coder.com/pricing.
Integrations
New integrations are always in progress. Open an issue to request one. Contributions are welcome in any official or community repository.
Official
- Coder Registry: Templates, modules, and integrations for common development environments
- Coding Agents: Run agents like Claude Code, Codex, and OpenCode isolated in Coder workspaces
- coderd Terraform Provider: Declaratively manage your Coder deployment configuration as code
- VS Code Extension: Open any Coder workspace in VS Code with a single click
- JetBrains Toolbox Plugin: Open any Coder workspace from JetBrains Toolbox with a single click
- Dev Containers: Build development environments using
devcontainer.jsonon Docker, Kubernetes, and OpenShift - Kubernetes Log Stream: Stream Kubernetes Pod events to the Coder startup logs
- Self-Hosted VS Code Extension Marketplace: A private extension marketplace that works in restricted or airgapped networks integrating with code-server.
- GitHub Actions: An action to set up the Coder CLI in GitHub workflows
Community
- Coder Discord: Chat with the community, get support, and hear about new product updates first
- Community Templates: Community-contributed workspace templates in the Coder Registry
- Community Modules: Community-contributed modules to extend Coder templates
- Coder Template GitHub Action: A GitHub Action that updates Coder templates
- Coder Agents Chat Action: A GitHub Action that starts a Coder Agents chat against a GitHub issue or pull request
Contributing
New contributors are always welcome. If you are new to the Coder codebase, see the contribution guide to get started.
Hiring
Apply on the careers page if you are interested in joining the team.
