Can't use MPC servers with spawn Unknown system error -8

Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 7 comments · opened Feb 27, 2025 · closed Feb 28, 2025
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Hello there,
I can't get rid of this error in the logs

[
  {
    "error": "Connection failed: spawn Unknown system error -8",
    "timestamp": "2025-02-27T06:59:09.346Z",
    "sessionId": "0b3dd2be-334f-4e29-9ae3-4eee16b40d53",
    "cwd": "/Users/theophile/tests/basalt"
  }
]

Using node v22.13.1 through nvm on macOs Sequoia 15.3.1 on M2
Tried zsh & bash with the same output
Any ideas ?

View original on GitHub ↗

7 Comments

ashwin-ant collaborator · 1 year ago

Your MCP server may have some bug. Does it work with the MCP inspector? https://modelcontextprotocol.io/docs/tools/inspector

0xthc · 1 year ago

Seems like it works well. Also it works with claude desktop app but not with claude-code 🤔

!Image

My mcp config

{
	"mcpServers": {
	  "postgres": {
		"command": "docker",
		"args": [
		  "run",
		  "-i",
		  "--rm",
		  "mcp/postgres",
		  "postgresql://postgres:123@host.docker.internal:5432/pg8"
		]
	  }
	}
}

The command i'm running

$ claude mcp add postgres ./claude_desktop_config.json
Added stdio MCP server postgres with command: ./claude_desktop_config.json  to project config

Inside claude desktop

<img width="1078" alt="Image" src="https://github.com/user-attachments/assets/673431e8-d82f-4d37-83e8-935d7cdbb711" />

Could it be file permissions on the json config ?

ashwin-ant collaborator · 1 year ago

We don't support adding a JSON file directly from the command line. Try this:

claude mcp add postgres docker -- run -i --rm mcp/postgres postgresql://postgres:123@host.docker.internal:5432/pg8
0xthc · 1 year ago

Wow ok it works now thank you very much !!!

ekeric13 · 1 year ago

so i found this documentation kind of confusing:

claude mcp add postgres-server /path/to/postgres-mcp-server --connection-string "postgresql://user:pass@localhost:5432/mydb"

based on what you are saying @ashwin-ant, we create a new mcp server called "postgres". and we do it by pulling in the mcp/postgres docker image + and running it. and then that image takes as it's command the db connection string.

is that right?

ashwin-ant collaborator · 1 year ago

@ekeric13 In that command, the server name is postgres-server and its command to run is /path/to/postgres-mcp-server. So Claude Code will spawn the MCP server by running /path/to/postgres-mcp-server --connection-string "postgresql://user:pass@localhost:5432/mydb".

You may find the MCP wizard easier to use than that command. Just run claude mcp add and it'll start the wizard. Alternatively you can add a server via a JSON string. In the postgres example, it'd be:

claude mcp add-json postgres-server '{
  "command": "/path/to/postgres-mcp-server",
  "args": [
    "--connection-string",
    "postgresql://user:pass@localhost:5432/mydb"
  ]
}'
github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.