Repository navigation
Conversation
## Motivation and Context
`base64` stopped being a default gem in Ruby 3.4, and the gemspec does not declare it. Under Bundler, an application
that does not get it through another gem could `require "mcp"`, but the first reference to `MCP::Client`,
or to a server-side OAuth class that uses the client's URL checks such as `MCP::Server::OAuth::ProtectedResourceMetadata`,
raised `LoadError: cannot load such file -- base64`. The suite did not see it because `activesupport` in the Gemfile brings `base64` in.
The three `Base64` calls (the PKCE code challenge, the segments of a JWT client assertion, and the `Authorization: Basic` credentials)
are spelled with `Array#pack("m0")`, as the rest of the library already encodes, so the gem keeps `json_schemer` as its only runtime dependency.
The output is byte for byte the same.
Reported in the side note of modelcontextprotocol#677.
## How Has This Been Tested?
`test/mcp/client/oauth/base64_dependency_test.rb` loads the client and the server-side OAuth classes in a fresh process
that refuses `require "base64"`; it fails on the previous library with the `LoadError`. The existing PKCE, client assertion
and flow tests compare the output with `Base64`.
## Breaking Changes
None.
atesgoral
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
base64stopped being a default gem in Ruby 3.4, and the gemspec does not declare it. Under Bundler, an application that does not get it through another gem couldrequire "mcp", but the first reference toMCP::Client, or to a server-side OAuth class that uses the client's URL checks such asMCP::Server::OAuth::ProtectedResourceMetadata, raisedLoadError: cannot load such file -- base64. The suite did not see it becauseactivesupportin the Gemfile bringsbase64in.The three
Base64calls (the PKCE code challenge, the segments of a JWT client assertion, and theAuthorization: Basiccredentials) are spelled withArray#pack("m0"), as the rest of the library already encodes, so the gem keepsjson_schemeras its only runtime dependency. The output is byte for byte the same.Reported in the side note of #677.
How Has This Been Tested?
test/mcp/client/oauth/base64_dependency_test.rbloads the client and the server-side OAuth classes in a fresh process that refusesrequire "base64"; it fails on the previous library with theLoadError. The existing PKCE, client assertion and flow tests compare the output withBase64.Breaking Changes
None.
Types of changes
Checklist