Skip to content

feat: register MCP OAuth2 clients when MCP server configs are updated - #31559

Merged
ethanndickson merged 1 commit into
mcp-dcr/registration-columnfrom
mcp-dcr/update-registration
Nov 3, 2026
Merged

ethanndickson merged 1 commit into
mcp-dcr/registration-columnfrom
mcp-dcr/update-registration

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Relates to CODAGT-779

We only ran Dynamic Client Registration when an MCP server config was created. If an admin later switched an existing server to OAuth2, or changed the URL of a server whose client Coder had registered, the server was left without a working client, and users couldn't connect to it.

To fix, create and update now go through the same planner, which registers a client whenever a save needs one. That's when a config becomes dynamic (on create, when the auth type changes to OAuth2, or when oauth2_client_registration changes from manual to dynamic), or when the URL of a dynamic config changes. The update request gets an optional oauth2_client_registration field. When it's omitted, we use dynamic if the resulting config has no client ID, auth URL or token URL, and keep the stored value otherwise.

Coder owns the client ID, secret, auth URL and token URL of a dynamic config, so we ignore them when a request leaves them empty or repeats them, and any other value fails with a 400 unless the request also sets manual. Updates that touch auth fields are also validated now, so a manual config without a client ID, auth URL or token URL is rejected. A new client replaces the client ID, so it deletes every user's stored token. If discovery or registration fails, nothing changes, and if the config changes whilst we're registering, the request fails with a 409 Conflict.

There are a few gaps I've left for now, and documented. A change to the deployment's access URL doesn't register a new client. Configs broken by the old behaviour stay manual until an admin switches them to dynamic. We also don't re-register when the provider rejects the client with invalid_client.

@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown

CODAGT-779

@ethanndickson
ethanndickson force-pushed the mcp-dcr/update-registration branch from 38d622f to 8aa1922 Compare October 30, 2026 03:08
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T01:32:23.948021Z c62f94f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8aa1922c22

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/mcp.go Resolved
@ethanndickson
ethanndickson force-pushed the mcp-dcr/update-registration branch from 8aa1922 to 8f76f57 Compare October 30, 2026 03:21
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f76f57002

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/mcp.go Resolved
@ethanndickson
ethanndickson force-pushed the mcp-dcr/update-registration branch from 8f76f57 to e3de740 Compare October 30, 2026 03:34
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: e3de74095d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson marked this pull request as ready for review November 2, 2026 05:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3de74095d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/mcp.go Resolved
@ethanndickson
ethanndickson force-pushed the mcp-dcr/update-registration branch from e3de740 to 5f3bccb Compare November 2, 2026 05:32
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 5f3bccb3b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson force-pushed the mcp-dcr/update-registration branch from 5f3bccb to 1f7381c Compare November 2, 2026 05:41
@ethanndickson
ethanndickson force-pushed the mcp-dcr/update-registration branch from 1f7381c to c62f94f Compare November 2, 2026 05:50
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: c62f94f794

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson merged commit ba06887 into main Nov 3, 2026
37 of 40 checks passed
@ethanndickson
ethanndickson deleted the mcp-dcr/update-registration branch November 3, 2026 01:39
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants