next-devtools-mcp icon indicating copy to clipboard operation
next-devtools-mcp copied to clipboard

MCP Discovery Failure on Windows with Cursor (Next.js 16)

Open MateusTum opened this issue 1 year ago • 6 comments

MCP Discovery Failure on Windows (Next.js 16)

  • Environment

    • Windows 11
    • Node.js v25.0.0. (tried on v20 too)
    • Node/npm per next dev
    • [email protected]
    • next-devtools-mcp@^0.2.1
    • .cursor/mcp.json includes next-devtools and Sentry entries
  • Steps Taken

    • Install project dependencies (npm install)
    • Start dev server: npm run dev
      • App reachable at http://localhost:3000
      • MCP endpoint responds (requires Accept: text/event-stream)
        • PowerShell check: Invoke-WebRequest http://localhost:3000/_next/mcp/tools -Headers @{Accept='text/event-stream'}
        • Response arrives (streaming JSON)
    • In Cursor, run next-devtools → discover_servers
  • Expected

    • discover_servers should list the running dev server on http://localhost:3000 as MCP-enabled.
  • Actual

    • discover_servers returns:
      {"success":false,"message":"No running Next.js dev servers with MCP enabled found","hint":"For Next.js < 16: Start with __NEXT_EXPERIMENTAL_MCP_SERVER=true or experimental.mcpServer: true. For Next.js >= 16: MCP is enabled by default.","count":0}
      
    • Re-running after confirming endpoint availability yields same result.
    • No additional warnings/errors in the terminal running npm run dev.
  • Additional Notes

    • Verified MCP endpoint manually with SSE header; streaming JSON returned.
    • MCP server and Cursor run in same Windows environment (no WSL/Docker).
    • No proxy/VPN interfering.
    • next.config.ts is minimal (export default withSentryConfig(nextConfig, {...})) with no experimental.mcpServer override.

Please advise on additional diagnostics or patches needed so discover_servers recognizes the running Next.js MCP server.

MateusTum avatar Oct 23 '25 14:10 MateusTum

I'm having the same problem. Got a NextJS v16 project running with pnpm run dev and the next-devtools mcp added to cursor. The mcp tool cannot find the server.

tobiasmaneschijn avatar Oct 26 '25 16:10 tobiasmaneschijn

I'm having a near-identical experience.

I also tried having it manually enter the port, and setting includeUnverified, but ultimately I couldn't get it working and was never able to actually use the nextjs_runtime tool.

MichaelJuskowicz avatar Oct 28 '25 23:10 MichaelJuskowicz

me too , having the same issue

AhmedNasr0 avatar Oct 30 '25 05:10 AhmedNasr0

Hey guys! Windows havent ps aux thats why it fails. Faced the same problem. No issues with Mac. MCP output logs:

2025-10-30 12:03:20.598 [info] Handling CallTool action for tool 'nextjs_runtime'
2025-10-30 12:03:20.598 [info] Calling tool 'nextjs_runtime' with toolCallId: call_LUoKqo6HCfZO5dyCM3johr3m
fc_05e6f9130200bd130169031bc76c2c8199b6c7e39cebfe8272
2025-10-30 12:03:20.605 [error] [Next.js Runtime Manager] Error finding Next.js servers: Error: Command failed: ps aux
"ps" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:524:28)
    at maybeClose (node:internal/child_process:1104:16)
    at ChildProcess._handle.onexit (node:internal/child_process:304:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'ps aux',
  stdout: '',
  stderr: '"ps" �� ���� ����७��� ��� ���譥�\r\n' +
    '��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.\r\n'
}

2025-10-30 12:03:20.605 [error] [Next.js Runtime Manager] Error finding Next.js servers: Error: Command failed: ps aux
"ps" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:524:28)
    at maybeClose (node:internal/child_process:1104:16)
    at ChildProcess._handle.onexit (node:internal/child_process:304:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'ps aux',
  stdout: '',
  stderr: '"ps" �� ���� ����७��� ��� ���譥�\r\n' +
    '��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.\r\n'
}

2025-10-30 12:03:20.605 [info] Successfully called tool 'nextjs_runtime'

You can configure built-in MCP but it only includes tools:

mcp_nextjs-mcp-builtin_get_project_metadata
mcp_nextjs-mcp-builtin_get_errors
mcp_nextjs-mcp-builtin_get_page_metadata
mcp_nextjs-mcp-builtin_get_logs
mcp_nextjs-mcp-builtin_get_server_action_by_id

Here is config:

{
  "mcpServers": {
    "next-devtools": {
      "command": "npx",
      "args": ["-y", "next-devtools-mcp@latest"]
    },
    "nextjs-mcp-builtin": {
      "url": "http://localhost:3000/_next/mcp"
    }
  }
}

imdimasan avatar Oct 30 '25 08:10 imdimasan

@imdimasan doesn`t worked for me , idk why i changed the config file mcp and added yours , then it added a 2 mcps in cursor mcp tools , one for (next devtools) and the second, which is the built-in one but i ended up fail to connect to it using my cursor agent

AhmedNasr0 avatar Oct 30 '25 08:10 AhmedNasr0

Fixed by https://github.com/vercel/next-devtools-mcp/pull/67

gaojude avatar Oct 30 '25 22:10 gaojude