Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

SVLaursen
Copy link

Adds the Accept header of 'application/json' to the auth metadata request for the MCP client.
Reason for this being that in some cases, particularly in the SAP ecosystem, auth services have a default of going to a login page/IDP selection screen if the Accept is '/'.

Motivation and Context

Recently I've been working on getting MCP into the ERP world, particularly the SAP sphere. All apps used in this area are typically deployed to the Business Technology Platform (BTP) where auth systems like XSUAA are used.

Unfortunately with the current implementation of the auth metadata fetcher for the client side, the default logic of the XSUAA service comes into play, as it defaults to a login page when a query against the metadata endpoint is made, unless the requester explicitly asks for the JSON content.

Therefore by asking specifically for the metadata as JSON this problem can be avoided, and seeing as the subsequent logic in the client library also depends on the data received being of JSON format, it would make sense.

How Has This Been Tested?

I tested this using our internal implementation and the client returned the metadata as expected.

Breaking Changes

Not to my knowledge.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@SVLaursen SVLaursen requested a review from a team as a code owner August 25, 2025 14:13
@SVLaursen SVLaursen requested a review from pcarleton August 25, 2025 14:13
@SVLaursen
Copy link
Author

Rebasing to the latest changes. I hope you will consider this small fix as it will do wonders for integration in the SAP ecosystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant