awslabs.memcached-mcp-server 0.1.1__tar.gz → 1.0.0__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 (24) hide show
  1. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/Dockerfile +2 -2
  2. awslabs_memcached_mcp_server-1.0.0/ELASTICACHECONNECT.md +97 -0
  3. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/PKG-INFO +28 -19
  4. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/README.md +27 -18
  5. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/awslabs/memcached_mcp_server/main.py +2 -23
  6. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/pyproject.toml +2 -2
  7. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/tests/test_main.py +0 -17
  8. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/.gitignore +0 -0
  9. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/.pre-commit-config.yaml +0 -0
  10. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/.python-version +0 -0
  11. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/CHANGELOG.md +0 -0
  12. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/LICENSE +0 -0
  13. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/NOTICE +0 -0
  14. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/awslabs/__init__.py +0 -0
  15. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/awslabs/memcached_mcp_server/__init__.py +0 -0
  16. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/awslabs/memcached_mcp_server/common/config.py +0 -0
  17. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/awslabs/memcached_mcp_server/common/connection.py +0 -0
  18. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/awslabs/memcached_mcp_server/common/server.py +0 -0
  19. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/awslabs/memcached_mcp_server/tools/cache.py +0 -0
  20. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/docker-healthcheck.sh +0 -0
  21. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/tests/test_cache.py +0 -0
  22. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/tests/test_connection.py +0 -0
  23. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/tests/test_init.py +0 -0
  24. {awslabs_memcached_mcp_server-0.1.1 → awslabs_memcached_mcp_server-1.0.0}/uv.lock +0 -0
@@ -10,7 +10,7 @@
10
10
  # and limitations under the License.
11
11
 
12
12
  #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
13
+ FROM public.ecr.aws/sam/build-python3.10@sha256:e78695db10ca8cb129e59e30f7dc9789b0dbd0181dba195d68419c72bac51ac1 AS uv
14
14
 
15
15
  # Install the project into `/app`
16
16
  WORKDIR /app
@@ -44,7 +44,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
44
44
  # Make the directory just in case it doesn't exist
45
45
  RUN mkdir -p /root/.local
46
46
 
47
- FROM public.ecr.aws/sam/build-python3.10@sha256:04cdbe84bec08d17d621192bc3f0a9e4a85a83f2ac99aa9241659dfac0d845ea
47
+ FROM public.ecr.aws/sam/build-python3.10@sha256:e78695db10ca8cb129e59e30f7dc9789b0dbd0181dba195d68419c72bac51ac1
48
48
 
49
49
  # Place executables in the environment at the front of the path and include other binaries
50
50
  ENV PATH="/app/.venv/bin:$PATH:/usr/sbin"
