Connect to Memorystore for Redis from AI applications by using the remote MCP server

This document shows you how to use the Memorystore for Redis remote Model Context Protocol (MCP) server to connect with AI applications including Gemini CLI, ChatGPT, Claude, and custom applications you are developing. The Memorystore for Redis remote MCP server lets you manage Memorystore for Redis instances from your AI-enabled development environments and AI agent platforms.

The Memorystore for Redis remote MCP server is enabled when you enable the Memorystore for Redis API.

Model Context Protocol (MCP) standardizes how large language models (LLMs) and AI applications or agents connect to external data sources. MCP servers let you use their tools, resources, and prompts to take actions and get updated data from their backend service.

What's the difference between local and remote MCP servers?

Local MCP servers
Typically run on your local machine and use the standard input and output streams (stdio) for communication between services on the same device.
Remote MCP servers
Run on the service's infrastructure and offer an HTTP endpoint to AI applications for communication between the AI MCP client and the MCP server. For more information about MCP architecture, see MCP architecture.

Google and Google Cloud remote MCP servers

Google and Google Cloud remote MCP servers have the following features and benefits:

  • Simplified, centralized discovery.
  • Managed global or regional HTTP endpoints.
  • Fine-grained authorization.
  • Optional prompt and response security with Model Armor protection.
  • Centralized audit logging.

For information about other MCP servers and information about security and governance controls available for Google Cloud MCP servers, see Google Cloud MCP servers overview.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  4. Enable the Memorystore for Redis API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  5. Install the Google Cloud CLI.

  6. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  7. To initialize the gcloud CLI, run the following command:

    gcloud init
  8. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  9. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  10. Enable the Memorystore for Redis API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  11. Install the Google Cloud CLI.

  12. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  13. To initialize the gcloud CLI, run the following command:

    gcloud init

Required roles

To get the permissions that you need to use the Memorystore for Redis MCP server, ask your administrator to grant you the following IAM roles on the project where you want to use the Memorystore for Redis MCP server:

For more information about granting roles, see Manage access to projects, folders, and organizations.

These predefined roles contain the permissions required to use the Memorystore for Redis MCP server. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to use the Memorystore for Redis MCP server:

  • Get information about a service usage policy: serviceusage.mcppolicy.get
  • Update a service usage policy: serviceusage.mcppolicy.update
  • Make MCP tool calls: mcp.tools.call
  • Create a Memorystore for Redis instance: redis.instances.create
  • List Memorystore for Redis instances: redis.instances.list
  • Get information about a Memorystore for Redis instance: redis.instances.get
  • Update a Memorystore for Redis instance: redis.instances.update
  • Import data into a Memorystore for Redis instance: redis.instances.import
  • Export data from a Memorystore for Redis instance: redis.instances.export
  • Delete a Memorystore for Redis instance: redis.instances.delete

You might also be able to get these permissions with custom roles or other predefined roles.

Authentication and authorization

Memorystore for Redis MCP servers use the OAuth 2.0 protocol with Identity and Access Management (IAM) for authentication and authorization. All Google Cloud identities are supported for authentication to MCP servers.

The Memorystore for Redis remote MCP server accepts API keys.

We recommend creating a separate identity for agents using MCP tools so that access to resources can be controlled and monitored. For more information on authentication, see Authenticate to Google and Google Cloud MCP servers.

Memorystore for Redis MCP OAuth scope

OAuth 2.0 uses a scope and credentials to determine if an authenticated principal is authorized to take a specific action on a resource. For more information about OAuth 2.0 scopes at Google, read Using OAuth 2.0 to access Google APIs.

Memorystore for Redis has the following MCP tool OAuth scope:

Scope URI Description
https://www.googleapis.com/auth/redis.read-write Create, list, export data from, update, import data into, and delete instances.

Configure an MCP client to use the Memorystore for Redis MCP server

AI applications and agents, such as Claude or Gemini CLI, can instantiate an MCP client that connects to a single MCP server. An AI application can have multiple clients that connect to different MCP servers. To connect to a remote MCP server, the MCP client must know at a minimum the URL of the remote MCP server.

In your AI application, look for a way to connect to a remote MCP server. You're prompted to enter details about the server, such as its name and URL.

For the Memorystore for Redis MCP server, enter the following as required:

  • Server name: Memorystore for Redis MCP server
  • Server URL or Endpoint: https://redis.googleapis.com/mcp
  • Transport: HTTP
  • Authentication details: Depending on how you want to authenticate, you can enter your Google Cloud credentials, your OAuth Client ID and secret, or an agent identity and credentials. For more information on authentication, see Authenticate to Google and Google Cloud MCP servers.
  • OAuth scope: the OAuth 2.0 scope that you want to use when connecting to the Memorystore for Redis MCP server.

For host specific guidance, see the following:

For more general guidance, see the following resources:

Available tools

To view details of available MCP tools and their descriptions for the Memorystore for Redis MCP server, see the Memorystore for Redis MCP reference.

List tools

Use the MCP Inspector to list tools, or send a tools/list HTTP request directly to the Memorystore for Redis remote MCP server. The tools/list method doesn't require authentication.

POST /mcp HTTP/1.1
Host: redis.googleapis.com
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "method": "tools/list",
}

Sample use cases

