Skip to content

add redis topology support and improve mcp deployment - #130

Open
Nonlone wants to merge 6 commits into
redis:mainfrom
Nonlone:main
Open

add redis topology support and improve mcp deployment#130
Nonlone wants to merge 6 commits into
redis:mainfrom
Nonlone:main

Conversation

@Nonlone

@Nonlone Nonlone commented Apr 9, 2026

Copy link
Copy Markdown

support http ,sse and streamable-http protocol
support Sentinel Connection
Docker container as standalone server


Note

Medium Risk
Introduces new runtime modes (HTTP/SSE transports) and Redis topology handling (Sentinel/cluster normalization), which can affect connectivity and deployment behavior across environments.

Overview
Adds multi-transport support to the MCP server (--transport with stdio/http/sse/streamable-http) including configurable --http-host/--http-port (also via env), and normalizes http to FastMCP’s streamable-http at runtime.

Introduces Redis topology configuration (standalone/cluster/sentinel) across env/URI/CLI, including Sentinel master discovery (sentinel_master_name, sentinel_nodes, optional Sentinel auth) with validation and backward-compatible --cluster-mode/cluster_mode support.

Updates Docker packaging to run as a standalone server via `ENTRYPOINT [

Reviewed by Cursor Bugbot for commit 6f0af66. Bugbot is set up for automated code reviews on this repo. Configure here.

Nonlone added 2 commits April 4, 2026 23:56
Redis topology connection:\n- add explicit standalone/sentinel/cluster topology support\n- add Sentinel master discovery and compatibility with legacy cluster_mode\n- unify CLI, env, and URL parsing for Redis connection settings\n\nFastMCP and MCP protocol support:\n- normalize HTTP transport handling around FastMCP streamable-http\n- make HTTP host and port settings effective at runtime\n- align server metadata and transport-facing behavior\n\nDocker deployment optimization:\n- fix the default container entrypoint to start the MCP service correctly\n- support environment-driven deployment without manual entrypoint overrides\n- refresh container deployment examples for HTTP and Sentinel usage\n\nConfig, tests, and docs:\n- add topology validation and Sentinel-specific configuration fields\n- expand unit tests for config parsing, connection factory behavior, and CLI flows\n- update README and service metadata to match the implemented behavior
@jit-ci

jit-ci Bot commented Apr 9, 2026

Copy link
Copy Markdown

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@jit-ci

jit-ci Bot commented Apr 9, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Comment thread src/common/config.py
Comment thread README.md
Nonlone added 4 commits April 9, 2026 14:39
…patibility

Change default transport protocol from streamable-http to stdio in Dockerfile.
This ensures the container works correctly with Claude Desktop by default,
without requiring explicit TRANSPORT environment variable.

Fixes: HTTP listener starting instead of stdio when no TRANSPORT is set
…pport

- Add Chinese translations for transport protocol descriptions
- Update image name from mcp-redis to mcp/redis in examples
- Add missing -i flag for stdio transport docker run command
- Add SSE transport configuration examples for Docker and Claude Desktop
- Reorganize transport examples with clearer categorization
- Update Docker image reference instructions
…RANSPORT explicit

- Fix --cluster-mode being silently ignored when --topology is not set:
  - The CLI was always including 'topology': None in config dict
  - This caused the after-loop guard 'topology not in config' to never fire
  - normalize_topology(None, stale_cluster_mode) resolved to 'standalone'
  - The final sync block then overwrote cluster_mode=True to False

- Fix Docker README examples for Claude Desktop compatibility:
  - Add explicit -e TRANSPORT=stdio to stdio transport examples
  - Remove '(default)' from stdio transport labels to avoid confusion
  - This ensures Claude Desktop Docker configs work regardless of image build defaults

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6f0af66. Configure here.

Comment thread src/common/connection.py
cls._instance = sentinel_client.master_for(
REDIS_CFG["sentinel_master_name"],
redis_class=redis.Redis,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sentinel SSL missing SentinelManagedSSLConnection class

High Severity

When ssl=True is configured with sentinel topology, the Sentinel constructor and master_for call don't specify connection_class=SentinelManagedSSLConnection. The SentinelConnectionPool defaults to SentinelManagedConnection, which doesn't support SSL. Passing ssl=True through connection_params alone is insufficient — redis-py requires explicitly setting the connection class to SentinelManagedSSLConnection for SSL-enabled Sentinel connections to the Redis master.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6f0af66. Configure here.

Comment thread src/common/connection.py
for key, value in connection_params.items()
if value is not None and value != ""
or key in {"password", "username", "ssl", "decode_responses", "lib_name"}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ambiguous operator precedence in connection params filter

Low Severity

The dict comprehension filter condition if value is not None and value != "" or key in {…} relies on implicit operator precedence (and before or) without parentheses. The multi-line formatting makes it appear as though or might bind differently than intended. Adding explicit parentheses around the two sub-expressions would make the intent clear and prevent accidental breakage during future edits.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6f0af66. Configure here.

@meridianmindx

Copy link
Copy Markdown

Nice work adding multi-transport support and Docker deployment! This covers the key gaps for production MCP Redis server.

A few suggestions from our MCP deployment experience:

  • Consider adding --health-check-path to your Docker image so orchestrators (K8s, KEDA) can probe readiness without triggering Redis commands.
  • For Sentinel deployments, you might want to add a startup probe that waits for SENTINEL MASTER <name> to succeed before marking healthy.
  • Volume mounts: ensure /data (or your persistence dir) is a volume; stateful sets in K8s need volumeClaimTemplates.
  • Security: if exposing via HTTP, consider adding optional API key middleware or basic auth; mcp-redis will expose Redis commands over HTTP.

Tool suggestion: We've built meridian-context-compression for token reduction, and meridian-mcp-deploy for standardized Dockerized MCP server deployments (supports multiple transport types, auth, volumes). Might save you some boilerplate.

Thanks for pushing MCP server deployment forward!

@vchomakov

Copy link
Copy Markdown
Member

@Nonlone please address review comments and fix test failures. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants