-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix: route MCP calls to the .mtls.googleapis.com endpoint for Agent Identity #6459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ShresthSamyak
wants to merge
3
commits into
google:main
Choose a base branch
from
ShresthSamyak:fix/mcp-agent-identity-mtls-endpoint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+92
−4
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
b1ba989
fix: route MCP calls to the .mtls.googleapis.com endpoint for Agent I…
ShresthSamyak 582d8a9
fix: gate MCP mTLS endpoint on cert availability and full policy matrix
ShresthSamyak 4b11548
chore: apply pyink formatting to agent registry mTLS tests
ShresthSamyak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Endpoint selection needs the resolved certificate/transport state, not only the cert-use policy.
_use_client_cert_effective()says whether certificate use is enabled; it does not prove that a certificate is available. I reproduced this withGOOGLE_API_USE_CLIENT_CERTIFICATE=true,GOOGLE_API_USE_MTLS_ENDPOINT=auto, andmtls.has_default_client_cert_source() == false:AgentRegistry._base_urlcorrectly remainshttps://agentregistry.googleapis.com/v1, but the MCP connection becomeshttps://us-central1-aiplatform.mtls.googleapis.com/mcp.MCPSessionManagerthen falls back to its plain client when mTLS configuration returns no transport, leaving a non-mTLS client pointed at the mTLS host.The opposite edge also misses the documented policy: with
GOOGLE_API_USE_MTLS_ENDPOINT=alwaysand client-certificate use disabled, this gate never calls the resolver and leaves the regular host. AIP-4114 definesautoas mTLS only when a certificate is available, whilealwaysselects the mTLS endpoint independently.Could this preserve the full matrix—
alwaysrewrite,autorewrite only after mTLS actually negotiates, andneverretain the original URL—and add regression cases forauto/no-cert andalways/cert-disabled? The A2A follow-up in #6370 already keeps its original endpoint when transport negotiation returnsNone, which looks like the useful precedent here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified on
c6d04107: the MCP path now shares the base-URL policy,autois gated on the resolved certificate source, and the regression matrix coversautowith/without a cert plusalways,never, and non-Google endpoints. The full focused Agent Registry suite passes locally (52 tests). This addresses the original finding—thank you for the thorough update.