@@ -0,0 +1,97 @@
1
+ # How to connect to an Amazon ElastiCache Memcached cache
2
+
3
+ Your Amazon ElastiCache instances are designed to be accessed through an Amazon EC2 instance. You can access your ElastiCache instance from an Amazon EC2 instance in the same Amazon VPC, or by using VPC peering, you can access your ElastiCache instance from an Amazon EC2 in a different Amazon VPC.
4
+
5
+ The following instructions will help you create an EC2 instance in the same VPC as your cache instance, and will guide you to configure the security groups required to access the cache from your desktop through an SSH tunnel.
6
+
7
+ ## Launch and configure the EC2 instance
8
+
9
+ Complete the following steps:
10
+
11
+ 1. Open the Amazon EC2 console, and then choose Launch instance.
12
+ 2. Select an Amazon Machine Image (AMI).
13
+ 3. Choose an instance type, and then choose Next: Configure Instance Details.
14
+ 4. For Network, choose the VPC that the Amazon ElastiCache Valkey cache uses.
15
+ 5. For Subnet, select the private subnet in the VPC
16
+ 6. Choose Next: Add Storage, and then modify the storage as needed.
17
+ 7. Choose Next: Add Tags, and then add tags as needed.
18
+ 8. Choose Next: Configure Security Group.
19
+ 9. Choose Add Rule, and then enter the following:
20
+ * For Type, enter Custom TCP Rule
21
+ * For Protocol, enter TCP
22
+ * For Port Range, enter 22
23
+ * For Source, enter the security group used by your Amazon EC2 connect endpoint.
24
+ 10. Choose Review and Launch, and then choose Launch.
25
+
26
+ ## Configure the Amazon ElastiCache Memcached Cache’s security groups
27
+
28
+ Complete the following steps:
29
+
30
+ 1. Open the Amazon ElastiCache console.
31
+ 2. In the navigation pane, choose Resources → Memcached caches.
32
+ 3. Choose the name of the Amazon Memcached Cache. If you don't already have one, then create it.
33
+ 4. Choose Connectivity & security.
34
+ 5. From the Security section, choose the link under VPC security groups.
35
+ 6. Select the security group, choose Actions, and then choose Edit inbound rules.
36
+ 7. Choose Add rule, and then enter the following:
37
+ - For Type, enter Custom TCP Rule
38
+ - For Protocol, enter TCP
39
+ - For Port Range, enter the port of your Amazon ElastiCache Memcached cache (11211).
40
+ - For Source, enter the private IP address of your EC2 instance.
41
+ 8. Choose Save.
42
+
43
+ This configuration for the security group allows traffic from the EC2 instance's private IP address. If the EC2 instance and the Amazon ElastiCache Memcached cache use the same VPC, then you don't need to modify the Amazon ElastiCache Memcached cache route table. If the VPC is different, then create a VPC peering connection to allow connections between those VPCs.
44
+ Note: If you use a more scalable solution, then review your configuration. For example, if you use the security group ID in a security group rule, then make sure that it doesn't restrict access to one instance. Instead, configure the rule to restrict access to any resource that uses the specific security group ID.
45
+
46
+ ## Create an EC2 instance connect endpoint
47
+
48
+ 1. Open the Amazon VPC console.
49
+ 2. In the navigation pane, choose Endpoints.
50
+ 3. Choose Create endpoint, and then specify the endpoint settings.
51
+ * (Optional) For Name tag, enter a name for the endpoint.
52
+ * For Service category, choose EC2 Instance Connect Endpoint.
53
+ * For VPC, select the VPC that has the target instances.
54
+ * (Optional) To preserve client IP addresses, expand Additional settings and select the check box. Otherwise, the default is to use the endpoint network interface as the client IP address.
55
+ * For Security groups, select the security group you want to associate with the endpoint. Otherwise, the default is to use the default security group for the VPC.
56
+ * For Subnet, select the subnet in which to create the endpoint.
57
+ * (Optional) To add a tag, choose Add new tag and enter the tag key and the tag value.
58
+ 4. Review your settings and then choose Create endpoint.
59
+ 5. The initial status of the endpoint is Pending. To connect to an instance, you must wait until the endpoint status is Available. This can take up to a few minutes.
60
+
61
+ ## Connect to the ElastiCache Memcached cache from your local machine
62
+
63
+ **Note**: You must have access to the AWS CLI.
64
+
65
+ To connect from your local MCP Server to a private Amazon ElastiCache Memcached cache through an SSH tunnel, complete the following steps:
66
+ Linux or macOS
67
+ Run the following command to open a tunnel from local machine to the EC2 instance:
68
+
69
+ ```
70
+ aws ec2-instance-connect open-tunnel --instance-id ec2-instance-ID --local-port 11211
71
+ ```
72
+
73
+ **Note**: Replace ec2-instance-ID with your EC2 instance ID.
74
+
75
+ Open a second connection and run the following command to create an SSH tunnel from your local host to your ElastiCache Valkey Cache through an EC2 instance:
76
+
77
+ ```
78
+ ssh -i YOUR_EC2_KEY EC2_USER@EC2_HOST -p EC2_TUNNEL_PORT -L LOCAL_PORT:ELASTICACHE_ENDPOINT:REMOTE_PORT -N -f
79
+ ```
80
+
81
+ **Note**: Replace the following values:
82
+ * **YOUR_EC2_KEY** with the path to your EC2 private key file
83
+ * **EC2_USER** with your EC2 instance username
84
+ * **EC2_HOST** with the hostname of your EC2 instance
85
+ * **EC2_TUNNEL_PORT** with the port you configured
86
+ * **LOCAL_PORT** with an unused port on your local machine (11211)
87
+ * **ELASTICACHE_ENDPOINT** with the endpoint of your ElastiCache Memcached cache
88
+ * **REMOTE_PORT** with the port that your Amazon ElastiCache Memcached cache uses (11211)
89
+
90
+ Use a third connection and run the following command to verify connection to your Amazon ElastiCache Memcached cache from your local machine:
91
+
92
+ ```
93
+ telnet 127.0.0.1 LOCAL_PORT
94
+ ```
95
+
96
+ **Note**: Replace the following values:
97
+ * **LOCAL_PORT** with the number of your local port (11211)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: awslabs.memcached-mcp-server
3
- Version: 0.1.1
3
+ Version: 1.0.0
4
4
  Summary: An AWS Labs Model Context Protocol (MCP) server for Amazon ElastiCache Memcached
5
5
  Project-URL: homepage, https://awslabs.github.io/mcp/
