You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* initial change for postgres mcp kiro integration by supporting creating cluster and connect to any cluster
* add support for direction connection and connection map unit test
* cp_api_connection unit test
* add support for UFC. add support for connect to any database through prompt
* support get connection information and fix get_table_schema bug
* remove delete cluster options
* fix policy attachment
* fix Kiro integration issue
* allow connection to RPG and make connection method and database type explicitly in MCP tool
* support expiry for IAM auth tokens
* remove outdated function
* Fix and add unit tests
* check for pgwire_iam conn in map
* MCP steering file
* remove UFC in this release
* Fix pyright errors
* fix ruff
* sync uv.lock
* Add license header to missing file
* Add baseline secrets
* Add more UT
* Add more unit tests
* Add tests
* Fix pre-commit
* support user agent in boto3
* update README.md
* Kiro power
* Fix tests
* Accept pre-commit fixes
* fix secrets
* fix init.py
* fix
* fix
* fix
* Accept precommit
* fix precommit
---------
Co-authored-by: Sharu Goel <[email protected]>
Co-authored-by: Sharu Goel <[email protected]>
Copy file name to clipboardExpand all lines: src/postgres-mcp-server/README.md
+44-76Lines changed: 44 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,9 @@ An AWS Labs Model Context Protocol (MCP) server for Aurora Postgres
12
12
13
13
1. Install `uv` from [Astral](https://docs.astral.sh/uv/getting-started/installation/) or the [GitHub README](https://github.com/astral-sh/uv#installation)
14
14
2. Install Python using `uv python install 3.10`
15
-
3. Aurora Postgres Cluster with Postgres username and password stored in AWS Secrets Manager
16
-
4. Enable RDS Data API for your Aurora Postgres Cluster, see [instructions here](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html)
17
-
5. This MCP server can only be run locally on the same host as your LLM client.
18
-
6. Docker runtime
19
-
7. Set up AWS credentials with access to AWS services
15
+
3. This MCP server can only be run locally on the same host as your LLM client.
16
+
4. Docker runtime
17
+
5. Set up AWS credentials with access to AWS services
20
18
- You need an AWS account with appropriate permissions
21
19
- Configure AWS credentials with `aws configure` or environment variables
22
20
@@ -28,20 +26,14 @@ An AWS Labs Model Context Protocol (MCP) server for Aurora Postgres
28
26
29
27
Configure the MCP server in your MCP client configuration (e.g., for Amazon Q Developer CLI, edit `~/.aws/amazonq/mcp.json`):
30
28
31
-
### Option 1: Using RDS Data API Connection (for Aurora Postgres)
32
-
33
29
```json
34
30
{
35
31
"mcpServers": {
36
32
"awslabs.postgres-mcp-server": {
37
33
"command": "uvx",
38
34
"args": [
39
35
"awslabs.postgres-mcp-server@latest",
40
-
"--resource_arn", "[your data]",
41
-
"--secret_arn", "[your data]",
42
-
"--database", "[your data]",
43
-
"--region", "[your data]",
44
-
"--readonly", "True"
36
+
"--allow_write_query"
45
37
],
46
38
"env": {
47
39
"AWS_PROFILE": "your-aws-profile",
@@ -55,35 +47,6 @@ Configure the MCP server in your MCP client configuration (e.g., for Amazon Q De
55
47
}
56
48
```
57
49
58
-
### Option 2: Using Direct PostgreSQL(psycopg) Connection (for Aurora Postgres and RDS Postgres)
59
-
60
-
```json
61
-
{
62
-
"mcpServers": {
63
-
"awslabs.postgres-mcp-server": {
64
-
"command": "uvx",
65
-
"args": [
66
-
"awslabs.postgres-mcp-server@latest",
67
-
"--hostname", "[your data]",
68
-
"--secret_arn", "[your data]",
69
-
"--database", "[your data]",
70
-
"--region", "[your data]",
71
-
"--readonly", "True"
72
-
],
73
-
"env": {
74
-
"AWS_PROFILE": "your-aws-profile",
75
-
"AWS_REGION": "us-east-1",
76
-
"FASTMCP_LOG_LEVEL": "ERROR"
77
-
},
78
-
"disabled": false,
79
-
"autoApprove": []
80
-
}
81
-
}
82
-
}
83
-
```
84
-
85
-
Note: The `--port` parameter is optional and defaults to 5432 (the standard PostgreSQL port). You only need to specify it if your PostgreSQL instance uses a non-standard port.
86
-
87
50
### Windows Installation
88
51
89
52
For Windows users, the MCP server configuration format is slightly different:
@@ -136,56 +99,61 @@ For Windows users, the MCP server configuration format is slightly different:
136
99
"-e", "AWS_SECRET_ACCESS_KEY=[your data]",
137
100
"-e", "AWS_REGION=[your data]",
138
101
"awslabs/postgres-mcp-server:latest",
139
-
"--resource_arn", "[your data]",
140
-
"--secret_arn", "[your data]",
141
-
"--database", "[your data]",
142
-
"--region", "[your data]",
143
-
"--readonly", "True"
102
+
"--allow_write_query"
144
103
]
145
104
}
146
105
}
147
106
}
148
107
```
149
108
150
-
#### Option 2: Using Direct PostgreSQL (psycopg) Connection (for Aurora Postgres and RDS Postgres)
109
+
NOTE: the MCP config example include --allow_write_query illustrate how to enable write queries. If you want to disable write queries, remove --allow_write_query option.
151
110
152
-
```
153
-
{
154
-
"mcpServers": {
155
-
"awslabs.postgres-mcp-server": {
156
-
"command": "docker",
157
-
"args": [
158
-
"run",
159
-
"-i",
160
-
"--rm",
161
-
"-e", "AWS_ACCESS_KEY_ID=[your data]",
162
-
"-e", "AWS_SECRET_ACCESS_KEY=[your data]",
163
-
"-e", "AWS_REGION=[your data]",
164
-
"awslabs/postgres-mcp-server:latest",
165
-
"--hostname", "[your data]",
166
-
"--secret_arn", "[your data]",
167
-
"--database", "[your data]",
168
-
"--region", "[your data]",
169
-
"--readonly", "True"
170
-
]
171
-
}
172
-
}
173
-
}
174
-
```
111
+
## Support for Database Cluster Creation
175
112
176
-
Note: The `--port` parameter is optional and defaults to 5432 (the standard PostgreSQL port). You only need to specify it if your PostgreSQL instance uses a non-standard port.
113
+
You can use the following LLM prompt to create a new Aurora PostgreSQL cluster:
177
114
178
-
NOTE: By default, only read-only queries are allowed and it is controlled by --readonly parameter above. Set it to False if you also want to allow writable DML or DDL.
115
+
> Create an Aurora PostgreSQL cluster named 'mycluster' in us-west-2 region
116
+
117
+
---
179
118
180
119
## Connection Methods
181
120
182
-
This MCP server supports two connection methods:
121
+
The MCP server supports connecting to multiple database endpoints using different connection methods via LLM prompts.
122
+
123
+
### Database Types
124
+
-**APG**: Amazon Aurora PostgreSQL
125
+
-**RPG**: Amazon RDS for PostgreSQL
126
+
127
+
### Example Prompts
128
+
129
+
**Connect using RDS Data API:**
130
+
> Connect to database named postgres in Aurora PostgreSQL cluster 'my-cluster' with database_type as APG, using rdsapi as connection method in us-west-2 region
131
+
132
+
**Connect using pgwire (Aurora PostgreSQL):**
133
+
> Connect to database named postgres with database endpoint as my-apg17-instance-1.ctgfg6yyo9df.us-west-2.rds.amazonaws.com with database_type as APG, using pgwire as connection method in us-west-2 region
134
+
135
+
**Connect using pgwire (RDS PostgreSQL):**
136
+
> Connect to database named postgres with database endpoint as test-apg17-instance-1.ctgfg6yyo9df.us-west-2.rds.amazonaws.com with database_type as RPG, using pgwire as connection method in us-west-2 region
|`pgwire`| Connect to PostgreSQL instance directly using the PostgreSQL wire protocol. Requires proper VPC security group configuration for direct database connectivity. | APG, RPG |
145
+
|`pgwire_iam`| Same as `pgwire`, but uses IAM authentication. Requires IAM authentication to be enabled on the Aurora PostgreSQL cluster. | APG only |
146
+
|`rdsapi`| Connect to Aurora PostgreSQL using the RDS Data API. Requires the RDS Data API to be enabled on the cluster. | APG only |
183
147
184
-
1.**RDS Data API Connection** (using `--resource_arn`): Uses the AWS RDS Data API to connect to Aurora PostgreSQL. This method requires that your Aurora cluster has the Data API enabled.
148
+
### Prerequisites by Connection Method
185
149
186
-
2.**Direct PostgreSQL Connection** (using `--hostname`): Uses psycopg to connect directly to any PostgreSQL database, including Aurora PostgreSQL, RDS PostgreSQL, or self-hosted PostgreSQL instances. This method provides better performance for frequent queries but requires direct network access to the database.
150
+
#### pgwire / pgwire_iam
151
+
- VPC security group must allow inbound connections from your MCP server to the database
152
+
- For `pgwire_iam`: IAM authentication must be enabled on the Aurora PostgreSQL cluster
187
153
188
-
Choose the connection method that best fits your environment and requirements.
154
+
#### rdsapi
155
+
- RDS Data API must be enabled on the Aurora PostgreSQL cluster
0 commit comments