René's URL Explorer Experiment


Title: fix(oauth): make stdio token refresh waits cancellable by jonxsong · Pull Request #3893 · github/github-mcp-server · GitHub

Open Graph Title: fix(oauth): make stdio token refresh waits cancellable by jonxsong · Pull Request #3893 · github/github-mcp-server

X Title: fix(oauth): make stdio token refresh waits cancellable by jonxsong · Pull Request #3893 · github/github-mcp-server

Description: Summary Let canceled stdio MCP requests stop waiting for an OAuth token refresh. Concurrent requests can still receive the result of the same refresh and reuse the rotated credentials. Why When the session token expired, the stdio tool guard called HasToken, which synchronously called oauth2.TokenSource.Token. Authorization resume and the outbound bearer provider could enter the same path. The source uses an independent HTTP context for refresh. That is appropriate for the shared exchange, but it also meant a canceled caller could not return until the exchange released it. A gated token source reproduced the problem on df32d7ec5786. Both Authenticate and AwaitToken remained blocked after cancellation while the refresh was held. An already-canceled call entered the source and returned success instead of context.Canceled. Installing a newer authorization also left waiters blocked on the old source. What changed Share one in-flight refresh for the current OAuth token source. Each request waits with its own context. A valid cached token takes the synchronous path. Keep the refresh exchange on the existing bounded OAuth token source. GitHub may rotate the refresh token, so a canceled waiter can leave while the session saves the replacement credentials for other requests. Wake blocked waiters when a new authorization installs a token. The previous exchange cannot overwrite the new token or satisfy an obsolete authorization flow. Carry the caller's context through the stdio tool guard and the REST, GraphQL, and raw-content bearer lookups. MCP impact No tool or API changes. This adjusts cancellation handling in stdio OAuth and uses the existing tool registrations and OAuth prompt protocol. Prompts tested (tool changes only) The authorization tests use synthetic tokens and a gated refresh source. The outbound tests use the configured clients against a local HTTP fixture for REST, GraphQL, and raw content. Security / limits Auth / permissions considered. The OAuth request path delegates bearer attachment to the existing host-scoped transport. Tests verify caller cancellation, a healthy peer, body closure before dispatch, and suppression of the bearer header for an unlisted host. Tool renaming I am not renaming tools as part of this PR. Lint & tests Linted locally with ./script/lint on Linux with golangci-lint v2.14.0. Tested locally with ./script/test (go test -race ./...) on Linux. Windows, Go 1.27.4 — go test -v ./..., the snapshot suite with UPDATE_TOOLSNAPS=true, and a CLI build. The verbose suite passed 32 packages, 1,225 top-level tests, and 7,997 subtests. The new OAuth manager and stdio transport tests each passed 100 consecutive runs. The tagged end-to-end package compiled with execution disabled. Linux, Go 1.27.4 — 100 runs of the focused OAuth tests under the race detector, go mod tidy -diff, a CLI build, and regenerated documentation validation. Docs Updated the OAuth login guide to describe refresh ownership and request cancellation. Skills Confirmed no bundled skill applies to the stdio authentication lifecycle. Related work includes the stdio OAuth introduction, multi-round-trip OAuth migration, and GitHub's refresh token rotation documentation. AI assistance was used to investigate and reproduce the defect, author the fix and tests, review the diff, and draft this description.

Open Graph Description: Summary Let canceled stdio MCP requests stop waiting for an OAuth token refresh. Concurrent requests can still receive the result of the same refresh and reuse the rotated credentials. Why When the...

X Description: Summary Let canceled stdio MCP requests stop waiting for an OAuth token refresh. Concurrent requests can still receive the result of the same refresh and reuse the rotated credentials. Why When the...

