modelcontextprotocol / modelcontextprotocol/typescript-sdk

Support Secure Hashed Client Secrets in OAuthRegisteredClientsStore

Open
#1,124 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auth enhancement help wanted needs decision P3 v2
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.
Currently, the OAuthRegisteredClientsStore interface does not support storing hashed client secrets or verifying them using standard password hashing algorithms. As a result, implementations often store client secrets in plaintext and compare them directly. This is not aligned with security best practices and creates a considerable risk if the storage backend is compromised.

Describe the solution you'd like
Add a method such as verifyClientSecret(clientId: string, clientSecret: string): Promise<OAuthClientInformationFull | undefined> to the store interface. This would allow secrets to be stored hashed and checked securely. The client authentication middleware should be refactored to use this method, supporting both new secure storage and legacy plaintext secrets where needed. Documentation or migration guidance should be provided for transitioning existing implementations.

Describe alternatives you've considered

  • Continuing to use getClient and maintain direct string comparisons, but this does not mitigate the mentioned security risks.
  • Wrapping or extending the current interface externally for hashing support, but this leads to fragmentation and inconsistencies among implementations.

Additional context

  • Algorithms like bcrypt or Argon2 are widely used for secure password and secret hashing.
  • Related files: src/server/auth/middleware/clientAuth.ts, src/server/auth/clients.ts
  • A clear migration or compatibility path for legacy secrets is important to avoid breaking existing deployments.

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.

Research direction

Start by reading src/server/auth/clients.ts and src/server/auth/middleware/clientAuth.ts to understand the current client lookup and authentication flow. Confirm how the OAuthRegisteredClientsStore interface is used, then define the secure verification and legacy compatibility requirements. Done means the interface, middleware behavior, and migration or compatibility guidance cover both hashed and existing plaintext secrets.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication, backend-api-design, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.