fix(postgres): use correct args.db_endpoint instead of args.hostname#2683
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the Postgres MCP server CLI wiring where --db_endpoint was renamed from --hostname, but main() still referenced the old args.hostname, causing an AttributeError when starting connections (notably via Amazon RDS Data API).
Changes:
- Update
main()to passargs.db_endpoint(instead of the removedargs.hostname) intointernal_connect_to_database.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This pull request is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label. |
|
@kennthhz |
|
This pull request is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label. |
|
@kennthhz @thephantomthief |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2683 +/- ##
=======================================
Coverage 92.58% 92.58%
=======================================
Files 911 911
Lines 72842 72842
Branches 11568 11568
=======================================
+ Hits 67441 67442 +1
Misses 3294 3294
+ Partials 2107 2106 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
FixesRelated #2504 #2505
This bug blocks Amazon RDS Data API connections. I independently found and fixed it, then discovered that #2504 addresses the same issue along with several other changes. This pull request focuses on the minimal one-line fix that resolved my case. Thank you😀
Summary
The
--db_endpointCLI argument was renamed from--hostnamein #1910, but one reference inmain()was not updated, causing anAttributeErrorwhen connecting via Amazon RDS Data API.Changes
Fix
args.hostname→args.db_endpointonserver.py.User experience
Before:
Connecting via Amazon RDS Data API fails immediately with
AttributeError.(Running the MCP server directly from the CLI to capture the log.)
$ uvx awslabs.postgres-mcp-server@latest \ --connection_method RDS_API \ --db_type APG \ --db_cluster_arn "arn:aws:rds:ap-northeast-1:000000000000:cluster:xxxxx" \ --db_endpoint "xxxxx.cluster-xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com" \ --region ap-northeast-1 \ --database xxx (snip) Traceback (most recent call last): File ".../server.py", line 864, in main db_endpoint=args.hostname, ^^^^^^^^^^^^^ AttributeError: 'Namespace' object has no attribute 'hostname'After:
The server starts and connects successfully.
(Running the MCP server directly from the CLI to capture the log.)
$ uv run awslabs.postgres-mcp-server \ --connection_method RDS_API \ --db_type APG \ --db_cluster_arn "arn:aws:rds:ap-northeast-1:000000000000:cluster:xxxxx" \ --db_endpoint "xxxxx.cluster-xxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com" \ --region ap-northeast-1 \ --database xxx (snip) 2026-03-15 23:40:21.965 | SUCCESS | awslabs.postgres_mcp_server.server:run_query:205 - run_query successfully executed query:SELECT 1 2026-03-15 23:40:21.966 | SUCCESS | awslabs.postgres_mcp_server.server:main:893 - Successfully validated database connection to Postgres 2026-03-15 23:40:21.966 | INFO | awslabs.postgres_mcp_server.server:main:895 - Postgres MCP server startedChecklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change? (Y/N)
N🙅
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.