Closed
Conversation
|
@ramapalani: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Hello @ramapalani, Appreciate the pull request and the effort put into this. We have it on our roadmap to evaluate extensibility of Apollo MCP Server to serve these kinds of use cases. That said, we won't be merging this PR as it is not the approach that we have in mind. Please continue to share feedback on what you'd like to see in extensibility as it will help us shape the future of that feature! |
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.
Summary
HeaderTransformtype (Arc<dyn Fn(&mut HeaderMap) + Send + Sync>) that allows SDK consumers to programmatically transform outgoing HTTP headers before they are sent to the upstream GraphQL endpoint.mcp-session-idhave all been applied -- giving consumers full control to add, modify, or remove any header.header_transformoption through theServerbuilder, the state machine (Config/Starting/Running), and both the HTTP-transport and stdio-only code paths inRunning.Motivation
Closes #642
When embedding
apollo-mcp-serveras a library, consumers often need to apply custom authentication schemes (e.g., HMAC signing, short-lived token minting), header-based routing, or other dynamic header transformations that cannot be expressed with static headers or simple forwarding rules. Without this hook, the only workaround is placing an intermediary proxy in front of the upstream endpoint.Changes
headers.rsHeaderTransformtype alias;build_request_headersnow accepts an optional transform and applies it as the last stepserver.rsheader_transform: Option<HeaderTransform>field toServerand itsbonbuilder constructorserver/states.rsheader_transformthrough theConfigstruct and state machine transitionsserver/states/starting.rsheader_transformfromConfiginto theRunningstate; added integration test for propagationserver/states/running.rsTest plan
headers.rscovering: transform adds headers, modifies existing headers, removes headers, runs after all other header assembly, overrides auth token, isArc-cloneable and reusable across calls, andNoneis a no-opstarting.rsverifying the transform propagates fromConfigthroughStartinginto theRunningstate and remains functionalNonefor backward compatibilitycargo testpassescargo clippy --all-targets -- --deny warningspasses