feat(mcp): add Redis MCP Bridge with 25 tools (#2511)#2614
Merged
mrveiss merged 5 commits intoDev_new_guifrom Mar 28, 2026
Merged
feat(mcp): add Redis MCP Bridge with 25 tools (#2511)#2614mrveiss merged 5 commits intoDev_new_guifrom
mrveiss merged 5 commits intoDev_new_guifrom
Conversation
|
| Metric | Count |
|---|---|
| Total Violations | 2 |
| SSOT Violations (high priority) | 1 |
| Other Violations | 1 |
⚠️ 1 values have SSOT config equivalents!
These should be replaced with SSOT config imports:
Python:
from src.config.ssot_config import config
# Use: config.vm.main, config.port.backend, config.backend_urlTypeScript:
import config from '@/config/ssot-config'
// Use: config.vm.main, config.port.backend, config.backendUrl📖 See SSOT_CONFIG_GUIDE.md for documentation.
Implement redis_mcp as the 11th native MCP bridge providing agents direct access to Redis data structures, RediSearch vector search, and operational intelligence. 25 tools across 3 categories: - Data Access (15): get/set, hash, list, sorted set, stream, scan, type, ttl, delete - Vector Search (4): create_index, vector_search, hybrid_search, index_info - Ops Intelligence (6): server_info, dbsize, memory_stats, stream_health, client_list, slowlog RBAC model: users read all + write autobot:agent:* only; admins full access with approval gates for destructive operations.
…, #2623) and surfaces them to the agent with instructions to request user confirmation. Redis MCP router accepts approved=true to bypass the gate after confirmation. Also extracts _handle_unknown_tool helper to fix pre-existing function length violation in _dispatch_tool_call. accept query_text as an alternative to query_vector. Text is transparently converted to embeddings using the existing NPU/Ollama pipeline from knowledge.facts._generate_embedding_with_npu_fallback.
query_text is now an alternative to query_vector, so query_vector should not be required. filter_expression remains required.
0e7fe44 to
78b240d
Compare
Security fixes: - S1: Validate ALL keys in namespace check, not just the first - S2: Sanitize filter_expression against injection via regex allowlist - S3: Clamp top_k to [1, 500] to prevent resource exhaustion Quality fixes: - H1: Restrict create_index to SCOPED_WRITE for non-admin users - H2: Validate database parameter against DATABASE_MAPPING - H3: Extract _decode() helper to reduce xrange function length - M3: Extract _build_index_schema() from create_index handler - M5: Share _execute_vector_query() between search/hybrid_search - M7: Modernize typing.List to builtin list in tools.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements redis_mcp as the 11th native MCP bridge in AutoBot's registry, giving AI agents direct access to Redis data structures, RediSearch vector search, and operational intelligence.
Closes #2511
25 MCP Tools across 3 categories:
Data Access (15 tools):
redis_get,redis_set,redis_deleteredis_hget,redis_hgetall,redis_hsetredis_lrange,redis_lpush,redis_rpushredis_zrangeredis_xrange,redis_xaddredis_scan_keys,redis_type,redis_ttlVector Search (4 tools):
redis_vector_create_index,redis_vector_search,redis_hybrid_search,redis_vector_index_infoOps Intelligence (6 tools):
redis_server_info,redis_dbsize,redis_memory_stats,redis_stream_health,redis_client_list,redis_slowlogRBAC Model:
autobot:agent:*namespace only, read-only ops (no client_list/slowlog)Security hardening (code review findings):
filter_expressionsanitized via regex allowlist — prevents RediSearch injectiontop_kclamped to [1, 500] — prevents resource exhaustioncreate_indexrestricted to SCOPED_WRITE for non-admin usersdatabaseparameter validated against DATABASE_MAPPINGArchitecture:
autobot_shared.redis_client(async, pooled, circuit-broken)mcp_registry.py) and router registry (core_routers.py)_get_mcp_tools_prompt()(Bug: MCP dispatch fallback doesn't forward user role for RBAC filtering #2629)Files:
autobot-backend/api/redis_mcp/__init__.py— Package entryautobot-backend/api/redis_mcp/tools.py— 25 tool definitions (JSON schemas)autobot-backend/api/redis_mcp/rbac.py— Role-based access control matrixautobot-backend/api/redis_mcp/data_access.py— 15 data tool handlersautobot-backend/api/redis_mcp/vector_search.py— 4 vector search handlersautobot-backend/api/redis_mcp/ops_intelligence.py— 6 ops tool handlersautobot-backend/api/redis_mcp/router.py— FastAPI router + dispatchTest plan
GET /api/redis/mcp/toolsredis_client_listorredis_slowlogautobot:agent:*key is rejectedapproval_requiredstatustop_kis clamped (passing 9999 returns max 500)filter_expressionis rejecteddatabaseparameter returns 400GET /api/mcp/bridges