Repository navigation
Let an owner reuse their revoked MCP connection's ID - #54
Merged
Merged
Conversation
A revoked connection's ID was permanently taken, so a cutover had to move agents to a new URL. Its owner can now create a connection with that ID. Revival replaces the record with a new generation, the record's createdAt. It revokes every grant that names the ID again and re-enables the connection's OAuth resources. Connection keys minted before the new generation, and PAT grant IDs carrying an older one, are refused and swept. A grant stored while its connection was revoked or replaced is revoked at creation. Creating a live connection again is idempotent only for an identical name and access; another body, or another user's ID, stays ConnectionIdTaken.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Post-cutover backlog, item (c): let an owner reuse their revoked connection's ID. During the Mesh cutover, a revoked
firstmate-meshcouldn't be recreated (409ConnectionIdTaken), which forcedfirstmate-mesh-2. The ID is part of the MCP URL agents configure.Cause
createMcpConnection(packages/mcp-auth/src/implementation/oauth.ts) answered 409 whenever a record with that ID existed, revoked or not. Grants, connection keys and PAT grant IDs refer to a connection only by its ID string, so simply un-revoking the record could have brought old credentials back.Design (no schema change)
The record's
createdAtnow acts as the connection's generation.revoked: false, and a newcreatedAtlater than the revocation.bearer-access.ts): a key bound to the connection is refused if it was created before the connection'screatedAt. Creating a connection deletes keys older than it, and revoking still deletes them all.Rebased on #53 (per-key revoke). The one conflict was in the revoke-all-keys endpoint; it keeps this PR's generation-aware filter.
Tests
connection-keys.spec.ts:createdAt;/mcp, while a new key works;mcp-connections.spec.ts: after recreating, the old OAuth token's call fails and its refresh is refused, while a new authorization at the same URL works.bun run checkpasses.