Skip to content

[backport] Wire OAuth 2.1 login into stdio server (upstream main) #11

Closed as not planned

Description

@gastrodon

Summary

Connects the internal/oauth core library to the stdio MCP server:

  • BearerAuthTransport gains a TokenProvider consulted per-request, so the lazily-acquired, auto-refreshing OAuth token replaces the pinned static token without rebuilding the HTTP client
  • RunStdioServer starts without a token and installs receiving middleware that runs the authorization flow on the first tool call, surfacing the auth URL or device code via elicitation (or a tool-result fallback)
  • Tool filtering uses the requested OAuth scopes; missing-scope tools are hidden
  • A sessionPrompter adapts the MCP server session to oauth.Prompter, keeping the auth URL off the model's context
  • New stdio flags: --oauth-client-id, --oauth-client-secret, --oauth-scopes, --oauth-callback-port
  • New internal/ghmcp/oauth.go integrates the session layer; internal/ghmcp/server.go updated

Upstream reference

Fork conflict

None. internal/ghmcp/server.go additions are additive alongside the fork's existing project-management setup.

Context

Without this wiring, the core OAuth library has no effect. This commit makes OAuth login the default path for stdio users on github.com by intercepting the first MCP tool call.

Depends on

See parent issue (OAuth story).

Activity

  1. gastrodon commented on Jun 27, 2026

    @gastrodon
    Author

    Unified Changelog — upstream main since v1.4.0

    All changes below are unreleased upstream commits on github/github-mcp-server main (post v1.4.0, 2026-06-18 → 2026-06-26). All are present in this fork's codebase; PATCHER.md has not yet been updated.


    Stories

    OAuth 2.1 stdio login (#13 → sub-issues #10 #11 #12)


    Standalone Features

    Issue dependency read/write tools (#14)

    get_parent for issue_read (#15)

    Promote issue fields, remove legacy issue_write (#16)


    Bug Fixes

    Remove show_ui, centralize show/defer (#17) — commits: 0503f2f (PR github#2774) — fork conflict: mild (v1.4.0 added show_ui; this removes it; no functional impact on fork's tools)

    Fix delete:true on issue fields (#18) — commits: 29634da (PR github#2755) — fork conflict: none

    Bound ui_get pagination (#19) — commits: 63d313a (PR github#2766) — fork conflict: none

    Fix issue_write form gating (#20) — commits: 3c4749d (PR github#2767) — fork conflict: none

    Validate required params in add_comment_to_pending_review (#21) — commits: 5aa8ed3 (PR github#2770) — fork conflict: none

  2. gastrodon commented on Jun 27, 2026

    @gastrodon
    Author

    No-op. The fork already has internal/ghmcp/oauth.go (OAuth session prompter + RunStdioServer middleware), pkg/http/transport/bearer.go with TokenProvider support, and cmd/github-mcp-server/main.go with --oauth-client-id/-secret/-scopes/-callback-port flags (37 oauth references confirmed). All wiring is present.

  3. added
    no-opFork already has equivalent functionality
    on Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backportBackport from upstreamfeatureNew featureno-opFork already has equivalent functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions