Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Client] Implement refresh_token grant + offline_access scope

Open
#323 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
php

Research direction

Start with Mcp\Client\Auth\Grant\RefreshTokenGrant and review dependencies #319 and #322 for the access/refresh token and scope-handling flow. Run the auth/offline-access-scope and auth/offline-access-not-supported conformance scenarios, then add the requested unit coverage for proactive and reactive refresh, degradation, and clean re-auth behavior.

Written by the indexing model from the issue text.

Description

auth Client enhancement improves spec compliance

Context

When an access token expires, the client must transparently refresh using the stored refresh_token rather than re-prompting the user. Per OIDC/OAuth, offline_access scope is requested at authorize time when the AS advertises it; otherwise the client degrades gracefully (no refresh available).

Scope

  • Mcp\Client\Auth\Grant\RefreshTokenGrant.
  • Pre-flight check: if expires_at - now() < skew, refresh before sending request.
  • Reactive: on 401 with valid refresh token, refresh + retry once.
  • Request offline_access scope at authorize time when scopes_supported contains it; otherwise omit.
  • If the AS does not advertise offline_access and tokens expire, surface a re-auth signal cleanly (no infinite loop).

Conformance scenarios unblocked

auth/offline-access-scope, auth/offline-access-not-supported.

Dependencies

Blocked by: #319 (need access+refresh tokens from auth code flow), #322 (scope handling).

Acceptance

  • Unit tests for proactive + reactive refresh, no-refresh-token degradation, no-offline_access degradation.
  • Conformance: 2 baseline scenarios pass.

cc @soyuka

Dominant language
PHP
Stars
1.6k
Forks
173
Avg merge
2d 49m
Merged PRs (30d)
23

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/php-sdk

All issues in modelcontextprotocol/php-sdk

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.