awslabs.mysql-mcp-server 0.0.1__tar.gz → 1.0.1__tar.gz

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.
Files changed (20) hide show
  1. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/.gitignore +6 -0
  2. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/Dockerfile +11 -8
  3. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/PKG-INFO +1 -1
  4. awslabs_mysql_mcp_server-1.0.1/awslabs/__init__.py +16 -0
  5. awslabs_mysql_mcp_server-1.0.1/awslabs/mysql_mcp_server/__init__.py +17 -0
  6. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/awslabs/mysql_mcp_server/mutable_sql_detector.py +10 -9
  7. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/awslabs/mysql_mcp_server/server.py +11 -14
  8. awslabs_mysql_mcp_server-1.0.1/docker-healthcheck.sh +26 -0
  9. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/pyproject.toml +1 -1
  10. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/tests/test_server.py +17 -7
  11. awslabs_mysql_mcp_server-0.0.1/awslabs/__init__.py +0 -13
  12. awslabs_mysql_mcp_server-0.0.1/awslabs/mysql_mcp_server/__init__.py +0 -14
  13. awslabs_mysql_mcp_server-0.0.1/docker-healthcheck.sh +0 -12
  14. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/.python-version +0 -0
  15. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/CHANGELOG.md +0 -0
  16. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/LICENSE +0 -0
  17. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/NOTICE +0 -0
  18. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/README.md +0 -0
  19. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/tests/conftest.py +0 -0
  20. {awslabs_mysql_mcp_server-0.0.1 → awslabs_mysql_mcp_server-1.0.1}/uv.lock +0 -0
@@ -181,6 +181,9 @@ env.bak/
181
181
  venv.bak/
182
182
  .direnv/
183
183
 
184
+ # Certificates
185
+ awslabs/certs
186
+
184
187
  # Spyder project settings
185
188
  .spyderproject
186
189
  .spyproject
@@ -557,3 +560,6 @@ dist
557
560
 
558
561
  # End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,pycharm+all,node
559
562
  samples/mcp-integration-with-nova-canvas/output/*
563
+
564
+ memory-bank/*
565
+ .clinerules
@@ -1,16 +1,19 @@
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
  #FROM public.ecr.aws/sam/build-python3.10:1.137.1-20250411084548
13
- FROM public.ecr.aws/sam/build-python3.10@sha256:04cdbe84bec08d17d621192bc3f0a9e4a85a83f2ac99aa9241659dfac0d845ea AS uv
16
+ FROM public.ecr.aws/sam/build-python3.10@sha256:e78695db10ca8cb129e59e30f7dc9789b0dbd0181dba195d68419c72bac51ac1 AS uv
14
17
 
15
18
  # Install the project into `/app`
16
19
  WORKDIR /app
@@ -44,7 +47,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
44
47
  # Make the directory just in case it doesn't exist
45
48
  RUN mkdir -p /root/.local
46
49
 
47
- FROM public.ecr.aws/sam/build-python3.10@sha256:04cdbe84bec08d17d621192bc3f0a9e4a85a83f2ac99aa9241659dfac0d845ea
50
+ FROM public.ecr.aws/sam/build-python3.10@sha256:e78695db10ca8cb129e59e30f7dc9789b0dbd0181dba195d68419c72bac51ac1
48
51
 
49
52
  # Place executables in the environment at the front of the path and include other binaries
50
53
  ENV PATH="/app/.venv/bin:$PATH:/usr/sbin"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: awslabs.mysql-mcp-server
3
- Version: 0.0.1
3
+ Version: 1.0.1
4
4
  Summary: An AWS Labs Model Context Protocol (MCP) server for mysql
5
5
  Project-URL: homepage, https://awslabs.github.io/mcp/
6
6
  Project-URL: docs, https://awslabs.github.io/mcp/servers/mysql-mcp-server/
@@ -0,0 +1,16 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
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
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
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.
14
+
15
+ # This file is part of the awslabs namespace.
16
+ # It is intentionally minimal to support PEP 420 namespace packages.
@@ -0,0 +1,17 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
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
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
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.
14
+
15
+ """awslabs.mysql_mcp_server"""
16
+
17
+ __version__ = '0.0.1'
@@ -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
 
@@ -89,8 +92,6 @@ SYSTEM_REGEX = re.compile(
89
92
 
90
93
  # -- Suspicious pattern detection (SQL injection, stacked queries, etc.) --
91
94
  SUSPICIOUS_PATTERNS = [
92
- r'--.*$', # single-line comment
93
- r'/\*.*?\*/', # multi-line comment
94
95
  r"(?i)'.*?--", # comment injection
95
96
  r'(?i)\bor\b\s+\d+\s*=\s*\d+', # numeric tautology
96
97
  r"(?i)\bor\b\s*'[^']+'\s*=\s*'[^']+'", # string tautology
