Skip to content

SSE in Docker Compose using different port #63

Open
@jvandyke

Description

@jvandyke

I'm getting an error when attempting to redirect to a different port similar error, but it may not be related:

gres: Error in MCP: SSE error: TypeError: fetch failed: connect ECONNREFUSED 127.0.0.1:8000, connect ECONNREFUSED ::1:8000

I'm using Cursor. Here's the relevant part in mcp.json:

"postgres": {
    "type": "sse",
    "url": "http://localhost:9080/sse"
  }

I'm running this in Docker Compose. Here's that config:

postgres-mcp:
  image: crystaldba/postgres-mcp:latest
  hostname: postgres-mcp
  ports:
    - "9080:8000"
  command: --access-mode=unrestricted --transport=sse
  environment:
    - DATABASE_URI=postgresql://postgres:postgres@localhost:5432/db_name
  extra_hosts:
    - "host.docker.internal:host-gateway"

If I change the ports to 8000:8000 everything works. I'm guessing that the port is hard-coded somewhere. Can this be changed to an environment variable or arg?

Also, it'd be nice if the access mode and transport could be environment variables too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions