Skip to content

feat(MCP): [2/5] Add search-records tool to RedisVL MCP#539

Merged
vishal-bala merged 24 commits intofeat/RAAE-1395-redisvl-mcpfrom
feat/RAAE-1397/search-tool
Apr 8, 2026
Merged

feat(MCP): [2/5] Add search-records tool to RedisVL MCP#539
vishal-bala merged 24 commits intofeat/RAAE-1395-redisvl-mcpfrom
feat/RAAE-1397/search-tool

Conversation

@vishal-bala
Copy link
Copy Markdown
Collaborator

@vishal-bala vishal-bala commented Mar 25, 2026

Builds on top of #532

This PR implements a tool for searching records in a configured index for the RedisVL MCP.


Note

Medium Risk
Adds a new MCP search tool and extends server startup/config validation, including runtime probing for native hybrid search; issues could affect MCP server startup or query behavior across Redis/redis-py versions.

Overview
Adds an MCP search-records tool that executes vector, fulltext, or hybrid searches against the configured index, with pagination, field projection, and normalized result formatting (stable id/score/score_type).

Extends MCP YAML config with a required search section (type + validated params) and validates hybrid configs against runtime capabilities by probing redis/redis-py for native hybrid support during server startup.

Introduces a structured filter DSL (and/or/not, field ops like eq/gte/in/exists) mapped to RedisVL FilterExpressions with a new INVALID_FILTER error code; adds comprehensive unit/integration coverage and minor typing fixes in redisvl.query.filter.

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

@vishal-bala vishal-bala self-assigned this Mar 25, 2026
@vishal-bala vishal-bala added the auto:minor Increment the minor version when merged label Mar 25, 2026
@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented Mar 25, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@vishal-bala vishal-bala marked this pull request as ready for review March 25, 2026 11:58
Comment thread redisvl/mcp/server.py Outdated
Comment thread redisvl/mcp/tools/search.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8f5e3d7cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread redisvl/mcp/tools/search.py
Comment thread redisvl/mcp/tools/search.py
Comment thread redisvl/mcp/tools/search.py
Comment thread redisvl/mcp/tools/search.py
Copy link
Copy Markdown
Collaborator

@rbs333 rbs333 left a comment

Choose a reason for hiding this comment

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

Looks cool!

In general I think it would be good for you to create an end-to-end sort of example from a pretend customer perspective that demonstrates all this functionality so that the value can be better conceptualized.

For instance, if we integrated this in to rain what would it look like? How would we do it? And what could now do that we couldn't do before.

I think this could be added to the redis-ai-resources or a blog and shared with the team to get everyone on board.

Comment thread spec/MCP.md
Copy link
Copy Markdown
Collaborator

@nkanu17 nkanu17 left a comment

Choose a reason for hiding this comment

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

Apart from @rbs333's comment about that file, looks good

Comment thread tests/integration/test_mcp/test_search_tool.py
@vishal-bala vishal-bala changed the title feat(MCP): Add search-records tool to RedisVL MCP feat(MCP): [2/5] Add search-records tool to RedisVL MCP Apr 2, 2026
…to feat/RAAE-1397/search-tool

# Conflicts:
#	redisvl/mcp/server.py
Base automatically changed from feat/RAAE-1396/mcp-framework to feat/RAAE-1395-redisvl-mcp April 8, 2026 10:10
…tool

# Conflicts:
#	redisvl/mcp/config.py
#	redisvl/mcp/errors.py
#	redisvl/mcp/server.py
#	tests/integration/test_mcp/test_server_startup.py
#	tests/unit/test_mcp/test_config.py
#	tests/unit/test_mcp/test_errors.py
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 1 potential issue.

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 2170d84. Configure here.

Comment thread redisvl/mcp/config.py
@vishal-bala vishal-bala merged commit 19fc731 into feat/RAAE-1395-redisvl-mcp Apr 8, 2026
63 checks passed
@vishal-bala vishal-bala deleted the feat/RAAE-1397/search-tool branch April 8, 2026 12:16
vishal-bala added a commit that referenced this pull request Apr 8, 2026
> Builds on top of #539 


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Introduces a new MCP write path that validates, embeds, and loads
user-supplied records into Redis, which could impact data integrity and
performance if misused despite added validation and limits.
> 
> **Overview**
> Adds a new MCP tool, `upsert-records`, that accepts a batch of
records, validates request shape and schema conformance, optionally
generates missing vector embeddings via the configured vectorizer (with
async/sync and batch fallbacks), and upserts them into the configured
index while returning the resulting keys.
> 
> Tool registration is wired into `RedisVLMCPServer` (disabled when
`read_only`), exposed via `redisvl.mcp.tools.__all__`, and covered by
new unit + integration tests including vector serialization for HASH
storage, request/runtime limit enforcement, non-mutation of inputs, and
error mapping that flags `partial_write_possible` on backend failures.
> 
> Separately, `mcp/filters.py` is adjusted to use
`typing.Union`/`List`/`Dict` annotations (dropping newer `|` syntax)
without changing filter behavior.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8aef518. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
vishal-bala added a commit that referenced this pull request Apr 10, 2026
)

This PR is an aggregation of changes reviewed in the following PRs:
- #531 
- #532
- #539 
- #540 
- #544 
- #547  

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Adds a new MCP server surface area that performs schema inspection,
embedding, and optional write operations against Redis, increasing
operational and correctness risk despite extensive validation and tests.
Optional dependency gating and Python-version checks reduce impact on
core installs but the new server path could affect Redis access patterns
and resource lifecycle.
> 
> **Overview**
> Adds an optional **RedisVL MCP server** that binds to one existing
Redis Search index and exposes a stable tool contract for
`search-records` and (unless *read-only*) `upsert-records`, driven
entirely by a YAML config.
> 
> Introduces new MCP configuration/settings loading with env var
substitution, schema inspection plus `schema_overrides`, reserved-field
and capability validation (including native vs fallback hybrid search),
plus guarded concurrency/timeouts and deterministic error mapping.
Updates the `rvl` CLI and docs/README/installation to support
`redisvl[mcp]` (Python 3.10+) and adds comprehensive unit/integration
tests; also tweaks filter type hints and ignores `.codex/`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6e2fe5b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto:minor Increment the minor version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants