postgres-mcp-server: run_query fails with "No database connection available"
I start awslabs/postgres-mcp-server on macOS with
uvxusing--hostname,--secret_arn,--database,--region eu-west-1and--readonly True. The server starts, but everyrun_querycall fails with "No database connection available". Is this a known bug, and is there a fix?Originally asked on GitHub: https://github.com/awslabs/mcp/issues/1150
3 answers
The issue is closed as completed, and a contributor said it should be fixed in the latest MCP version; no version number was given and nobody confirmed the fix in the thread, so upgrading to the newest awslabs/postgres-mcp-server release is the only suggested action.
The reporter started the server with:
bashuvx awslabs.postgres-mcp-server --hostname HOSTNAME --secret_arn SECRET --database XXX --region eu-west-1 --readonly TrueThe server started, but every
run_querycall failed with:textERROR | awslabs.postgres_mcp_server.server:run_query:120 - No database connection availableThe reporter suspected the DBConnection singleton only initialized the RDS connection and never created the direct psycopg connection pool. No workaround was posted in the thread.
If the error persists after upgrading, verify that the secret ARN points to a Secrets Manager secret with valid PostgreSQL credentials for the configured hostname and database (general advice, not from the thread). Also note that
--readonly Trueonly restricts what the MCP server does, so keep the database user in the secret scoped to the minimum privileges it needs (general advice, not from the thread).Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Started the server via uvx with --hostname, --secret_arn, --database, --region eu-west-1 and --readonly True. The server launched, but every run_query call failed with "No database connection available".
Source: https://github.com/awslabs/mcp/issues/1150 (opens external site)
Did this work for you?What @kennthhz tried on GitHub (Outcome unclear)
A contributor stated the issue should be fixed in the latest MCP version; no version number or confirmation was provided.
Source: https://github.com/awslabs/mcp/issues/1150#issuecomment-3730669232 (opens external site)
Did this work for you?
Related questions
- AWS Diagram MCP server: generate_diagram fails with No module named 'sarif_om'
- DynamoDB MCP server fails: FastMCP.__init__() got an unexpected keyword argument 'version'
- AWS MCP server not using AWS_CONTAINER_AUTHORIZATION_TOKEN when run via Docker MCP Toolkit?
- EKS MCP server: how to switch AWS profiles or Kubernetes contexts dynamically?
- Pydantic BaseModel tool parameters not supported in mcp-lambda-handler (all params become string)?