modelcontextprotocol / servers

Model Context Protocol Servers
https://modelcontextprotocol.io
MIT License
3.88k stars 371 forks source link

Unsupported URL Type "postgresql:" #211

Open jzillmann opened 1 day ago

jzillmann commented 1 day ago

Describe the bug Getting

/opt/homebrew/lib/node_modules/npx/node_modules/npm-package-arg/npa.js:258
      throw unsupportedURLType(urlparse.protocol, res.rawSpec)
      ^

Error: Unsupported URL Type "postgresql:": postgresql://plex_user:plex@localhost/plex_db_dev
    at unsupportedURLType (/opt/homebrew/lib/node_modules/npx/node_modules/npm-package-arg/npa.js:200:15)
    at fromURL (/opt/homebrew/lib/node_modules/npx/node_modules/npm-package-arg/npa.js:258:13)
    at resolve (/opt/homebrew/lib/node_modules/npx/node_modules/npm-package-arg/npa.js:77:12)
    at npa (/opt/homebrew/lib/node_modules/npx/node_modules/npm-package-arg/npa.js:52:10)
    at Function.parseArgs (/opt/homebrew/lib/node_modules/npx/node_modules/libnpx/parse-args.js:48:23)
    at Object.<anonymous> (/opt/homebrew/lib/node_modules/npx/index.js:8:20)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12) {
  code: 'EUNSUPPORTEDPROTOCOL'
}

Node.js v20.18.1

in mcp-server-postgres.log when starting claude desktop.

To Reproduce Steps to reproduce the behavior:

  1. Configure postgres
    {
    "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://plex_user:plex@localhost/plex_db_dev"
      ]
    }
    }
    }
  2. (Re)start Claude
  3. Look at ~/Library/Logs/Claude/mcp-server-postgres.log

Expected behavior No error and the postgres should be usable

Logs see above

Additional context

jspahrsummers commented 14 hours ago

It looks like npx is interpreting the postgresql:// argument. Can you try the following config instead:

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "--",
        "postgresql://plex_user:plex@localhost/plex_db_dev"
      ]
    }
  }
}
jzillmann commented 13 hours ago

Having now

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "--",
        "postgresql://plex_user:plex@localhost/plex_db_dev"
      ]
    }
  }
}

but It doesn't make a difference, still getting Error: Unsupported URL Type "postgresql:"