awslabs.postgres-mcp-server 0.0.5__py3-none-any.whl → 1.0.1__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
 
@@ -372,8 +375,6 @@ def main():
372
375
  parser = argparse.ArgumentParser(
373
376
  description='An AWS Labs Model Context Protocol (MCP) server for postgres'
374
377
  )
375
- parser.add_argument('--sse', action='store_true', help='Use SSE transport')
376
- parser.add_argument('--port', type=int, default=8888, help='Port to run the server on')
377
378
  parser.add_argument('--resource_arn', required=True, help='ARN of the RDS cluster')
378
379
  parser.add_argument(
379
380
  '--secret_arn',
@@ -420,13 +421,8 @@ def main():
420
421
 
421
422
  logger.success('Successfully validated RDS API db connection to Postgres')
422
423
 
423
- # Run server with appropriate transport
424
- if args.sse:
425
- mcp.settings.port = args.port
426
- mcp.run(transport='sse')
427
- else:
428
- logger.info('Starting Postgres MCP server')
429
- mcp.run()
424
+ logger.info('Starting Postgres MCP server')
425
+ mcp.run()
430
426
 
431
427
 
432
428
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: awslabs.postgres-mcp-server
3
- Version: 0.0.5
3
+ Version: 1.0.1
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/
@@ -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=Ah3DNrxSBF58eX9fXfCXKcHKpgPILrsuvaOMCnpeHz4,14497
5
+ awslabs_postgres_mcp_server-1.0.1.dist-info/METADATA,sha256=K5hBaCZ10HoyoN-I-nSi3AWQ9v-cGxQDsZ_uQsCIwIk,4897
6
+ awslabs_postgres_mcp_server-1.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ awslabs_postgres_mcp_server-1.0.1.dist-info/entry_points.txt,sha256=qHCxq_MTANxTB8-mA7Wl6H71qWEMwmG-I6_koII4AXY,88
8
+ awslabs_postgres_mcp_server-1.0.1.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
9
+ awslabs_postgres_mcp_server-1.0.1.dist-info/licenses/NOTICE,sha256=qMIIe3h7I1Y4-CKejn50wbSKXEZLWhYHdKaRwKdXN9M,95
10
+ awslabs_postgres_mcp_server-1.0.1.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=Q-YsyUABZ2I5B4OgdzQihWI0nEgipGJBun35oWZCW8k,14762
5
- awslabs_postgres_mcp_server-0.0.5.dist-info/METADATA,sha256=-2wI3aEHREKsn1trhXv3WJH6llNfPpoCMp6TiK1P9J0,4897
6
- awslabs_postgres_mcp_server-0.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- awslabs_postgres_mcp_server-0.0.5.dist-info/entry_points.txt,sha256=qHCxq_MTANxTB8-mA7Wl6H71qWEMwmG-I6_koII4AXY,88
8
- awslabs_postgres_mcp_server-0.0.5.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
9
- awslabs_postgres_mcp_server-0.0.5.dist-info/licenses/NOTICE,sha256=qMIIe3h7I1Y4-CKejn50wbSKXEZLWhYHdKaRwKdXN9M,95
10
- awslabs_postgres_mcp_server-0.0.5.dist-info/RECORD,,