-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix MCP in production #3647
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
Fix MCP in production #3647
Conversation
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
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.
Codex Review: Here are some suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
const request = new Request( | ||
// Next.js request.url is the original URL and not the rewritten one from the middleware | ||
context.linker.toAbsoluteURL(context.linker.toPathInSite('~gitbook/mcp')), | ||
nextRequest |
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.
[P1] Preserve query parameters when reconstructing MCP request
The new handler rebuilds the request object with new Request(context.linker.toAbsoluteURL(context.linker.toPathInSite('~gitbook/mcp')), nextRequest)
. This replaces the original URL, but it discards any search string that may have been present because the first argument is just a bare path without nextRequest.nextUrl.search
. Middlewares explicitly copy request.nextUrl.search
when rewriting, so callers can pass data via query parameters. After this change, any MCP call that relies on query parameters (e.g. authentication or debug flags) will stop receiving them. Consider appending nextRequest.nextUrl.search
to the constructed URL before creating the new Request
.
Useful? React with 👍 / 👎.
No description provided.