@@ -98,7 +99,7 @@ SUSPICIOUS_PATTERNS = [
98
99
  r'(?i)\bdrop\b', # DROP
99
100
  r'(?i)\btruncate\b', # TRUNCATE
100
101
  r'(?i)\bgrant\b|\brevoke\b', # GRANT or REVOKE
101
- r'(?i);', # stacked queries
102
+ r';\s*(?!($|\s*--|\s*/\*))(?=\S)', # stacked queries, excluding semicolons followed by comments or whitespace
102
103
  r'(?i)\bsleep\s*\(', # time-based injection
103
104
  r'(?i)\bload_file\s*\(', # file read
104
105
  r'(?i)\binto\s+outfile\b', # file write
@@ -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 mysql MCP Server implementation."""
13
16
 
@@ -313,8 +316,6 @@ def main():
313
316
  parser = argparse.ArgumentParser(
314
317
  description='An AWS Labs Model Context Protocol (MCP) server for MySQL'
315
318
  )
316
- parser.add_argument('--sse', action='store_true', help='Use SSE transport')
317
- parser.add_argument('--port', type=int, default=8888, help='Port to run the server on')
318
319
  parser.add_argument('--resource_arn', required=True, help='ARN of the RDS cluster')
319
320
  parser.add_argument(
320
321
  '--secret_arn',
@@ -362,12 +363,8 @@ def main():
362
363
  logger.success('Successfully validated RDS API db connection to MySQL')
363
364
 
364
365
  # Run server with appropriate transport
365
- if args.sse:
366
- mcp.settings.port = args.port
367
- mcp.run(transport='sse')
368
- else:
369
- logger.info('Starting MySQL MCP server')
370
- mcp.run()
366
+ logger.info('Starting MySQL MCP server')
367
+ mcp.run()
371
368
 
372
369
 
373
370
  if __name__ == '__main__':
@@ -0,0 +1,26 @@
1
+ #!/bin/sh
2
+
3
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ if [ "$(lsof +c 0 -p 1 | grep -e grep -e "^awslabs\..*\s1\s.*\unix\s.*socket$" | wc -l)" -ne "0" ]; then
18
+ echo -n "$(lsof +c 0 -p 1 | grep -e grep -e "^awslabs\..*\s1\s.*\unix\s.*socket$" | wc -l) awslabs.* streams found";
19
+ exit 0;
20
+ else
21
+ echo -n "Zero awslabs.* streams found";
22
+ exit 1;
23
+ fi;
24
+
25
+ echo -n "Never should reach here";
26
+ exit 99;
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "awslabs.mysql-mcp-server"
3
- version = "0.0.1"
3
+ version = "1.0.1"
4
4
  description = "An AWS Labs Model Context Protocol (MCP) server for mysql"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -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
  """Tests for the MySQL MCP Server."""
12
15
 
13
16
  import asyncio
@@ -30,8 +33,15 @@ from conftest import DummyCtx, Mock_DBConnection, MockException
30
33
 
31
34
 
32
35
  SAFE_READONLY_QUERIES = [
33
- # 1. Simple SELECT
36
+ # Basic SELECT Queries
37
+ # 1a. Simple SELECT
34
38
  'SELECT * FROM employees',
39
+ # 1b. Simple SELECT with trailing semicolon
40
+ 'SELECT * FROM employees;',
41
+ # 1c. Simple SELECT with trailing semicolon and comment
42
+ 'SELECT * FROM employees; -- This is a comment',
43
+ # 1d. Simple SELECT with trailing semicolon and multi line comment
44
+ 'SELECT * FROM employees; /* This is a comment */',
35
45
  # 2. SELECT with WHERE
36
46
  """SELECT first_name, last_name, salary
37
47
  FROM employees
@@ -1,13 +0,0 @@
1
- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
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
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- #
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.
11
-
12
- # This file is part of the awslabs namespace.
13
- # It is intentionally minimal to support PEP 420 namespace packages.
@@ -1,14 +0,0 @@
1
- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
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
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- #
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.
11
-
12
- """awslabs.mysql_mcp_server"""
13
-
14
- __version__ = '0.0.0'
@@ -1,12 +0,0 @@
1
- #!/bin/sh
2
-
3
- if [ "$(lsof +c 0 -p 1 | grep -e grep -e "^awslabs\..*\s1\s.*\unix\s.*socket$" | wc -l)" -ne "0" ]; then
4
- echo -n "$(lsof +c 0 -p 1 | grep -e grep -e "^awslabs\..*\s1\s.*\unix\s.*socket$" | wc -l) awslabs.* streams found";
5
- exit 0;
6
- else
7
- echo -n "Zero awslabs.* streams found";
8
- exit 1;
9
- fi;
10
-
11
- echo -n "Never should reach here";
12
- exit 99;