The following are sample use cases for the Memorystore for Redis MCP server:

"Why do you create a Memorystore for Redis instance with authentication enabled?"

By creating an instance and enabling the AUTH feature for it, incoming client connections must authenticate to connect to the instance. To connect, the client sends the AUTH command and an AUTH string, which is a randomly generated string that's unique for the instance. The AI agent of the Memorystore for Redis MCP server uses the create_instance MCP tool to create the instance.

"Why do you view all active Memorystore for Redis instances in a specific region?"

By listing these instances, you can ensure that resources match your current architecture. The AI agent of the Memorystore for Redis MCP server uses the list_instances MCP tool to retrieve a formatted list of instances in the specified region.

"Why do you retrieve connection endpoints and operational metadata from a Memorystore for Redis instance in a specific region?"

You need this information for application integration and system maintenance. The AI agent of the Memorystore for Redis MCP server uses the get_instance MCP tool to retrieve information about the instance, such as its discovery endpoint and replica count.

"How can you optimize Memorystore for Redis for your data-intensive applications?"

To increase both the CPU capacity and the memory throughput for these applications significantly, you can scale a Memorystore for Redis instance by increasing the instance's replica count. The AI agent of the Memorystore for Redis MCP server uses the update_instance MCP tool to update the replica count for the instance.

"How can you protect your data from failures that might occur from either a Memorystore for Redis instance or the region where it's located?"

Export a snapshot of the data in your instance to a Cloud Storage bucket. If a regional or instance failure occurs, then you can restore your data to a new instance to resume operations. The AI agent of the Memorystore for Redis MCP server uses the export_instance MCP tool to export your data.

Optional security and safety configurations

Because of the wide variety of actions that you can take with MCP tools, MCP introduces new security risks and considerations. To minimize and manage these risks, Google Cloud offers defaults and customizable policies to control the use of MCP tools in your Google Cloud organization or project.

For more information about MCP security and governance, see AI security and safety.

Model Armor

Model Armor is a Google Cloud service designed to enhance the security and safety of your AI applications. It works by proactively screening LLM prompts and responses, protecting against various risks and supporting responsible AI practices. Whether you're deploying AI in your cloud environment or on external cloud providers, Model Armor can help you prevent malicious input, verify content safety, protect sensitive data, maintain compliance, and enforce your AI safety and security policies consistently across your diverse AI landscape.

Model Armor is available in specific regional locations. If you enable Model Armor for a project, and a call to that project comes from an unsupported region, then Model Armor makes a cross-regional call. For more information, see Model Armor locations.

Enable Model Armor

You must enable Model Armor APIs before you can use Model Armor.

Console

  1. Enable the Model Armor API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  2. Select the project where you want to activate Model Armor.

gcloud

Before you begin, follow these steps using the Google Cloud CLI with the Model Armor API:

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. Run the following command to set the API endpoint for the Model Armor service.

    gcloud config set api_endpoint_overrides/modelarmor "https://modelarmor.LOCATION.rep.googleapis.com/"

    Replace LOCATION with the region where you want to use Model Armor.

Configure protection for Google and Google Cloud remote MCP servers

To help protect your MCP tool calls and responses you can use Model Armor floor settings. A floor setting defines the minimum security filters that apply across the project. This configuration applies a consistent set of filters to all MCP tool calls and responses within the project.

Set up a Model Armor floor setting with MCP sanitization enabled. For more information, see Configure Model Armor floor settings.

See the following example command:

gcloud model-armor floorsettings update \
--full-uri='projects/PROJECT_ID/locations/global/floorSetting' \
--enable-floor-setting-enforcement=TRUE \
--add-integrated-services=GOOGLE_MCP_SERVER \
--google-mcp-server-enforcement-type=INSPECT_AND_BLOCK \
--enable-google-mcp-server-cloud-logging \
--malicious-uri-filter-settings-enforcement=ENABLED \
--add-rai-settings-filters='[{"confidenceLevel": "MEDIUM_AND_ABOVE", "filterType": "DANGEROUS"}]'

Replace PROJECT_ID with your Google Cloud project ID.

Note the following settings:

  • INSPECT_AND_BLOCK: The enforcement type that inspects content for the Google MCP server and blocks prompts and responses that match the filters.
  • ENABLED: The setting that enables a filter or enforcement.
  • MEDIUM_AND_ABOVE: The confidence level for the Responsible AI - Dangerous filter settings. You can modify this setting, though lower values might result in more false positives. For more information, see Model Armor confidence levels.

Deactivate scanning MCP traffic with Model Armor

If you want to stop scanning Google MCP traffic with Model Armor, run the following command:

gcloud model-armor floorsettings update \
  --full-uri='projects/PROJECT_ID/locations/global/floorSetting' \
  --remove-integrated-services=GOOGLE_MCP_SERVER

Replace PROJECT_ID with the Google Cloud project ID.

Model Armor won't scan MCP traffic in the project.

Control MCP use with IAM deny policies

Identity and Access Management (IAM) deny policies help you secure Google Cloud remote MCP servers. Configure these policies to block unwanted MCP tool access.

For example, you can deny or allow access based on:

  • The principal
  • Tool properties like read-only
  • The application's OAuth client ID

For more information, see Control MCP use with Identity and Access Management.