6
6
  Project-URL: docs, https://awslabs.github.io/mcp/servers/memcached-mcp-server/
@@ -28,7 +28,7 @@ Requires-Dist: pymemcache>=4.0.0
28
28
  Requires-Dist: python-dotenv>=0.9.9
29
29
  Description-Content-Type: text/markdown
30
30
 
31
- # Memcached MCP Server
31
+ # Amazon ElastiCache Memcached MCP Server
32
32
 
33
33
  MCP server for interacting with Amazon ElastiCache Memcached through a secure and reliable connection
34
34
 
@@ -41,27 +41,13 @@ MCP server for interacting with Amazon ElastiCache Memcached through a secure an
41
41
  - Automatic connection management and pooling
42
42
  - Built-in retry mechanism for failed operations
43
43
 
44
- ### Robust Connection Management
45
-
46
- - Configurable connection settings and timeouts
47
- - Automatic connection retrying with customizable parameters
48
- - Connection pooling for improved performance
49
- - Comprehensive error handling and recovery
50
-
51
- ### Security and Reliability
52
-
53
- - SSL/TLS support for encrypted communication
54
- - Certificate-based authentication
55
- - Configurable verification settings
56
- - Automatic handling of connection failures
57
-
58
44
  ## Prerequisites
59
45
 
