Skip to content

MCP Server exits after startup, no debug. #38

Open
@bdmorin

Description

@bdmorin

Bug report

Describe the bug

New install, macos

➜ neofetch --backend off
-----------------
OS: macOS 15.3.1 24D70 arm64
Host: Mac15,7
Kernel: 24.3.0
Uptime: 3 days, 5 hours, 36 mins
Packages: 373 (brew)
Shell: fish 4.0.1
Resolution: 3008x1692, 1728x1117, 1440x2560
DE: Aqua
WM: Rectangle
Terminal: iTerm2
Terminal Font: ComicShannsMonoNFM-Regular 16
CPU: Apple M3 Pro
GPU: Apple M3 Pro
Memory: 3325MiB / 18432MiB

(PAT have already been deleted)

➜ npx -y @supabase/mcp-server-supabase@latest --access-token sbp_93cf52ac8a0a94277fa28e670c4cf744dc418cd8
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.

It exits with no more output.

I tried with multiple invocations.

❯ history |rg "supabase" | rg npx
npx -y @supabase/mcp-server-supabase@latest --access-token sbp_93cf52ac8a0a94277fa28e670c4cf744dc418cd8
/opt/homebrew/Cellar/node@18/18.20.8/bin/npx -y @supabase/mcp-server-supabase@latest --access-token sbp_93cf52ac8a0a94277fa28e670c4cf744dc418cd8
/opt/homebrew/Cellar/node@20/20.19.0_1/bin/npx -y @supabase/mcp-server-supabase@latest --access-token sbp_93cf52ac8a0a94277fa28e670c4cf744dc418cd8
/opt/homebrew/Cellar/node@22/22.14.0_1/bin/npx -y @supabase/mcp-server-supabase@latest --access-token sbp_93cf52ac8a0a94277fa28e670c4cf744dc418cd8

All with the exact same output.

I tried with a mcp debugger:

❯ npx mcp-chat --server "npx -y @supabase/mcp-server-supabase@latest --access-token sbp_93cf52ac8a0a94277fa28e670c4cf744dc418cd8"
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
Failed to connect to MCP server:  McpError: MCP error -32000: Connection closed
    at Client._onclose (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:94:23)
    at _transport.onclose (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:69:18)
    at ChildProcess.<anonymous> (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:85:77)
    at ChildProcess.emit (node:events:507:28)
    at maybeClose (node:internal/child_process:1101:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: -32000,
  data: undefined
}
Failed to connect to server npx -y @supabase/mcp-server-supabase@latest --access-token sbp_93cf52ac8a0a94277fa28e670c4cf744dc418cd8
McpError: MCP error -32000: Connection closed
    at Client._onclose (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:94:23)
    at _transport.onclose (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:69:18)
    at ChildProcess.<anonymous> (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:85:77)
    at ChildProcess.emit (node:events:507:28)
    at maybeClose (node:internal/child_process:1101:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: -32000,
  data: undefined
}
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

McpError: MCP error -32000: Connection closed
    at Client._onclose (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:94:23)
    at _transport.onclose (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:69:18)
    at ChildProcess.<anonymous> (file:///Users/bdmorin/.npm/_npx/c3ac9bf2b1e69376/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:85:77)
    at ChildProcess.emit (node:events:507:28)
    at maybeClose (node:internal/child_process:1101:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: -32000,
  data: undefined
}

Node.js v23.11.0

I'm not a node dev, so I asked gpt.

Yeah, I can help make sense of this.

⸻

🧵 What’s Happening

You’re running npm i in a Supabase-related repo, and it’s trying to install @supabase/sql-to-rest, which depends on libpg-query, a native Node addon. The failure is happening while compiling the C source for that native dependency.

⸻

🧨 The Actual Failure

This is the root error:

src/postgres/src_port_snprintf.c:374:1: error: static declaration of 'strchrnul' follows non-static declaration

That means:
	•	libpg-query defines a static strchrnul() function.
	•	But your macOS SDK already declares strchrnul() non-statically in /usr/include/_string.h.
	•	This is a conflict between the Postgres vendored C code and your macOS SDK.

Additionally:

warning: 'strchrnul' is only available on macOS 15.4 or newer [-Wunguarded-availability-new]

So you’re on macOS 15.4+, but the build is targeting macOS 10.7, so the compiler thinks strchrnul() isn’t safe to use directly.

⸻

💣 Why It’s Failing

You’re on:
	•	macOS 15.4
	•	Apple Silicon (arm64)
	•	Node 23.11.0 (latest)
	•	node-gyp 11.0.0

But libpg-query:
	1.	Doesn’t have a prebuilt binary for node-v131 (Node 23 ABI) and macOS arm64.
	2.	Falls back to source compilation.
	3.	Triggers a C standard library conflict during compilation.

⸻

✅ Fixes & Workarounds

1. Patch the C source

Edit src/postgres/src_port_snprintf.c to avoid redefining strchrnul if it’s already defined:

#ifndef HAVE_STRCHRNUL
static const char *strchrnul(const char *s, int c) {
  while (*s && *s != c) s++;
  return s;
}
#endif

Or protect it with a version check or macro. This is the cleanest path forward if you’re comfortable patching.

⸻

2. Use an older Node version

Try downgrading to Node 20 or 18, which are LTS and may still have prebuilt libpg-query binaries:

nvm install 20
nvm use 20

Then reinstall:

rm -rf node_modules package-lock.json
npm i



⸻

3. Set a higher macOS deployment target

Override the deployment target to match your actual macOS version to silence the strchrnul availability errors:

export MACOSX_DEPLOYMENT_TARGET=15.4
npm i

But this won’t fix the core strchrnul conflict unless it’s conditionally compiled.

⸻

4. File a PR or issue

If you’re using the latest libpg-query, this is probably something upstream should fix to support C23 and modern macOS SDKs cleanly.

GitHub: https://github.com/supabase/libpg-query

⸻

Let me know if you want a quick patch script or want to try the Node downgrade route and need help setting it up.

again, I have no idea what's the right move here.

I failed to get this to work in claude desktop, cline, and locally debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions