Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(postgres): use correct args.db_endpoint instead of args.hostname#2683

Merged
thephantomthief merged 2 commits into
awslabs:mainfrom
kakakakakku:postgres-mcp-server
May 5, 2026
Merged

fix(postgres): use correct args.db_endpoint instead of args.hostname#2683
thephantomthief merged 2 commits into
awslabs:mainfrom
kakakakakku:postgres-mcp-server

Conversation

@kakakakakku
Copy link
Copy Markdown
Contributor

Fixes
Related #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_endpoint CLI argument was renamed from --hostname in #1910, but one reference in main() was not updated, causing an AttributeError when connecting via Amazon RDS Data API.

Changes

Please provide a summary of what's being changed

Fix args.hostnameargs.db_endpoint on server.py.

User experience

Please share what the user experience looks like before and after this change

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 started

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Is this a breaking change? (Y/N)
N🙅

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

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.

@kakakakakku kakakakakku requested a review from kennthhz as a code owner March 15, 2026 15:03
Copilot AI review requested due to automatic review settings March 15, 2026 15:03
@kakakakakku kakakakakku requested review from a team and thephantomthief as code owners March 15, 2026 15:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 pass args.db_endpoint (instead of the removed args.hostname) into internal_connect_to_database.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the stale These are items that have been around for a long time without progress label Apr 19, 2026
@kakakakakku
Copy link
Copy Markdown
Contributor Author

kakakakakku commented Apr 21, 2026

@kennthhz
Hello, thank you for review and approval😀
Will this pull request be closed due to inactivity even though it has already been approved?

@github-actions github-actions Bot removed the stale These are items that have been around for a long time without progress label Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

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.

@github-actions github-actions Bot added the stale These are items that have been around for a long time without progress label May 5, 2026
@kakakakakku
Copy link
Copy Markdown
Contributor Author

@kennthhz @thephantomthief
Hi😀
If you have the time, please review it. If this pull request is completely unnecessary, please explicitly close it.

@thephantomthief thephantomthief enabled auto-merge May 5, 2026 20:21
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.58%. Comparing base (e4a8122) to head (5ee94a6).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thephantomthief thephantomthief added this pull request to the merge queue May 5, 2026
Merged via the queue into awslabs:main with commit a4377d3 May 5, 2026
127 checks passed
@github-project-automation github-project-automation Bot moved this from To triage to Done in awslabs/mcp Project May 5, 2026
@kakakakakku kakakakakku deleted the postgres-mcp-server branch May 6, 2026 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale These are items that have been around for a long time without progress

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants