Skip to content

Conversation

@vchomakov
Copy link
Member

Fix: Handle literal ${REDIS_URL} string when environment variable is unset

Problem

When the REDIS_URL environment variable is not set, gemini-cli passes the raw "${REDIS_URL}" string as the --url parameter instead of omitting it or passing an empty value. This causes the Redis MCP server to attempt parsing the literal string "${REDIS_URL}" as a Redis URI, which fails with a parsing error.

Root Cause

The issue occurs because:

  1. gemini-cli constructs command line arguments that include --url ${REDIS_URL}
  2. When REDIS_URL is unset, shell expansion doesn't occur, so the literal string "${REDIS_URL}" gets passed
  3. The server tries to parse this as a valid Redis URI, which fails

Solution

Filter out the "${REDIS_URL}" placeholder string.
This allows the server to gracefully fall back to using individual Redis connection parameters (host, port, etc.) with their default values when no valid URL is provided.

Impact

  • Fixes Redis MCP server startup failures when installed from PyPI and used with gemini-cli
  • Maintains backward compatibility with existing configurations
  • No breaking changes to the API or configuration options

@vchomakov vchomakov self-assigned this Oct 10, 2025
@vchomakov vchomakov linked an issue Oct 10, 2025 that may be closed by this pull request
Copy link
Contributor

@tishun tishun left a comment

Choose a reason for hiding this comment

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

This is just. Sad.

Thanks for fixing it!

@vchomakov vchomakov merged commit 56d3978 into main Oct 10, 2025
19 checks passed
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.

gemini-cli fails to start mcp-redis when REDIS_URL is unset

3 participants