Skip to content

Feature/uvx cli support #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jul 8, 2025
Merged

Feature/uvx cli support #29

merged 17 commits into from
Jul 8, 2025

Conversation

mortensi
Copy link
Member

@mortensi mortensi commented Jul 8, 2025

This branch contributes support for running the server using uvx and the ability to configure the server from the command line. It also removes the support for streamable-http, which will be added in the future with the related authentication mechanism.

mortensi added 17 commits July 6, 2025 15:00
- Add comprehensive CLI interface using Click with Redis URI and individual parameter support
- Add console script entry point for global installation via uvx/pip
- Update package metadata in pyproject.toml with proper classifiers and URLs
- Fix all imports to use absolute paths for proper package installation
- Update README with uvx installation instructions and MCP client configurations
- Support running directly from GitHub without PyPI publication
- Enable single-command usage: uvx redis-mcp-server --redis-uri redis://localhost:6379/0
- Add support for SSL connections, authentication, and cluster mode via CLI
- Maintain backward compatibility with existing installation methods
…erate_redis_uri function

- Remove redis- prefix from CLI parameters to follow redis-py conventions
- Update CLI parameters to match REDIS_CFG dictionary keys exactly
- Remove unused generate_redis_uri function and its imports
- Update README examples to use new parameter names
- Update MCP client configuration examples
- Add support for SSL parameters in query string (ssl_cert_reqs, ssl_ca_certs, etc.)
- Parse query parameters from Redis URI to properly configure SSL connections
- This fixes the issue where Redis Cloud URIs with SSL parameters were being ignored
- Move parse_redis_uri() and set_redis_env_from_config() from main.py to config.py
- These functions belong in config.py as they handle configuration logic
- Clean up main.py by removing configuration-related code
- Import functions from config.py in main.py
- Maintain all functionality while improving code organization
- Add reload_redis_config() function to reload REDIS_CFG from environment variables
- Call reload_redis_config() after setting environment variables in CLI
- This ensures REDIS_CFG uses the CLI-provided values instead of initial defaults
- Fixes issue where Redis Cloud URIs were ignored and localhost was used instead
- Move tool imports into _import_tools() function called after config reload
- This ensures RedisConnectionManager singleton is never instantiated before config is set
- Much cleaner solution than resetting singleton - prevents the problem instead of fixing it
- Tools are imported after reload_redis_config() so they use the correct Redis configuration
- Maintains backward compatibility with main() function
- Remove set_redis_env_from_config function that was logging 'Setting REDIS_*' messages
- Simplify configuration by using REDIS_CFG dictionary directly instead of environment variables
- Remove MCP transport configuration options (MCP_TRANSPORT, MCP_HOST, MCP_PORT)
- Update CLI to use stdio transport only
- Refactor configuration management for better maintainability
- Fix set_redis_config_from_cli to preserve correct types for Redis connection parameters
- Keep port and db as integers, ssl and cluster_mode as booleans
- This resolves the issue where uvx commands would hang due to Redis connection failures
- Re-enable Redis connection ping test in CLI

Fixes issue where 'uvx --from /path redis-mcp-server --url redis://localhost:6379/0'
would not show 'Starting the Redis MCP Server' message due to connection hanging.
- Added .idea/, .vscode/, and other IDE files to .gitignore
- Removed all .idea files from git tracking
- IDE configuration files should not be in version control
- Import ssl module for proper SSL constants
- Add helper function to convert string ssl_cert_reqs to SSL constants
- Filter out None SSL parameters to avoid passing them to redis-py
- Fix SSL certificate verification by using proper SSL constants instead of strings

This resolves the 'certificate verify failed' error when using SSL connections
with Redis Cloud and other SSL-enabled Redis instances.
- Keep the ssl_cert_reqs string to SSL constant conversion (the actual fix needed)
- Remove unnecessary None value filtering (redis-py handles None values fine)
- Restore original connection parameter structure

The core issue was passing ssl_cert_reqs as a string instead of SSL constant.
Redis-py accepts string values for ssl_cert_reqs ('required', 'optional', 'none').
The original SSL certificate error was likely a temporary issue or resolved
by other changes. The original connection code works fine.
@mortensi mortensi merged commit 1b368b3 into main Jul 8, 2025
@mortensi mortensi deleted the feature/uvx-cli-support branch July 8, 2025 07:24
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.

1 participant