Skip to content
GitHub (opens in a new tab)

Databases · MCP Firewall integration

Expose selected Redis keys. Keep reads under your control.

Use GateRook’s MCP Firewall to limit which Redis keys AI can inspect and require approval before reading a value. This local walkthrough demonstrates scoped scans, a human-approved read, and the recorded outcome in Activity. The connector exposes no write or arbitrary-command tools.

Step-by-step walkthrough

Control AI reads from Redis with GateRook’s MCP Firewall

GateRook’s MCP Firewall gives your AI app scoped access to Redis through two tools: redis_scan discovers keys, and redis_get inspects a key's type, expiry, and value. The Redis password stays in the connection. You can require human approval even for a read, then inspect its arguments, decision, and outcome in Activity.

This walkthrough was recorded on November 3, 2026 with GateRook 0.7.0, Redis 8.6.2 in Docker Desktop on macOS, and Codex connected to the existing showcase development endpoint. All Redis data shown here is synthetic. The screenshots are genuine application captures; connection filters keep unrelated server addresses and credentials out of view, and the tutorial password remains masked.

Keep Docker Desktop and GateRook running. If your AI app is not connected yet, follow the getting started guide first.

1. Start an isolated Redis server

Use a separate container and port so an existing Redis on port 6379 can keep running. This example publishes only 127.0.0.1:16379 and uses a named volume for persistence.

Create a private working directory, independent administrator and reader passwords, and a Redis ACL file. Run this once in a new directory; the exclusive file creation prevents accidentally replacing existing credentials.

Shell commands
mkdir -p ~/gaterook-redis-demo
cd ~/gaterook-redis-demo
chmod 700 .
umask 077

python3 - <<'PY'
import hashlib
import json
import secrets
from pathlib import Path

passwords = {name: secrets.token_hex(24)
             for name in ("demo_admin", "demo_reader")}
with Path("credentials.json").open("x") as output:
    json.dump(passwords, output)
Path("credentials.json").chmod(0o600)

rules = {
    "demo_admin": "~* +@all",
    "demo_reader": (
        "~demo:* +@read +@connection -@dangerous "
        "+info +acl|whoami +acl|dryrun +client|no-touch"
    ),
}
with Path("users.acl").open("x") as output:
    output.write("user default off\n")
    for name, password in passwords.items():
        digest = hashlib.sha256(password.encode()).hexdigest()
        output.write(f"user {name} on #{digest} {rules[name]}\n")
# Redis inside the container must be able to read the bind mount.
# The enclosing host directory remains private (0700).
Path("users.acl").chmod(0o644)
PY

docker run -d \
  --name gaterook-redis-showcase \
  -p 127.0.0.1:16379:6379 \
  --mount "type=bind,source=$(pwd)/users.acl,target=/usr/local/etc/redis/users.acl,readonly" \
  --mount type=volume,source=gaterook-redis-showcase-data,target=/data \
  redis@sha256:009cc37796fbdbe1b631b4cc0582bed167e5e403ed8bcd06f77eb6cb5aeb6f93 \
  redis-server --aclfile /usr/local/etc/redis/users.acl --appendonly yes

The image digest is the official Redis image used for this capture. Choose a different container name, volume, or host port if these already exist. Keep the credential files outside version control; do not paste their contents into an AI conversation.

The administrator is used only to seed this local fixture. GateRook will use demo_reader, which can read the demo:* namespace but cannot write. ACL WHOAMI and ACL DRYRUN support access diagnostics; CLIENT NO-TOUCH supports the connector's optional no-touch setting. These grants do not permit changing ACLs. Redis explains rule ordering and key patterns in its ACL documentation.

Wait for authenticated access, then create five keys in database 0:

Shell commands
python3 - <<'PY'
import json
import os
import subprocess
import time
from pathlib import Path

passwords = json.loads(Path("credentials.json").read_text())
env = os.environ | {"REDISCLI_AUTH": passwords["demo_admin"]}

