Repository navigation
Conversation
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.
What's wrong
1. The
getFetchOptionsJSDoc says the opposite of what the code does. Insrc/_internal/nextjs-runtime-manager.ts:Certificates are verified by default, and
NODE_TLS_REJECT_UNAUTHORIZED=0turns verification off. #88 made insecure TLS the default, and #93 switched to strict verification after the review in #88 (comment), but the comment kept the old meaning.2. Nothing tells users how to reach a dev server started with
next dev --experimental-https. mkcert installs its CA in the OS trust store, which Node.js doesn't read, and Next.js passes the CA only to its own server process throughNODE_EXTRA_CA_CERTS. The MCP server is a separate Node process, so the certificate check fails andnextjs_indexreports no server. With an explicit port it saysNo MCP tools found on port 3008 ..., andnextjs_callsaysCannot connect to Next.js dev server on port 3008. The README doesn't mention HTTPS,NODE_EXTRA_CA_CERTSorNODE_TLS_REJECT_UNAUTHORIZED. #86 (HTTPS through a custom server) hits the same check since #93.Reproduction
Next.js 16.4.3, Node 24.22.1, Windows 11. I ran
next dev --port 3008 --experimental-httpswith a localhost certificate signed by a throwaway local CA (passed with--experimental-https-ca), so nothing was installed into the OS trust store. A small stdio MCP client started the builtdist/index.jswith each env and callednextjs_indexandnextjs_call:nextjs_index(auto)nextjs_index {port}nextjs_call get_errorsNo MCP tools found on port 3008 ...Cannot connect to Next.js dev server on port 3008 ...NODE_EXTRA_CA_CERTS=<rootCA.pem>https://localhost:3008, 9 toolsNODE_TLS_REJECT_UNAUTHORIZED=0https://localhost:3008, 9 toolsA plain
next devon the same port is found with no env, and on a non-standard port (process discovery) the HTTPS server is found withNODE_EXTRA_CA_CERTSand not without it.Changes
src/_internal/nextjs-runtime-manager.ts: the JSDoc now describes the real behavior. Comment only.README.md: one Troubleshooting entry with anenvexample forNODE_EXTRA_CA_CERTS, where to find the CA path, a note for your own certificate or a custom HTTPS server, andNODE_TLS_REJECT_UNAUTHORIZED=0as a last resort, with the warning that it turns off verification for every HTTPS request the server makes.No runtime change, so no changeset. I can add a regression test that pins verify-by-default if you want one; I left it out because it needs a self-signed key and certificate checked into the repo.
Tests
With the repo's pnpm 9.15.9:
pnpm build,pnpm typecheckandpnpm testpass (9 test files).Related: #86, #88, #93