60
46
  1. Install `uv` from [Astral](https://docs.astral.sh/uv/getting-started/installation/) or the [GitHub README](https://github.com/astral-sh/uv#installation)
61
47
  2. Install Python using `uv python install 3.10`
62
- 3. Access to a Memcached server (local or Amazon ElastiCache)
63
- - For Amazon ElastiCache, you need appropriate AWS credentials and permissions
64
- - For local development, ensure Memcached is installed and running
48
+ 3. Access to a Memcached server.
49
+ 4. For instructions to connect to an Amazon ElastiCache Memcached cache [click here](https://github.com/awslabs/mcp/blob/main/src/memcached-mcp-server/ELASTICACHECONNECT.md)
50
+
65
51
 
66
52
  ## Installation
67
53
 
@@ -146,3 +132,26 @@ The server automatically handles:
146
132
  - SSL/TLS encryption when enabled
147
133
  - Automatic retrying of failed operations
148
134
  - Timeout enforcement and error handling
135
+
136
+ ## Development
137
+
138
+ ### Running Tests
139
+ ```bash
140
+ uv venv
141
+ source .venv/bin/activate
142
+ uv sync
143
+ uv run --frozen pytest
144
+ ```
145
+
146
+ ### Building Docker Image
147
+ ```bash
148
+ docker build -t awslabs/memcached-mcp-server .
149
+ ```
150
+
151
+ ### Running Docker Container
152
+ ```bash
153
+ docker run -p 8080:8080 \
154
+ -e MEMCACHED_HOST=host.docker.internal \
155
+ -e MEMCACHED_PORT=11211 \
156
+ awslabs/memcached-mcp-server
157
+ ```
@@ -1,4 +1,4 @@
1
- # Memcached MCP Server
1
+ # Amazon ElastiCache Memcached MCP Server
2
2
 
3
3
  MCP server for interacting with Amazon ElastiCache Memcached through a secure and reliable connection
4
4
 
@@ -11,27 +11,13 @@ MCP server for interacting with Amazon ElastiCache Memcached through a secure an
11
11
  - Automatic connection management and pooling
12
12
  - Built-in retry mechanism for failed operations
13
13
 
14
- ### Robust Connection Management
15
-
16
- - Configurable connection settings and timeouts
17
- - Automatic connection retrying with customizable parameters
18
- - Connection pooling for improved performance
19
- - Comprehensive error handling and recovery
20
-
21
- ### Security and Reliability
22
-
23
- - SSL/TLS support for encrypted communication
24
- - Certificate-based authentication
25
- - Configurable verification settings
26
- - Automatic handling of connection failures
27
-
28
14
  ## Prerequisites
29
15
 
30
16
  1. Install `uv` from [Astral](https://docs.astral.sh/uv/getting-started/installation/) or the [GitHub README](https://github.com/astral-sh/uv#installation)
31
17
  2. Install Python using `uv python install 3.10`
32
- 3. Access to a Memcached server (local or Amazon ElastiCache)
33
- - For Amazon ElastiCache, you need appropriate AWS credentials and permissions
34
- - For local development, ensure Memcached is installed and running
18
+ 3. Access to a Memcached server.
19
+ 4. For instructions to connect to an Amazon ElastiCache Memcached cache [click here](https://github.com/awslabs/mcp/blob/main/src/memcached-mcp-server/ELASTICACHECONNECT.md)
20
+
35
21
 
36
22
  ## Installation
37
23
 
@@ -116,3 +102,26 @@ The server automatically handles:
116
102
  - SSL/TLS encryption when enabled
117
103
  - Automatic retrying of failed operations
118
104
  - Timeout enforcement and error handling
105
+
106
+ ## Development
107
+
108
+ ### Running Tests
109
+ ```bash
110
+ uv venv
111
+ source .venv/bin/activate
112
+ uv sync
113
+ uv run --frozen pytest
114
+ ```
115
+
116
+ ### Building Docker Image
117
+ ```bash
118
+ docker build -t awslabs/memcached-mcp-server .
119
+ ```
120
+
121
+ ### Running Docker Container
122
+ ```bash
123
+ docker run -p 8080:8080 \
124
+ -e MEMCACHED_HOST=host.docker.internal \
125
+ -e MEMCACHED_PORT=11211 \
126
+ awslabs/memcached-mcp-server
127
+ ```
@@ -11,7 +11,6 @@
11
11
 
12
12
  """awslabs memcached MCP Server implementation."""
13
13
 
14
- import argparse
15
14
  from awslabs.memcached_mcp_server.common.server import mcp
16
15
  from awslabs.memcached_mcp_server.tools import cache # noqa: F401
17
16
  from loguru import logger
@@ -32,35 +31,15 @@ async def health_check(request):
32
31
  class MemcachedMCPServer:
33
32
  """Memcached MCP Server wrapper."""
34
33
 
35
- def __init__(self, sse=False, port=None):
36
- """Initialize MCP Server wrapper."""
37
- self.sse = sse
38
- self.port = port
39
-
40
34
  def run(self):
41
35
  """Run server with appropriate transport."""
42
- if self.sse:
43
- mcp.settings.port = int(self.port) if self.port is not None else 8888
44
- mcp.run(transport='sse')
45
- else:
46
- mcp.run()
36
+ mcp.run()
47
37
 
48
38
 
49
39
  def main():
50
40
  """Run the MCP server with CLI argument support."""
51
- parser = argparse.ArgumentParser(
52
- description='An AWS Labs Model Context Protocol (MCP) server for Amazon ElastiCache Memcached'
53
- )
54
- parser.add_argument('--sse', action='store_true', help='Use SSE transport')
55
- parser.add_argument('--port', type=int, default=8888, help='Port to run the server on')
56
-
57
- args = parser.parse_args()
58
-
59
41
  logger.info('Amazon ElastiCache Memcached MCP Server Started...')
60
-
61
- # Run server with appropriate transport
62
- server = MemcachedMCPServer(args.sse, args.port)
63
- server.run()
42
+ MemcachedMCPServer().run()
64
43
 
65
44
 
66
45
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "awslabs.memcached-mcp-server"
3
- version = "0.1.1"
3
+ version = "1.0.0"
4
4
  description = "An AWS Labs Model Context Protocol (MCP) server for Amazon ElastiCache Memcached"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -37,7 +37,7 @@ repository = "https://github.com/awslabs/mcp.git"
37
37
  changelog = "https://github.com/awslabs/mcp/blob/main/src/memcached-mcp-server/CHANGELOG.md"
38
38
 
39
39
  [project.scripts]
40
- "awslabs.memcached-mcp-server" = "awslabs.memcached_mcp_server.server:main"
40
+ "awslabs.memcached-mcp-server" = "awslabs.memcached_mcp_server.main:main"
41
41
 
42
42
  [dependency-groups]
43
43
  dev = [
@@ -26,23 +26,6 @@ class TestMain:
26
26
 
27
27
  # Check that mcp.run was called with the correct arguments
28
28
  mock_run.assert_called_once()
29
- assert mock_run.call_args[1].get('transport') is None
30
-
31
- @patch('awslabs.memcached_mcp_server.common.server.mcp.run')
32
- @patch('sys.argv', ['awslabs.memcached-mcp-server', '--sse', '--port', '9999'])
33
- def test_main_sse(self, mock_run):
34
- """Test main function with SSE transport."""
35
- # Call the main function
36
- main()
37
-
38
- # Check that mcp.run was called with the correct arguments
39
- mock_run.assert_called_once()
40
- assert mock_run.call_args[1].get('transport') == 'sse'
41
-
42
- # Check that the port was set correctly
43
- from awslabs.memcached_mcp_server.main import mcp
44
-
45
- assert mcp.settings.port == 9999
46
29
 
47
30
  def test_module_execution(self):
48
31
  """Test the module execution when run as __main__."""