modelcontextprotocol / modelcontextprotocol/csharp-sdk

Identity Assertion Grant uses raw authorization server URL as token-exchange audience

Open
#1,617 0 comments 0 reactions 1 assignee View on GitHub

@halter73 is already working on this.

Since Jun 25, 2026.

area-auth bug P2
Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Description

IdentityAssertionGrantProvider.GetAccessTokenAsync (added in #1305) passes authorizationServerUrl.ToString() directly as the audience (and resourceUrl.ToString() as the resource) for the RFC 8693 token exchange at the IdP.

The Python SDK (PR #1721) normalizes the audience to the discovered OAuth issuer (override_audience_with_issuer) rather than the caller-supplied URL. Without that normalization, a trailing slash or path difference between the configured authorizationServerUrl and the issuer advertised in the authorization server metadata can produce an audience that the IdP rejects as a mismatch.

Suggested direction

Consider normalizing the audience to the issuer discovered during authorization server metadata discovery (which GetAccessTokenAsync already fetches as mcpAuthMetadata) per RFC 8693, instead of using the raw configured URL.

Low priority — no reported failures yet, surfacing it so it isn't lost.

Related: #1305

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.