awslabs.memcached-mcp-server 0.1.2__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.
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/Dockerfile +11 -8
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/ELASTICACHECONNECT.md +4 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/PKG-INFO +1 -1
- awslabs_memcached_mcp_server-1.0.1/awslabs/__init__.py +16 -0
- awslabs_memcached_mcp_server-1.0.1/awslabs/memcached_mcp_server/__init__.py +17 -0
- awslabs_memcached_mcp_server-1.0.1/awslabs/memcached_mcp_server/common/config.py +21 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/awslabs/memcached_mcp_server/common/connection.py +14 -0
- awslabs_memcached_mcp_server-1.0.1/awslabs/memcached_mcp_server/common/server.py +28 -0
- awslabs_memcached_mcp_server-1.0.1/awslabs/memcached_mcp_server/main.py +49 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/awslabs/memcached_mcp_server/tools/cache.py +14 -0
- awslabs_memcached_mcp_server-1.0.1/docker-healthcheck.sh +26 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/pyproject.toml +1 -1
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_init.py +9 -6
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_main.py +9 -23
- awslabs_memcached_mcp_server-0.1.2/awslabs/__init__.py +0 -13
- awslabs_memcached_mcp_server-0.1.2/awslabs/memcached_mcp_server/__init__.py +0 -14
- awslabs_memcached_mcp_server-0.1.2/awslabs/memcached_mcp_server/common/config.py +0 -7
- awslabs_memcached_mcp_server-0.1.2/awslabs/memcached_mcp_server/common/server.py +0 -14
- awslabs_memcached_mcp_server-0.1.2/awslabs/memcached_mcp_server/main.py +0 -67
- awslabs_memcached_mcp_server-0.1.2/docker-healthcheck.sh +0 -12
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/.gitignore +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/.pre-commit-config.yaml +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/.python-version +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/CHANGELOG.md +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/LICENSE +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/NOTICE +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/README.md +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_cache.py +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_connection.py +0 -0
- {awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/uv.lock +0 -0
|
@@ -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")
|
|
4
|
-
#
|
|
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
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
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:
|
|
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:
|
|
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"
|
{awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/ELASTICACHECONNECT.md
RENAMED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# How to connect to an Amazon ElastiCache Memcached cache
|
|
2
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
|
+
|
|
3
7
|
## Launch and configure the EC2 instance
|
|
4
8
|
|
|
5
9
|
Complete the following steps:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: awslabs.memcached-mcp-server
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 1.0.1
|
|
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/
|
|
@@ -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.memcached-mcp-server"""
|
|
16
|
+
|
|
17
|
+
__version__ = '0.1.0'
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
"""Configuration for Memcached MCP Server."""
|
|
16
|
+
|
|
17
|
+
from dotenv import load_dotenv
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Load environment variables from .env file if present
|
|
21
|
+
load_dotenv()
|
|
@@ -1,3 +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
|
+
|
|
1
15
|
"""Connection management for Memcached MCP Server."""
|
|
2
16
|
|
|
3
17
|
import os
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
"""Server initialization for Memcached MCP Server."""
|
|
16
|
+
|
|
17
|
+
from mcp.server.fastmcp import FastMCP
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Create MCP server instance
|
|
21
|
+
mcp = FastMCP(
|
|
22
|
+
'awslabs.memcached-mcp-server',
|
|
23
|
+
instructions='Instructions for using this memcached MCP server. This can be used by clients to improve the LLM'
|
|
24
|
+
's understanding of available tools, resources, etc. It can be thought of like a '
|
|
25
|
+
'hint'
|
|
26
|
+
' to the model. For example, this information MAY be added to the system prompt. Important to be clear, direct, and detailed.',
|
|
27
|
+
dependencies=['pydantic', 'loguru', 'pymemcache', 'dotenv'],
|
|
28
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
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 memcached MCP Server implementation."""
|
|
16
|
+
|
|
17
|
+
from awslabs.memcached_mcp_server.common.server import mcp
|
|
18
|
+
from awslabs.memcached_mcp_server.tools import cache # noqa: F401
|
|
19
|
+
from loguru import logger
|
|
20
|
+
from starlette.requests import Request # noqa: F401
|
|
21
|
+
from starlette.responses import Response
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Add a health check route directly to the MCP server
|
|
25
|
+
@mcp.custom_route('/health', methods=['GET'])
|
|
26
|
+
async def health_check(request):
|
|
27
|
+
"""Simple health check endpoint for ALB Target Group.
|
|
28
|
+
|
|
29
|
+
Always returns 200 OK to indicate the service is running.
|
|
30
|
+
"""
|
|
31
|
+
return Response(content='healthy', status_code=200, media_type='text/plain')
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class MemcachedMCPServer:
|
|
35
|
+
"""Memcached MCP Server wrapper."""
|
|
36
|
+
|
|
37
|
+
def run(self):
|
|
38
|
+
"""Run server with appropriate transport."""
|
|
39
|
+
mcp.run()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def main():
|
|
43
|
+
"""Run the MCP server with CLI argument support."""
|
|
44
|
+
logger.info('Amazon ElastiCache Memcached MCP Server Started...')
|
|
45
|
+
MemcachedMCPServer().run()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == '__main__':
|
|
49
|
+
main()
|
|
@@ -1,3 +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
|
+
|
|
1
15
|
"""Cache operations for Memcached MCP Server."""
|
|
2
16
|
|
|
3
17
|
from awslabs.memcached_mcp_server.common.connection import MemcachedConnectionManager
|
|
@@ -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;
|
{awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_init.py
RENAMED
|
@@ -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")
|
|
4
|
-
#
|
|
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
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
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 awslabs.memcached-mcp-server package."""
|
|
12
15
|
|
|
13
16
|
import importlib
|
{awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_main.py
RENAMED
|
@@ -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")
|
|
4
|
-
#
|
|
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
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
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 main function in server.py."""
|
|
12
15
|
|
|
13
16
|
from awslabs.memcached_mcp_server.main import main
|
|
@@ -26,23 +29,6 @@ class TestMain:
|
|
|
26
29
|
|
|
27
30
|
# Check that mcp.run was called with the correct arguments
|
|
28
31
|
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
32
|
|
|
47
33
|
def test_module_execution(self):
|
|
48
34
|
"""Test the module execution when run as __main__."""
|
|
@@ -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.memcached-mcp-server"""
|
|
13
|
-
|
|
14
|
-
__version__ = '0.1.0'
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"""Server initialization for Memcached MCP Server."""
|
|
2
|
-
|
|
3
|
-
from mcp.server.fastmcp import FastMCP
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# Create MCP server instance
|
|
7
|
-
mcp = FastMCP(
|
|
8
|
-
'awslabs.memcached-mcp-server',
|
|
9
|
-
instructions='Instructions for using this memcached MCP server. This can be used by clients to improve the LLM'
|
|
10
|
-
's understanding of available tools, resources, etc. It can be thought of like a '
|
|
11
|
-
'hint'
|
|
12
|
-
' to the model. For example, this information MAY be added to the system prompt. Important to be clear, direct, and detailed.',
|
|
13
|
-
dependencies=['pydantic', 'loguru', 'pymemcache', 'dotenv'],
|
|
14
|
-
)
|
|
@@ -1,67 +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 memcached MCP Server implementation."""
|
|
13
|
-
|
|
14
|
-
import argparse
|
|
15
|
-
from awslabs.memcached_mcp_server.common.server import mcp
|
|
16
|
-
from awslabs.memcached_mcp_server.tools import cache # noqa: F401
|
|
17
|
-
from loguru import logger
|
|
18
|
-
from starlette.requests import Request # noqa: F401
|
|
19
|
-
from starlette.responses import Response
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# Add a health check route directly to the MCP server
|
|
23
|
-
@mcp.custom_route('/health', methods=['GET'])
|
|
24
|
-
async def health_check(request):
|
|
25
|
-
"""Simple health check endpoint for ALB Target Group.
|
|
26
|
-
|
|
27
|
-
Always returns 200 OK to indicate the service is running.
|
|
28
|
-
"""
|
|
29
|
-
return Response(content='healthy', status_code=200, media_type='text/plain')
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class MemcachedMCPServer:
|
|
33
|
-
"""Memcached MCP Server wrapper."""
|
|
34
|
-
|
|
35
|
-
def __init__(self, sse=False, port=None):
|
|
36
|
-
"""Initialize MCP Server wrapper."""
|
|
37
|
-
self.sse = sse
|
|
38
|
-
self.port = port
|
|
39
|
-
|
|
40
|
-
def run(self):
|
|
41
|
-
"""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()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def main():
|
|
50
|
-
"""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
|
-
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()
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if __name__ == '__main__':
|
|
67
|
-
main()
|
|
@@ -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;
|
|
File without changes
|
{awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/.pre-commit-config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_cache.py
RENAMED
|
File without changes
|
{awslabs_memcached_mcp_server-0.1.2 → awslabs_memcached_mcp_server-1.0.1}/tests/test_connection.py
RENAMED
|
File without changes
|
|
File without changes
|