Repository navigation
feat(server): accept OAuth access tokens on the HTTP transport - #100
Merged
Merged
Conversation
Act as an OAuth 2.0 protected resource for MCP clients that cannot send a static header (claude.ai, Claude Desktop and ChatGPT connectors): - Requests to /mcp or /flashduty without a credential get 401 with a WWW-Authenticate challenge carrying resource_metadata. - Serve RFC 9728 protected resource metadata at /.well-known/oauth-protected-resource[/mcp|/flashduty]; the resource is derived from the request origin (X-Forwarded-Proto/Host aware) and the authorization server is the configured Flashduty API base URL. - Bearer credentials prefixed with oauth: are forwarded to the API as bearer access tokens via go-flashduty NewClientWithAccessToken; they ignore the ?base_url= override and use a separate client cache key. Any other bearer value is still treated as an APP key. - Adapt the status page change update to go-flashduty's pointer fields.
Pick up NewClientWithAccessToken, used for OAuth access tokens on the HTTP transport.
go-version: stable now resolves to a Go release newer than the one
golangci-lint v2.11 was built with, so the linter panics while loading
the standard library ("file requires newer Go version").
The build failed whenever the gha cache index pointed at a blob that no longer existed (BlobNotFound on import). The image is a single Go binary that builds in about a minute, so the cache is not worth that failure mode.
feat(server): accept OAuth access tokens on the HTTP transport
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.
Makes the HTTP transport an OAuth 2.0 protected resource (MCP authorization spec 2025-11-25). Hosts that can't send a static header, such as claude.ai, Claude Desktop and ChatGPT connectors, can then sign in through the browser.
401plusWWW-Authenticate: Bearer resource_metadata="<origin>/.well-known/oauth-protected-resource<path>"./.well-known/oauth-protected-resource/mcp(also/flashdutyand the root path).resourcecomes from the request origin and respectsX-Forwarded-Proto/X-Forwarded-Host.authorization_serversis the configured Flashduty API base URL.oauth:is forwarded to the API as an access token through go-flashdutyNewClientWithAccessToken.?base_url=override, because a token is only valid at the API that issued it.?app_key=, still work as an APP key. Stdio mode is unchanged.NewClientWithAccessToken(feat: add NewClientWithAccessToken for Bearer-token authentication go-flashduty#87). Before merging to main, re-pin it to the tagged release.Tests:
make checkpasses (fmt, lint 0 issues,go test -race, build). New tests ininternal/flashduty/server_test.gocover:base_urlbeing ignored for OAuth tokens.🤖 Generated with Claude Code