[Client] Add OAuth 2.0 credential storage interface (TokenStorageInterface)
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
- Domain
- api, authentication
Research direction
Start with Client\Builder and the auth/* baseline scenarios, then inspect the src/Client/Auth/ area. Track the interface, TokenSet, both adapters, builder wiring, and unit tests against the listed operations and acceptance criteria; done when optional builder configuration and its documentation are covered.
Written by the indexing model from the issue text.
Description
Context
Foundation for every OAuth flow on the client side. Without a storage abstraction we cannot persist access tokens, refresh tokens, registered client credentials, or PKCE verifiers across requests/sessions.
Scope
- Define
Mcp\Client\Auth\TokenStorageInterfacewith operations:getToken(string $resourceUrl): ?TokenSet,storeToken(string $resourceUrl, TokenSet $token): void,clearToken(string $resourceUrl): void, plus equivalents for registered client metadata. - Value object
TokenSet(access_token, refresh_token, expires_at, scope, token_type). - Default implementations:
InMemoryTokenStorage(ephemeral, per-process).Psr16TokenStorageadapter for PSR-16CacheInterface.
- Wire into
Client\Builder::setTokenStorage(...)(optional; defaults to in-memory).
Conformance scenarios unblocked
Prerequisite for all auth/* baseline scenarios.
Dependencies
None — must land first.
Acceptance
- Interface + value object + 2 storage adapters in
src/Client/Auth/. - Unit tests for both adapters.
- Builder method documented.
cc @soyuka
- Dominant language
- PHP
- Stars
- 1.6k
- Forks
- 173
- Avg merge
- 2d 49m
- Merged PRs (30d)
- 23
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStan OpenServer
Difficulty 1/5 Under an hour Newbie friendliness 78/100
modelcontextprotocol/php-sdk#468 · 2 comments ·
-
needs confirmation needs maintainer action Server
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/php-sdk#398 · 1 reaction ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/php-sdk#370 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
modelcontextprotocol/php-sdk#510 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
modelcontextprotocol/php-sdk#504 ·
All issues in modelcontextprotocol/php-sdk
Similar issues
-
jira-created
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
nunomaduro/phpinsights#745 ·
-
status/awaiting_triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
WordPress/plugin-check#1486 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
az-digital/az_quickstart#6019 ·