Skip to main content

An AWS Labs Model Context Protocol (MCP) server for Amazon ElastiCache Memcached

Project description

Amazon ElastiCache Memcached MCP Server

MCP server for interacting with Amazon ElastiCache Memcached through a secure and reliable connection

Features

Complete Memcached Protocol Support

  • Full support for all standard Memcached operations
  • Secure communication with SSL/TLS encryption
  • Automatic connection management and pooling
  • Built-in retry mechanism for failed operations
  • Readonly mode to prevent write operations

Readonly Mode

The server can be started in readonly mode, which prevents any write operations from being performed. This is useful for scenarios where you want to ensure that no data is modified, such as:

  • Read-only replicas
  • Production environments where writes should be restricted
  • Debugging and monitoring without risk of data modification

When readonly mode is enabled, any attempt to perform a write operation (set, add, replace, delete, etc.) will return an error message.

Prerequisites

  1. Install uv from Astral or the GitHub README
  2. Install Python using uv python install 3.10
  3. Access to a Memcached server.
  4. For instructions to connect to an Amazon ElastiCache Memcached cache click here

Installation

Cursor VS Code
Install MCP Server Install on VS Code

Here are some ways you can work with MCP (e.g. for Amazon Q Developer CLI MCP, ~/.aws/amazonq/mcp.json):

{
  "mcpServers": {
    "awslabs.memcached-mcp-server": {
      "command": "uvx",
      "args": ["awslabs.memcached-mcp-server@latest"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "MEMCACHED_HOST": "your-memcached-host",
        "MEMCACHED_PORT": "11211"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

To run in readonly mode:

{
  "mcpServers": {
    "awslabs.memcached-mcp-server": {
      "command": "uvx",
      "args": ["awslabs.memcached-mcp-server@latest", "--readonly"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "MEMCACHED_HOST": "your-memcached-host",
        "MEMCACHED_PORT": "11211"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Windows Installation

For Windows users, the MCP server configuration format is slightly different:

{
  "mcpServers": {
    "awslabs.memcached-mcp-server": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "uv",
      "args": [
        "tool",
        "run",
        "--from",
        "awslabs.memcached-mcp-server@latest",
        "awslabs.memcached-mcp-server.exe"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "MEMCACHED_HOST": "your-memcached-host",
        "MEMCACHED_PORT": "11211"
      },
    }
  }
}

To run in readonly mode:

{
  "mcpServers": {
    "awslabs.memcached-mcp-server": {
      "command": "uvx",
      "args": [
        "tool",
        "run",
        "--from",
        "awslabs.memcached-mcp-server@latest",
        "awslabs.memcached-mcp-server.exe",
        "--readonly"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "MEMCACHED_HOST": "your-memcached-host",
        "MEMCACHED_PORT": "11211"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

or docker after a successful docker build -t awslabs/memcached-mcp-server .:

{
  "mcpServers": {
    "awslabs.memcached-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "FASTMCP_LOG_LEVEL=ERROR",
        "--env",
        "MEMCACHED_HOST=your-memcached-host",
        "--env",
        "MEMCACHED_PORT=11211",
        "awslabs/memcached-mcp-server:latest"
      ],
      "env": {},
      "disabled": false,
      "autoApprove": []
    }
  }
}

To run in readonly mode with Docker:

{
  "mcpServers": {
    "awslabs.memcached-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "FASTMCP_LOG_LEVEL=ERROR",
        "--env",
        "MEMCACHED_HOST=your-memcached-host",
        "--env",
        "MEMCACHED_PORT=11211",
        "awslabs/memcached-mcp-server:latest",
        "--readonly"
      ],
      "env": {},
      "disabled": false,
      "autoApprove": []
    }
  }
}

Configuration

Basic Connection Settings

Configure the connection using these environment variables:

# Basic settings
MEMCACHED_HOST=127.0.0.1          # Memcached server hostname
MEMCACHED_PORT=11211              # Memcached server port
MEMCACHED_TIMEOUT=1              # Operation timeout in seconds
MEMCACHED_CONNECT_TIMEOUT=5      # Connection timeout in seconds
MEMCACHED_RETRY_TIMEOUT=1        # Retry delay in seconds
MEMCACHED_MAX_RETRIES=3         # Maximum number of retry attempts

SSL/TLS Configuration

Enable and configure SSL/TLS support with these variables:

# SSL/TLS settings
MEMCACHED_USE_TLS=true                           # Enable SSL/TLS
MEMCACHED_TLS_CERT_PATH=/path/to/client-cert.pem # Client certificate
MEMCACHED_TLS_KEY_PATH=/path/to/client-key.pem   # Client private key
MEMCACHED_TLS_CA_CERT_PATH=/path/to/ca-cert.pem  # CA certificate
MEMCACHED_TLS_VERIFY=true                        # Enable cert verification

The server automatically handles:

  • Connection establishment and management
  • SSL/TLS encryption when enabled
  • Automatic retrying of failed operations
  • Timeout enforcement and error handling

Development

Running Tests

uv venv
source .venv/bin/activate
uv sync
uv run --frozen pytest

Building Docker Image

docker build -t awslabs/memcached-mcp-server .

Running Docker Container

docker run -p 8080:8080 \
  -e MEMCACHED_HOST=host.docker.internal \
  -e MEMCACHED_PORT=11211 \
  awslabs/memcached-mcp-server

To run in readonly mode:

docker run -p 8080:8080 \
  -e MEMCACHED_HOST=host.docker.internal \
  -e MEMCACHED_PORT=11211 \
  awslabs/memcached-mcp-server --readonly

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

awslabs_memcached_mcp_server-1.0.9.tar.gz (82.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

awslabs_memcached_mcp_server-1.0.9-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file awslabs_memcached_mcp_server-1.0.9.tar.gz.

File metadata

File hashes

Hashes for awslabs_memcached_mcp_server-1.0.9.tar.gz
Algorithm Hash digest
SHA256 fadfb7a7234f428558cedb4513cdc2b655f2115e0d7aff17c4728d940251a4ce
MD5 b5106921ecd62b359c5274751e7014d6
BLAKE2b-256 8dc3141b0538edab57447491d689f20ca17ed0605557cf10b3be2bbefcc1161f

See more details on using hashes here.

Provenance

The following attestation bundles were made for awslabs_memcached_mcp_server-1.0.9.tar.gz:

Publisher: release.yml on awslabs/mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file awslabs_memcached_mcp_server-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for awslabs_memcached_mcp_server-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ad96bbb0ff26e4af3b8f174672c074932a7179d32057ec0cfefb6993d74338ae
MD5 f7562c08975ddd6d7387af3cbbf04769
BLAKE2b-256 02edda2e3c0e0e6b41db7b2a0de9f3568e99300daa3b1ab6f93f15c4ab50ff12

See more details on using hashes here.

Provenance

The following attestation bundles were made for awslabs_memcached_mcp_server-1.0.9-py3-none-any.whl:

Publisher: release.yml on awslabs/mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page