awslabs.postgres-mcp-server 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
awslabs/__init__.py CHANGED
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
4
- # with the License. A copy of the License is located at
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
8
- # or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
9
- # OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
10
- # and limitations under the License.
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
11
14
 
12
15
  # This file is part of the awslabs namespace.
13
16
  # It is intentionally minimal to support PEP 420 namespace packages.
@@ -1,14 +1,17 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
4
- # with the License. A copy of the License is located at
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
8
- # or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
9
- # OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
10
- # and limitations under the License.
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
11
14
 
12
15
  """awslabs.postgres-mcp-server"""
13
16
 
14
- __version__ = '0.0.3'
17
+ __version__ = '0.0.4'
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
4
- # with the License. A copy of the License is located at
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
8
- # or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
9
- # OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
10
- # and limitations under the License.
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
11
14
 
12
15
  import re
13
16
 
@@ -47,8 +50,6 @@ MUTATING_PATTERN = re.compile(
47
50
  )
48
51
 
49
52
  SUSPICIOUS_PATTERNS = [
50
- r'--.*$', # single-line comment
51
- r'/\*.*?\*/', # multi-line comment
52
53
  r"(?i)'.*?--", # comment injection
53
54
  r'(?i)\bor\b\s+\d+\s*=\s*\d+', # numeric tautology e.g. OR 1=1
54
55
  r"(?i)\bor\b\s*'[^']+'\s*=\s*'[^']+'", # string tautology e.g. OR '1'='1'
@@ -56,7 +57,7 @@ SUSPICIOUS_PATTERNS = [
56
57
  r'(?i)\bdrop\b', # DROP statement
57
58
  r'(?i)\btruncate\b', # TRUNCATE
58
59
  r'(?i)\bgrant\b|\brevoke\b', # GRANT or REVOKE
59
- r'(?i);', # stacked queries
60
+ r';\s*(?!($|\s*--|\s*/\*))(?=\S)', # stacked queries, excluding semicolons followed by comments or whitespace
60
61
  r'(?i)\bsleep\s*\(', # delay-based probes
61
62
  r'(?i)\bpg_sleep\s*\(',
62
63
  r'(?i)\bload_file\s*\(',
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
4
- # with the License. A copy of the License is located at
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
8
- # or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
9
- # OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
10
- # and limitations under the License.
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
11
14
 
12
15
  """awslabs postgres MCP Server implementation."""
13
16
 
@@ -291,7 +294,7 @@ async def get_table_schema(
291
294
  FROM
292
295
  pg_attribute a
293
296
  WHERE
294
- a.attrelid = :table_name::regclass
297
+ a.attrelid = to_regclass(:table_name)
295
298
  AND a.attnum > 0
296
299
  AND NOT a.attisdropped
297
300
  ORDER BY a.attnum
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: awslabs.postgres-mcp-server
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: An AWS Labs Model Context Protocol (MCP) server for postgres
5
5
  Project-URL: homepage, https://awslabs.github.io/mcp/
6
6
  Project-URL: docs, https://awslabs.github.io/mcp/servers/postgres-mcp-server/
@@ -52,7 +52,9 @@ An AWS Labs Model Context Protocol (MCP) server for Aurora Postgres
52
52
 
53
53
  ## Installation
54
54
 
55
- Here are some ways you can work with MCP across AWS, and we'll be adding support to more products including Amazon Q Developer CLI soon: (e.g. for Amazon Q Developer CLI MCP, `~/.aws/amazonq/mcp.json`):
55
+ [![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://cursor.com/install-mcp?name=awslabs.postgres-mcp-server&config=eyJjb21tYW5kIjoidXZ4IGF3c2xhYnMucG9zdGdyZXMtbWNwLXNlcnZlckBsYXRlc3QgLS1yZXNvdXJjZV9hcm4gW3lvdXIgZGF0YV0gLS1zZWNyZXRfYXJuIFt5b3VyIGRhdGFdIC0tZGF0YWJhc2UgW3lvdXIgZGF0YV0gLS1yZWdpb24gW3lvdXIgZGF0YV0gLS1yZWFkb25seSBUcnVlIiwiZW52Ijp7IkFXU19QUk9GSUxFIjoieW91ci1hd3MtcHJvZmlsZSIsIkFXU19SRUdJT04iOiJ1cy1lYXN0LTEiLCJGQVNUTUNQX0xPR19MRVZFTCI6IkVSUk9SIn0sImRpc2FibGVkIjpmYWxzZSwiYXV0b0FwcHJvdmUiOltdfQ%3D%3D)
56
+
57
+ Configure the MCP server in your MCP client configuration (e.g., for Amazon Q Developer CLI, edit `~/.aws/amazonq/mcp.json`):
56
58
 
57
59
  ```json
58
60
  {
@@ -0,0 +1,10 @@
1
+ awslabs/__init__.py,sha256=WuqxdDgUZylWNmVoPKiK7qGsTB_G4UmuXIrJ-VBwDew,731
2
+ awslabs/postgres_mcp_server/__init__.py,sha256=OpiWDc6HV8EoZVGVKb6ebzcIm7TUbZeALyFkLdm7YWg,673
3
+ awslabs/postgres_mcp_server/mutable_sql_detector.py,sha256=bivLNglukgfi0IWcQSfDcwxFae4Q8CSvb--yWW617l0,2717
4
+ awslabs/postgres_mcp_server/server.py,sha256=Hw8qPrjlqoKoPatP2485RN_ntXfwb09OIPYOAKyRtrk,14500
5
+ awslabs_postgres_mcp_server-1.0.2.dist-info/METADATA,sha256=iXXfB4gRlM19YkK5t6vOfO2KUM-ZOGpJQmLyQLkvJ4w,5365
6
+ awslabs_postgres_mcp_server-1.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ awslabs_postgres_mcp_server-1.0.2.dist-info/entry_points.txt,sha256=qHCxq_MTANxTB8-mA7Wl6H71qWEMwmG-I6_koII4AXY,88
8
+ awslabs_postgres_mcp_server-1.0.2.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
9
+ awslabs_postgres_mcp_server-1.0.2.dist-info/licenses/NOTICE,sha256=qMIIe3h7I1Y4-CKejn50wbSKXEZLWhYHdKaRwKdXN9M,95
10
+ awslabs_postgres_mcp_server-1.0.2.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- awslabs/__init__.py,sha256=47wJeKcStxEJwX7SVVV2pnAWYR8FxcaYoT3YTmZ5Plg,674
2
- awslabs/postgres_mcp_server/__init__.py,sha256=J9QAlEAe6DiFJ9irk9cOaM7NINate24hfP1RFiywKww,616
3
- awslabs/postgres_mcp_server/mutable_sql_detector.py,sha256=1Rywe9i7zkAT2JxG_QIc1nr1v6J49yUjfwVTvVpZe3A,2655
4
- awslabs/postgres_mcp_server/server.py,sha256=frD6WP6Iixdzs8qOh-2vAXkbOxVNNp_TuQYxVVcQPJU,14440
5
- awslabs_postgres_mcp_server-1.0.0.dist-info/METADATA,sha256=4sXbcBYaEGxKpxTf-WRuGcX3Sw1b2uJ-D9cKCt0z-w8,4897
6
- awslabs_postgres_mcp_server-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- awslabs_postgres_mcp_server-1.0.0.dist-info/entry_points.txt,sha256=qHCxq_MTANxTB8-mA7Wl6H71qWEMwmG-I6_koII4AXY,88
8
- awslabs_postgres_mcp_server-1.0.0.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
9
- awslabs_postgres_mcp_server-1.0.0.dist-info/licenses/NOTICE,sha256=qMIIe3h7I1Y4-CKejn50wbSKXEZLWhYHdKaRwKdXN9M,95
10
- awslabs_postgres_mcp_server-1.0.0.dist-info/RECORD,,