Opengraph URL: https://github.com/github/github-mcp-server/pull/3893

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ad91fe73-4f03-50ed-bda7-d2cc11ea95b6
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD1C6:FBBFE:35AAD0:46381C:6B061802
html-safe-nonce8747ce197995051f2296636cf4ee0d486a62614d90604e50abaf33d0171e8ffe
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUM2OkZCQkZFOjM1QUFEMDo0NjM4MUM6NkIwNjE4MDIiLCJ2aXNpdG9yX2lkIjoiNDkwODk0NzUzMTQ4MjE0MjcyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb08df0d233c34b4e4f0746c73cbf58978a8f361dad8fe040d5f549bb9c0b10bb
hovercard-subject-tagpull_request:5386326257
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/github/github-mcp-server/pull/3893/files
twitter:imagehttps://avatars.githubusercontent.com/u/45381472?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/45381472?s=400&v=4
og:image:altSummary Let canceled stdio MCP requests stop waiting for an OAuth token refresh. Concurrent requests can still receive the result of the same refresh and reuse the rotated credentials. Why When the...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git
octolytics-dimension-user_id9919
octolytics-dimension-user_logingithub
octolytics-dimension-repository_id942771284
octolytics-dimension-repository_nwogithub/github-mcp-server
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id942771284
octolytics-dimension-repository_network_root_nwogithub/github-mcp-server
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release866f202ebf7ac5aff8f633417d9fd8a53818a977
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/github/github-mcp-server/pull/3893/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fpull%2F3893%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fpull%2F3893%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=github%2Fgithub-mcp-server
Reloadhttps://github.com/github/github-mcp-server/pull/3893/files
Reloadhttps://github.com/github/github-mcp-server/pull/3893/files
Reloadhttps://github.com/github/github-mcp-server/pull/3893/files
githubhttps://github.com/github
github-mcp-serverhttps://github.com/github/github-mcp-server
Codehttps://github.com/github/github-mcp-server
Issues238 (238)https://github.com/github/github-mcp-server/issues
Pull requests226 (226)https://github.com/github/github-mcp-server/pulls
Discussionshttps://github.com/github/github-mcp-server/discussions
Actionshttps://github.com/github/github-mcp-server/actions
Security and quality2 (2)https://github.com/github/github-mcp-server/security
Insightshttps://github.com/github/github-mcp-server/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgithub%2Fgithub-mcp-server%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgithub%2Fgithub-mcp-server%2Fissues%2Fnew%2Fchoose
jonxsonghttps://github.com/jonxsong
github:mainhttps://github.com/github/github-mcp-server/tree/main
jonxsong:codex/fix-oauth-refresh-cancellationhttps://github.com/jonxsong/github-mcp-server/tree/codex/fix-oauth-refresh-cancellation
Conversation 3 https://github.com/github/github-mcp-server/pull/3893
Commits 2 https://github.com/github/github-mcp-server/pull/3893/commits
Checks 1 https://github.com/github/github-mcp-server/pull/3893/checks
Findings https://github.com/github/github-mcp-server/pull/3893/findings
Files changed https://github.com/github/github-mcp-server/pull/3893/files
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3893/files
fix(oauth): make stdio token refresh waits cancellable https://github.com/github/github-mcp-server/pull/3893/files#top
Show all changes 2 commits https://github.com/github/github-mcp-server/pull/3893/files
01f6021 fix(oauth): make stdio token refresh waits cancellable jonxsong Nov 19, 2026 https://github.com/github/github-mcp-server/pull/3893/commits/01f60216d8aec8395c8c2922a25108aed733f5ab
1419bf0 test(oauth): cover canceled tool token checks jonxsong Nov 19, 2026 https://github.com/github/github-mcp-server/pull/3893/commits/1419bf09f5199b68b3c4c46cc23effd2cc742ce4
Clear filters https://github.com/github/github-mcp-server/pull/3893/files
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3893/files
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3893/files
oauth-login.md https://github.com/github/github-mcp-server/pull/3893/files#diff-86a1accb4efa0575238ee8aabfdcb96a437388a0635ad073d34cd9ec060b9b81
oauth.go https://github.com/github/github-mcp-server/pull/3893/files#diff-67aafb3a22a669b67966b3427acc74751f716e96eef774808d71d73076729b99
oauth_refresh_transport_test.go https://github.com/github/github-mcp-server/pull/3893/files#diff-c440c7e7e839e9d2c5d60028464dd8df58095833f070e6cbc4f80b91a42dee11
oauth_test.go https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
server.go https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
server_test.go https://github.com/github/github-mcp-server/pull/3893/files#diff-0beb09519b594af8617f1562fe04717d74dce57568b820ab509df3703b649313
manager.go https://github.com/github/github-mcp-server/pull/3893/files#diff-4345745ab586b79bb5f4d86dc28c191f5727e68c709e45de2396eb50120a31b8
refresh_cancellation_test.go https://github.com/github/github-mcp-server/pull/3893/files#diff-bbba2b4ca2ad83a9b6408406b90bd41f4c198f602b127c9a63fc4679e8477333
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
docs/oauth-login.mdhttps://github.com/github/github-mcp-server/pull/3893/files#diff-86a1accb4efa0575238ee8aabfdcb96a437388a0635ad073d34cd9ec060b9b81
View file https://github.com/github/github-mcp-server/blob/1419bf09f5199b68b3c4c46cc23effd2cc742ce4/docs/oauth-login.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3893/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3893/files#diff-86a1accb4efa0575238ee8aabfdcb96a437388a0635ad073d34cd9ec060b9b81
https://github.com/github/github-mcp-server/pull/3893/files#diff-86a1accb4efa0575238ee8aabfdcb96a437388a0635ad073d34cd9ec060b9b81
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
internal/ghmcp/oauth.gohttps://github.com/github/github-mcp-server/pull/3893/files#diff-67aafb3a22a669b67966b3427acc74751f716e96eef774808d71d73076729b99
View file https://github.com/github/github-mcp-server/blob/1419bf09f5199b68b3c4c46cc23effd2cc742ce4/internal/ghmcp/oauth.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3893/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3893/files#diff-67aafb3a22a669b67966b3427acc74751f716e96eef774808d71d73076729b99
https://github.com/github/github-mcp-server/pull/3893/files#diff-67aafb3a22a669b67966b3427acc74751f716e96eef774808d71d73076729b99
https://github.com/github/github-mcp-server/pull/3893/files#diff-67aafb3a22a669b67966b3427acc74751f716e96eef774808d71d73076729b99
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3893/files
https://github.com/github/github-mcp-server/pull/3893/files#diff-67aafb3a22a669b67966b3427acc74751f716e96eef774808d71d73076729b99
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
internal/ghmcp/oauth_refresh_transport_test.gohttps://github.com/github/github-mcp-server/pull/3893/files#diff-c440c7e7e839e9d2c5d60028464dd8df58095833f070e6cbc4f80b91a42dee11
View file https://github.com/github/github-mcp-server/blob/1419bf09f5199b68b3c4c46cc23effd2cc742ce4/internal/ghmcp/oauth_refresh_transport_test.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3893/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
internal/ghmcp/oauth_test.gohttps://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
View file https://github.com/github/github-mcp-server/blob/1419bf09f5199b68b3c4c46cc23effd2cc742ce4/internal/ghmcp/oauth_test.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3893/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/pull/3893/files#diff-5d0c54321be90d34e447751efb80dd1f9c0b567e6c9d76e330ed380e790d2a5c
https://github.com/github/github-mcp-server/blob/main/.github/CODEOWNERS#L1
internal/ghmcp/server.gohttps://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
View file https://github.com/github/github-mcp-server/blob/1419bf09f5199b68b3c4c46cc23effd2cc742ce4/internal/ghmcp/server.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/github-mcp-server/pull/3893/{{ revealButtonHref }}
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
https://github.com/github/github-mcp-server/pull/3893/files#diff-efffdb5f6c0e96b376f9f02d7a887ea629058c21a95e161981c5c08e41f12e0c
Please reload this pagehttps://github.com/github/github-mcp-server/pull/3893/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.