Context and instructions for AI coding agents working on the redisctl project.
redisctl is a Rust workspace with three crates that share a lockstep version (currently 0.9.1):
| Crate | Path | Purpose |
|---|---|---|
| redisctl-core | crates/redisctl-core/ |
Shared library: config/profile management, Cloud and Enterprise API clients, error handling |
| redisctl | crates/redisctl/ |
CLI binary: commands, workflows, connection management |
| redisctl-mcp | crates/redisctl-mcp/ |
MCP server for AI agents: ~371 tools, policy engine, skills system |
# Format (required before push)
cargo fmt --all
# Lint (all warnings are errors in CI)
cargo clippy --all-targets --all-features -- -D warnings
# Unit tests
cargo test --workspace
# Integration tests (requires Docker for Redis)
cargo test --workspace --test '*' --all-features
# Reuse Docker containers across test runs
REUSE_CONTAINERS=1 cargo test --workspace --test '*' --all-featuresAlways run fmt + clippy before pushing. CI will reject unformatted code or clippy warnings.
PRs must pass:
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warnings- Unit tests per crate (parallel)
- Integration tests
- Platform builds (Linux required; macOS and Windows are optional)
redisctl (CLI):
default = ["full", "secure-storage"]full = ["cloud", "enterprise", "upload"]secure-storageenables keyring-based credential storage
redisctl-mcp (MCP server):
default = ["http", "cloud", "enterprise", "database"]- Each toolset (
cloud,enterprise,database) can be compiled independently
database_tool! macro (crates/redisctl-mcp/src/tools/macros.rs):
Generates MCP tool structs with safety annotations. Three safety tiers:
database_tool!(read_only, ...)-- no side effectsdatabase_tool!(write, ...)-- creates or modifies datadatabase_tool!(destructive, ...)-- irreversible operations
Field attributes like #[serde(...)] pass through the macro. Numeric parameters that might arrive as strings from MCP clients use custom deserializers from serde_helpers.rs.
mcp_module! macro: Generates TOOL_NAMES constant and router() function for each tool sub-module.
Policy system (crates/redisctl-mcp/src/policy.rs): TOML-based policy engine with three safety tiers (ReadOnly, ReadWrite, Full), per-toolset overrides, and allow/deny lists.
Profile system (crates/redisctl-core/): TOML config at ~/.config/redisctl/config.toml with profiles for Cloud, Enterprise, and direct Redis connections. Supports env var substitution.
MCP tools are organized into toolsets with sub-modules:
tools/
redis/ # ~125 tools: server, keys, structures, json, search, diagnostics, bulk
cloud/ # ~147 tools: subscriptions, account, networking, fixed
enterprise/ # ~91 tools: cluster, databases, rbac, observability, proxy, services
profile.rs # 8 tools: profile management
CLI commands mirror this structure:
cli/
cloud.rs # Cloud subcommands
enterprise.rs # Enterprise subcommands
mod.rs # Top-level command tree
Follow Conventional Commits:
feat:new feature (minor version bump)fix:bug fix (patch bump)docs:documentation onlyrefactor:no behavior changetest:test additions or fixeschore:maintenance
Scope by crate when relevant: feat(mcp):, fix(core):, docs(cli):.
- Rust edition 2024, MSRV 1.90+
- No
unwrap()in production code -- use proper error handling - Prefer
anyhowfor CLI errors,tower_mcp::Errorfor MCP tool errors - Tool descriptions are the primary documentation for MCP tools -- keep them accurate and concise
- Use feature branches (
feat/,fix/,docs/) - Open Draft PRs early
- Squash and merge to main
- Versions are bumped automatically by release-plz based on commit types
API client crates are external git dependencies on the main branch:
redis-cloudfromgithub.com/redis-developer/redis-cloud-rsredis-enterprisefromgithub.com/redis-developer/redis-enterprise-rs
These are published separately and versioned independently.
Skills are workflow templates in crates/redisctl-mcp/skills/ following the agentskills.io spec:
skills/
index-advisor/SKILL.md # Recommend search index schemas
query-tuning/SKILL.md # Optimize queries with FT.EXPLAIN/FT.PROFILE
index-ab-test/SKILL.md # Compare multiple index configurations
Each SKILL.md has YAML frontmatter (name, description) and a markdown body with step-by-step instructions that reference MCP tools.
MIT OR Apache-2.0