def redis(*args):
    result = subprocess.run(
        ["docker", "exec", "-e", "REDISCLI_AUTH",
         "gaterook-redis-showcase", "redis-cli", "--user", "demo_admin",
         "--raw", "-n", "0", *args],
        env=env, capture_output=True, text=True, check=True,
    )
    reply = result.stdout.strip()
    if reply.startswith(("ERR", "NOAUTH", "NOPERM", "WRONGPASS")):
        raise RuntimeError(reply)
    return reply

for attempt in range(30):
    try:
        if redis("PING") == "PONG":
            break
    except (subprocess.CalledProcessError, RuntimeError):
        pass
    time.sleep(1)
else:
    raise SystemExit("Redis did not become ready within 30 attempts")

redis("HSET", "demo:order:1001", "status", "pending",
      "total", "149.00", "currency", "EUR")
redis("HSET", "demo:order:1002", "status", "shipped",
      "total", "89.00", "currency", "EUR")
redis("SET", "demo:cache:message", "Hello from Redis through GateRook")
redis("RPUSH", "demo:queue:shipments", "1001", "1002", "1003")
redis("SET", "demo:session:example", "synthetic-session-value")
redis("EXPIRE", "demo:order:1001", "86400")
print("Redis ready; fixture keys:", redis("DBSIZE"))
PY

The output for an empty fixture is Redis ready; fixture keys: 5. Run the seeding block once: repeating RPUSH appends another three list elements. Order 1001 expires after one day. The session key deliberately exists so we can verify that GateRook excludes it.

2. Choose the Redis connector

Open Connections. Filter the list to redis-demo before capturing screenshots so other connections' addresses and credential references stay out of view. No matches is expected before you create the connection.

Connections filtered to redis-demo, with Add connection available.
Connections filtered to redis-demo, with Add connection available.

Select Add connection → Redis → Continue. Redis exposes two built-in tools, both for reading.

Redis selected in the Add connection wizard.
Redis selected in the Add connection wizard.

3. Enter the server and credentials

Use the following settings:

FieldValue
Nameredis-demo
Host127.0.0.1
Port16379
TransportWithout TLS for this loopback-only fixture
Secret sourceEncrypted here
ACL userdemo_reader
PasswordThe demo_reader value in your private credentials.json
EnvironmentDEV Development

The container does not configure TLS. For a remote Redis server, enable TLS and verify its CA and host name, supplying a private CA when required. The local demo's transport setting is not a remote deployment recommendation.

The redis-demo name and loopback server address on port 16379.
The redis-demo name and loopback server address on port 16379.

Enter the reader password directly in GateRook. Encrypted here stores it encrypted locally; later tool calls refer to redis-demo and do not include the credential. Do not use the administrator password for this connection.

Encrypted here selected, demo_reader entered, the password masked, and DEV selected.
Encrypted here selected, demo_reader entered, the password masked, and DEV selected.

4. Limit the database, key namespace, and response size

Expand Advanced and configure:

SettingValue in this walkthrough
Database0
Database allowlistEmpty: use only the selected database 0
Keys the agent may readdemo:*
Keys the agent never readsdemo:session:*
Command timeout2000 ms
Maximum value size64 KB
Pool size2
Connect timeout2000 ms
Don't touch keysEnabled

Add each key pattern as a chip using the + control. The denylist takes precedence: demo:session:example matches the allowlist, but is excluded by demo:session:*. These GateRook filters narrow the Redis reader's ACL further. The ACL itself still permits reading that synthetic session key directly outside GateRook; use Redis ACLs as well when a restriction must apply to every client.

The no-touch option uses CLIENT NO-TOUCH, available in Redis 7.2 and later, to avoid updating key access metadata. It does not stop the expiry clock or make reads transactional.

Database zero, demo key allowlist, session denylist, and bounded read settings.
Database zero, demo key allowlist, session denylist, and bounded read settings.

5. Test the connection

Continue to the connection test. This run reported Connected · Redis 8.6.2, with read access and no write access. The SET: NOPERM diagnostic is expected for demo_reader; it confirms the restricted credential.

GateRook also noted that the server did not expose the configured database count and that INFO lists populated databases. This does not prevent using database 0. Do not grant administrator access just to remove that informational message.

Successful Redis connection test showing read access and SET denied by the ACL.
Successful Redis connection test showing read access and SET denied by the ACL.

6. Add the connection to showcase

Continue to Add to endpoint. Untick default, tick only showcase, and select Save connection. A saved connection becomes available to an AI client only through an endpoint that exposes it.

Only showcase selected in the Add to endpoint step.
Only showcase selected in the Add to endpoint step.

The saved connection should show Healthy, one endpoint, and two tools on showcase. Its password appears as an encrypted version without a readable value.

The healthy saved redis-demo connection with two tools on showcase.
The healthy saved redis-demo connection with two tools on showcase.

7. Require approval for reading a value

On the saved connection, scroll to Used by, or open Endpoints → showcase → Tools & policies. Set the Redis tool modes as follows:

ToolModePurpose
redis_scanRead onlyDiscover permitted keys and optionally their types and TTLs.
redis_getApprovalRequire a person to approve each requested value read.

Redis read approval is supported. It is useful when discovering key names is acceptable but inspecting values should require review. The approval does not add Redis privileges or turn the connector into a write interface.

redis_get set to Approval and redis_scan left in Read only on showcase.
redis_get set to Approval and redis_scan left in Read only on showcase.

8. Understand the request path

Open Endpoints → showcase. The diagram connects Codex to the endpoint and its attached connections, including redis-demo.

The showcase endpoint with Codex connected and redis-demo among its connections.
The showcase endpoint with Codex connected and redis-demo among its connections.

A request follows this path: AI app → showcase → tool mode and policy → redis-demo → Redis ACL → result and Activity. GateRook resolves the stored credentials, applies key restrictions and response limits, and returns the permitted result to the client. The AI provider can process that returned data, so scope values as carefully as credentials.

The connector supports a standalone Redis server or a directly reachable replica. Cluster routing and Sentinel discovery are not supported. There are no SET, DEL, FLUSHALL, or arbitrary-command tools. redis_get reads strings, hashes, lists, sets, sorted sets, and streams through bounded operations appropriate to each type.

If your AI client cached its tool list before the connection was added, refresh its MCP connection so it discovers the Redis tools. Use the names currently advertised by your endpoint.

9. Scan permitted keys

Ask your AI:

Use redis-demo on showcase to scan demo:* with types and TTLs, requesting up to 20 keys. Do not change any data.

The redis_scan arguments used in this run were:

JSON
{
  "connection": "redis-demo",
  "pattern": "demo:*",
  "count": 20,
  "details": true
}

The call ran immediately in Read only mode. It returned four keys:

KeyTypeExpiry at scan time
demo:order:1002hashPersistent
demo:order:1001hash86236618 ms remaining
demo:cache:messagestringPersistent
demo:queue:shipmentslistPersistent

The result reported returned: 4, iterations: 1, complete: true, nextCursor: null, and keyListsApply: true. The session key was excluded and was not counted. TTLs and key order can differ when you repeat the example.

In Activity → Agent calls, filter to endpoint:showcase connection:redis-demo, then open the redis_scan event to inspect the exact request.

The redis_scan Activity event with its arguments and allowed decision.
The redis_scan Activity event with its arguments and allowed decision.

Scroll to Result. The event records the four-key summary, response size and hash, masking count, and timing. In this capture the scan's full response body is not retained in the audit log; the result summary and fingerprint remain available.

The scan's Activity result summary showing four permitted keys and no excluded session key.
The scan's Activity result summary showing four permitted keys and no excluded session key.

For larger namespaces, pass the returned nextCursor as the next call's cursor until complete is true. Treat the cursor as opaque. Redis SCAN is incremental, can repeat keys across pages, and does not provide a transactional snapshot. Its COUNT is a work hint, not an exact count guarantee; see the Redis SCAN documentation.

10. Request a read and approve the exact action

Ask your AI:

Read demo:order:1001 through redis-demo, with a limit of 10 elements. Show its fields and remaining TTL. Wait for my approval.

The redis_get arguments are:

JSON
{
  "connection": "redis-demo",
  "key": "demo:order:1001",
  "limit": 10
}

GateRook holds the request because redis_get is in Approval mode. Open the pending item in Approvals and review the client, endpoint, connection, key, limit, and prepared Redis action. It starts with TYPE, PTTL, and MEMORY USAGE, then selects a bounded read for the key's type. For this hash, the read uses HLEN and HSCAN.

Select Approve and run yourself to allow this one action, or reject it. The AI cannot approve its own request. In this configuration an unanswered request expires after five minutes. While a request is pending, the client should follow its approval handle rather than issue the read again.

The person approved the recorded request at 11:12:01 local time. The screenshot below shows the completed event in Activity. GateRook protected the approval decision screen from capture in this macOS session, so the approval evidence is captured from its Activity timeline after the decision.

The completed redis_get Activity event marked Approved with its original arguments.
The completed redis_get Activity event marked Approved with its original arguments.

11. Verify the returned value and approval evidence

Open the read event and scroll to Approval. The timeline shows the request, desktop notification, Approved by you, and execution. It also reports that the executed action matches the approved action byte for byte.

The human approval timeline and exact approved-action match in Activity.
The human approval timeline and exact approved-action match in Activity.

The completed read returned this structured result:

JSON
{
  "key": "demo:order:1001",
  "type": "hash",
  "exists": true,
  "ttlMs": 86091109,
  "persistent": false,
  "memoryBytes": 102,
  "supported": true,
  "length": 3,
  "value": {
    "status": "pending",
    "total": "149.00",
    "currency": "EUR"
  },
  "returned": 3,
  "truncated": false,
  "nextCursor": null,
  "elapsedMs": 2
}

value.status: "pending" is the order's business status. The approval itself is completed. truncated: false and returned: 3 show that all three fields were returned. The TTL is lower than during the scan because time passed while the read waited for approval.

Activity showing the read result, including the order fields, TTL, and structured JSON.
Activity showing the read result, including the order fields, TTL, and structured JSON.

12. Follow future calls in Activity

Keep the Activity filter endpoint:showcase connection:redis-demo to isolate this connection. The overview now contains two successful events: Allowed for the scan and Approved for the value read.

Activity filtered to showcase and redis-demo, with one Allowed scan and one Approved read.
Activity filtered to showcase and redis-demo, with one Allowed scan and one Approved read.

Open a row to inspect the client, endpoint, tool arguments, policy decision, and timing. For an approved call, also inspect the human decision and approved-action hash. Allowed means the configured rules let the call run without asking; Approved records a human decision before execution.

The scan took 3 ms in Activity; the read took 9 ms of execution after a 2 minute 25 second approval wait. The connector's elapsedMs: 2 covers a narrower part of the read, so it differs from the Activity total. The read result was 402 bytes, and zero fields were masked because the fixture contains only synthetic data. These are observations from this run, not performance guarantees.

Activity shows the result information available for each event. Here the approved read includes its structured response, while the scan has a summary, size, and SHA-256 fingerprint. Do not assume every event retains the complete response body. Use Setup changes to inspect configuration changes separately from agent calls.

Keep or stop the demo

This walkthrough leaves redis_get in Approval mode and redis_scan in Read only. Keep the container running to try more bounded reads. To stop and later resume it without removing the volume or credentials:

Shell commands
docker stop gaterook-redis-showcase
docker start gaterook-redis-showcase

The order's TTL continues to elapse while the container is stopped; it may be gone when you return. Use the persistent demo:order:1002 key for a later read, or deliberately reseed the disposable fixture. A stopped container will make GateRook's connection test fail until it is started again.

Useful access. Explicit control.

What you can do with Redis and AI

Find a stale cache entry

Read the cached status and TTL of a known order, then compare it with a SQL query. The agent can explain a mismatch without deleting or replacing the key.

Explore a permitted namespace

Scan demo:* with a bounded count, inspect key types and follow the returned cursor. A scan is incremental and may repeat keys across pages.

Understand queues and counters

Inspect a bounded page of a list, sorted set or stream and explain its values. The connector exposes read operations, not a general Redis command terminal.

Connection settings

Configure Redis in GateRook

These are example values for the connection form. Enter credentials into GateRook’s secret fields, not into an AI prompt. Requirements and alternatives are noted per field.

Redis connection configuration
SettingExampleHow to use it
Name / environmentredis-demo / devChoose Redis in Connections and use the Development environment for this local fixture.
Host / port127.0.0.1 / 16379The tutorial container publishes only to loopback. GateRook must be able to reach the standalone server or direct replica.
Database0Select the logical database index. The default is 0.
ACL user / passworddemo_reader / Enter in GateRookUse the generated reader password from credentials.json. Store it with Encrypted here; do not include it in AI prompts.
Use TLS / TLS verificationWithout TLS (local demo only)This loopback fixture has no TLS configured. For a remote server, use TLS with CA and host name verification.
Keys the agent may readdemo:*Redis glob allowlist. An empty allowlist permits every key that is not denied.
Keys the agent never readsdemo:session:*Excludes the synthetic session key even though it matches demo:*. Deny patterns take precedence.

Know what you expose

Redis tools and access boundaries

The connector defines available operations. GateRook’s MCP Firewall enforces endpoint modes and connection policies before an AI client can use them.

Available tools and access behavior
ToolPurposeAccess behavior
redis_scanScan keys by Redis glob, with optional type and TTL. Continue using nextCursor.Read only
redis_getRead a string, hash, list, set, sorted set or stream with type, TTL and bounded values.Approval in this walkthrough; Read only is also supported

Before you enable access

  • Redis Cluster and Sentinel are not supported. Connect to a standalone server or directly to a replica.
  • There are no SET, DEL, FLUSHALL or arbitrary-command tools. This connector only reads.
  • SCAN can repeat keys across pages and does not produce a transactional snapshot.
  • The optional no-touch behavior needs Redis 7.2 or later. Result size, element count and command timeouts bound each read.

GateRook stores local connection secrets encrypted and resolves them for connectors. Allowed tool results are returned to your AI client and may be processed by its provider. Scope the data you expose as well as the actions you allow.

Practical answers

Redis connection questions

Use Test connection to isolate service access problems. Use Playground and Activity to inspect endpoint permissions and tool calls.

Can I require approval before reading a Redis value?

Yes. Set redis_get to Approval in the endpoint tool modes. GateRook holds the read until a person approves the prepared action. Activity records the decision, execution, and available result information. The walkthrough demonstrates this with a real hash read.

Can the AI delete a Redis key?

No. The built-in connector only publishes redis_get and redis_scan. It has no mutation tool or arbitrary command input.

Does this work with Redis Cluster or Sentinel?

Not with cluster routing or Sentinel discovery. Use a supported standalone server or a replica that GateRook can reach directly.

Can I exclude session keys?

Yes. Add session:* and any other sensitive patterns to the key denylist. An allowlist such as cache:order:* narrows the scope further.

Why does the connection test report SET: NOPERM?

The tutorial reader deliberately has no write permission. A successful connection with SET denied is the expected result. Keep the reader credential; do not substitute the administrator password.

Keep exploring

MySQL

Control MySQL access through GateRook’s MCP Firewall. Configure a scoped login, run read queries, approve an UPDATE and inspect each call in Activity.

PostgreSQL

Put PostgreSQL behind GateRook’s MCP Firewall. Follow the illustrated setup, scope AI queries, approve an UPDATE and inspect its Activity audit trail.

MongoDB

Control MongoDB access through GateRook’s MCP Firewall. Follow the Docker tutorial to scope reads, approve updates and inspect the Activity audit trail.

Browse all integration guides

Your MCP Firewall. Your access rules.

Control AI access to Redis.

Start with read-only access. Approve changes. Inspect the audit trail.

Read the getting started guide

Get GateRook

Download GateRook 0.9.2 for your Mac, or get the Windows app from Microsoft Store.

macOS

Version 0.9.2 for Apple Silicon (arm64). This download does not support Intel Macs.

Open the DMG and drag GateRook to Applications.

Windows

Available for free from Microsoft Store. Install GateRook and receive updates through the Store.

macOS release notes and checksums (opens in a new tab)