Commit df4d64c
authored
fix(MCP): Avoid required search config fields that aren't relevant to the configured search type (#591)
## Motivation
The RedisVL MCP config validation was treating vector and text settings
as universally required, even when the configured search mode did not
use them. In practice, that meant a full-text-only deployment still had
to provide vector-specific settings such as a vectorizer, a vector field
name, and embed-source configuration just to start the server. That made
the MCP surface unnecessarily rigid and blocked valid non-vector use
cases.
The pain point was most visible in two places. First, `search.type:
vector` was incorrectly forcing `runtime.text_field_name`, even though
vector search does not use a text field for retrieval. Second,
`search.type: fulltext` still inherited vector-only startup and config
requirements because the server always initialized a vectorizer and
always validated vector mappings. The result was that irrelevant
settings became mandatory, which made configs harder to reason about and
made full-text-only deployments look unsupported even though the runtime
behavior itself did not need those dependencies.
## Changes
This change makes RedisVL MCP validation capability-aware instead of
globally strict. The YAML shape stays the same, but runtime settings and
vectorizer requirements are now enforced only when the configured
behavior actually needs them. `runtime.text_field_name` is required for
`fulltext` and `hybrid` search, while `runtime.vector_field_name` and
`vectorizer` are required only for vector-backed search or server-side
embedding. `runtime.default_embed_text_field` is now treated as an
embedding capability setting rather than a universal requirement.
Startup behavior was updated to match that model. The server no longer
initializes and dimension-checks a vectorizer for deployments that do
not need one. That allows a full-text-only MCP config to start cleanly
without vector settings, while keeping the existing fail-fast behavior
for vector and hybrid search.
The write path was also split into capability-specific branches.
`upsert-records` now supports plain schema-validated writes when no
vector field is configured. When a vector field is configured but
server-side embedding is not, the caller must provide vectors explicitly
and the request fails at upsert time if required vectors are missing.
When server-side embedding is configured, the previous embedding flow
remains in place. As a small follow-up, the patch also adds a TODO near
the embedding call noting that the current implementation can still
re-embed records that already include vectors, which is wasteful and may
add external embedding cost.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches MCP config validation and request-time behavior for
search/upsert, which can change startup acceptance and error paths for
existing deployments, especially around optional vector/embedding
settings.
>
> **Overview**
> RedisVL MCP now treats vector-related settings as *optional
capabilities* rather than universally required, allowing fulltext-only
deployments to omit `vectorizer`, `runtime.vector_field_name`, and
`runtime.default_embed_text_field` while still enforcing the right
requirements for `vector` and `hybrid` search.
>
> Config validation was updated to be search-mode aware (new capability
helpers and validators), server startup only initializes a vectorizer
when required, `search-records` and `upsert-records` add explicit
runtime checks for missing text/vector fields, and upsert now supports
plain writes with no vector config while requiring caller-supplied
vectors when a vector field is configured but server-side embedding is
not. Docs and tests were expanded to cover fulltext-only configs and the
new upsert behaviors.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
889c5e2. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 7fc9d87 commit df4d64c
13 files changed
Lines changed: 822 additions & 148 deletions
File tree
- docs
- concepts
- user_guide/how_to_guides
- redisvl/mcp
- tools
- tests
- integration/test_mcp
- unit/test_mcp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | | - | |
166 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
170 | 201 | | |
171 | 202 | | |
172 | 203 | | |
| |||
269 | 300 | | |
270 | 301 | | |
271 | 302 | | |
272 | | - | |
273 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
274 | 306 | | |
275 | 307 | | |
276 | 308 | | |
| |||
425 | 457 | | |
426 | 458 | | |
427 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
428 | 478 | | |
429 | 479 | | |
430 | 480 | | |
| |||
435 | 485 | | |
436 | 486 | | |
437 | 487 | | |
438 | | - | |
| 488 | + | |
439 | 489 | | |
440 | 490 | | |
441 | 491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
217 | 282 | | |
218 | 283 | | |
219 | 284 | | |
| |||
250 | 315 | | |
251 | 316 | | |
252 | 317 | | |
253 | | - | |
| 318 | + | |
254 | 319 | | |
255 | 320 | | |
256 | 321 | | |
| |||
259 | 324 | | |
260 | 325 | | |
261 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
262 | 352 | | |
263 | 353 | | |
264 | 354 | | |
| |||
343 | 433 | | |
344 | 434 | | |
345 | 435 | | |
346 | | - | |
| 436 | + | |
347 | 437 | | |
348 | 438 | | |
349 | 439 | | |
350 | 440 | | |
351 | | - | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
352 | 445 | | |
353 | 446 | | |
354 | 447 | | |
355 | 448 | | |
356 | 449 | | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
366 | 463 | | |
367 | 464 | | |
368 | 465 | | |
| |||
373 | 470 | | |
374 | 471 | | |
375 | 472 | | |
| 473 | + | |
| 474 | + | |
376 | 475 | | |
377 | 476 | | |
378 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| 152 | + | |
| 153 | + | |
150 | 154 | | |
151 | 155 | | |
152 | 156 | | |
| |||
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
301 | | - | |
| 305 | + | |
| 306 | + | |
302 | 307 | | |
303 | 308 | | |
304 | 309 | | |
| |||
0 commit comments