AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Redis Vl Python

mcp-redis-redis-vl-python · by redis

Redis Vector Library (RedisVL) -- the AI-native Python client for Redis.

No reviews yet
0 installs
41 views
0.0% view→install

Install

$ agentstack add mcp-redis-redis-vl-python

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-redis-redis-vl-python)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Redis Vl Python? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Redis Vector Library The AI-native Redis Python client

[](https://opensource.org/licenses/MIT) [](https://pypi.org/project/redisvl/)

[](https://github.com/redis/redis-vl-python/stargazers)

[](https://github.com/psf/black)

DocumentationRecipesGitHub


Introduction

Redis Vector Library (RedisVL) is the production-ready Python client for AI applications built on Redis. Lightning-fast vector search meets enterprise-grade reliability.

Perfect for building RAG pipelines with real-time retrieval, AI agents with memory and semantic routing, and recommendation systems with fast search and reranking.

| 🎯 Core Capabilities | 🚀 AI Extensions | 🛠️ Dev Utilities | |:---:|:---:|:---:| | [Index Management](#index-management)Schema design, data loading, CRUD ops | [Semantic Caching](#semantic-caching)Reduce LLM costs & boost throughput | [CLI](#command-line-interface)Index management from terminal | | [Vector Search](#retrieval)Similarity search with metadata filters | [LLM Memory](#llm-memory)Agentic AI context management | Async SupportAsync indexing and search for improved performance | | [Complex Filtering](#retrieval)Combine multiple filter types | [Semantic Routing](#semantic-routing)Intelligent query classification | [Vectorizers](#vectorizers)8+ embedding provider integrations | | [Hybrid Search](#retrieval)Combine semantic & full-text signals | [Embedding Caching](#embedding-caching)Cache embeddings for efficiency | [Rerankers](#rerankers)Improve search result relevancy | | | | [MCP Server](#mcp-server)Expose an existing Redis index to MCP clients |

💪 Getting Started

Installation

Install redisvl into your Python (>=3.10) environment using pip:

pip install redisvl

Install the MCP server extra when you want to expose an existing Redis index through MCP:

pip install redisvl[mcp]

> For more detailed instructions, visit the installation guide. > For MCP concepts and setup, see the RedisVL MCP docs and the MCP how-to guide.

Redis

Choose from multiple Redis deployment options:

Redis Cloud - Managed cloud database (free tier available)

Redis Cloud offers a fully managed Redis service with a free tier, perfect for getting started quickly.

Docker - Local development

Run Redis locally using Docker:

docker run -d --name redis -p 6379:6379 redis:latest

This runs Redis 8+ with built-in vector search capabilities.

Redis Enterprise - Commercial, self-hosted database

Redis Enterprise provides enterprise-grade features for production deployments.

Redis Sentinel - High availability with automatic failover

Configure Redis Sentinel for high availability:

# Connect via Sentinel
redis_url="redis+sentinel://sentinel1:26379,sentinel2:26379/mymaster"

Azure Managed Redis - Fully managed Redis Enterprise on Azure

Azure Managed Redis provides fully managed Redis Enterprise on Microsoft Azure.

> 💡 Tip: Enhance your experience and observability with the free Redis Insight GUI.

Overview

Index Management

  1. Design a schema for your use case that models your dataset with built-in Redis indexable fields (e.g. text, tags, numerics, geo, and vectors).

Load schema from YAML file

```yaml index: name: user-idx prefix: user storage_type: json

fields:

  • name: user

type: tag

  • name: credit_score

type: tag

  • name: job_title

type: text attrs: sortable: true no_index: false # Index for search (default) unf: false # Normalize case for sorting (default)

  • name: embedding

type: vector attrs: algorithm: flat dims: 4 distance_metric: cosine datatype: float32 ```

```python from redisvl.schema import IndexSchema

schema = IndexSchema.from_yaml("schemas/schema.yaml") ```

Load schema from Python dictionary

```python from redisvl.schema import IndexSchema

schema = IndexSchema.fromdict({ "index": { "name": "user-idx", "prefix": "user", "storagetype": "json" }, "fields": [ {"name": "user", "type": "tag"}, {"name": "creditscore", "type": "tag"}, { "name": "jobtitle", "type": "text", "attrs": { "sortable": True, "noindex": False, # Index for search "unf": False # Normalize case for sorting } }, { "name": "embedding", "type": "vector", "attrs": { "algorithm": "flat", "datatype": "float32", "dims": 4, "distancemetric": "cosine" } } ] }) ```

> 📚 Learn more about schema design and schema creation.

  1. Create a SearchIndex class with an input schema to perform admin and search operations on your index in Redis:

```python from redis import Redis from redisvl.index import SearchIndex

# Define the index index = SearchIndex(schema, redis_url="redis://localhost:6379")

# Create the index in Redis index.create() ```

> An async-compatible index class also available: AsyncSearchIndex.

  1. Load

and fetch data to/from your Redis instance:

```python data = {"user": "john", "credit_score": "high", "embedding": [0.23, 0.49, -0.18, 0.95]}

# load list of dictionaries, specify the "id" field index.load([data], id_field="user")

# fetch by "id" john = index.fetch("john") ```

Retrieval

Define queries and perform advanced searches over your indices, including vector search, complex filtering, and hybrid search combining semantic and full-text signals.

Quick Reference: Query Types

| Query Type | Use Case | Description | |:---|:---|:---| | VectorQuery | Semantic similarity search | Find similar vectors with optional filters | | RangeQuery | Distance-based search | Vector search within a defined distance range | | FilterQuery | Metadata filtering | Filter and search using metadata fields | | TextQuery | Full-text search | BM25-based keyword search with field weighting | | HybridQuery | Combined search | Combine semantic + full-text signals (Redis 8.4.0+) | | CountQuery | Counting records | Count documents matching filter criteria |

Vector Search

  • VectorQuery - Flexible vector queries with customizable filters enabling semantic search:

```python from redisvl.query import VectorQuery

query = VectorQuery( vector=[0.16, -0.34, 0.98, 0.23], vectorfieldname="embedding", numresults=3, # Optional: tune search performance with runtime parameters efruntime=100 # HNSW: higher for better recall ) # run the vector search query against the embedding field results = index.query(query) ```

  • RangeQuery - Vector search within a defined range paired with customizable filters

Complex Filtering

Build complex filtering queries by combining multiple filter types (tags, numerics, text, geo, timestamps) using logical operators:

```python from redisvl.query import VectorQuery from redisvl.query.filter import Tag, Num

# Combine multiple filter types tagfilter = Tag("user") == "john" pricefilter = Num("price") >= 100

# Create complex filtering query with combined filters query = VectorQuery( vector=[0.16, -0.34, 0.98, 0.23], vectorfieldname="embedding", filterexpression=tagfilter & pricefilter, numresults=10 ) results = index.query(query) ```

  • FilterQuery - Standard search using filters and full-text search
  • CountQuery - Count the number of indexed records given attributes
  • TextQuery - Full-text search with support for field weighting and BM25 scoring

> Learn more about building complex filtering queries.

Hybrid Search

Combine semantic (vector) search with full-text (BM25) search signals for improved search quality:

  • HybridQuery - Native hybrid search combining text and vector similarity (Redis 8.4.0+):

```python from redisvl.query import HybridQuery

hybridquery = HybridQuery( text="running shoes", textfieldname="description", vector=[0.1, 0.2, 0.3], vectorfieldname="embedding", combinationmethod="LINEAR", # or "RRF" numresults=10 ) results = index.query(hybridquery) ```

> Learn more about hybrid search.

Dev Utilities

Vectorizers

Integrate with popular embedding providers to greatly simplify the process of vectorizing unstructured data for your index and queries.

Supported Vectorizer Providers

from redisvl.utils.vectorize import CohereTextVectorizer

# set COHERE_API_KEY in your environment
co = CohereTextVectorizer()

embedding = co.embed(
    text="What is the capital city of France?",
    input_type="search_query"
)

embeddings = co.embed_many(
    texts=["my document chunk content", "my other document chunk content"],
    input_type="search_document"
)

> Learn more about using vectorizers in your embedding workflows.

Rerankers

Integrate with popular reranking providers to improve the relevancy of the initial search results from Redis

Extensions

RedisVL Extensions provide production-ready modules implementing best practices and design patterns for working with LLM memory and agents. These extensions encapsulate learnings from our user community and enterprise customers.

> 💡 Have an idea for another extension? Open a PR or reach out to us at . We're always open to feedback.

Semantic Caching

Increase application throughput and reduce the cost of using LLM models in production by leveraging previously generated knowledge with the SemanticCache.

Example: Semantic Cache Usage

from redisvl.extensions.cache.llm import SemanticCache

# init cache with TTL and semantic distance threshold
llmcache = SemanticCache(
    name="llmcache",
    ttl=360,
    redis_url="redis://localhost:6379",
    distance_threshold=0.1  # Redis COSINE distance [0-2], lower is stricter
)

# store user queries and LLM responses in the semantic cache
llmcache.store(
    prompt="What is the capital city of France?",
    response="Paris"
)

# quickly check the cache with a slightly different prompt (before invoking an LLM)
response = llmcache.check(prompt="What is France's capital city?")
print(response[0]["response"])
>>> Paris

> Learn more about semantic caching for LLMs.

Embedding Caching

Reduce computational costs and improve performance by caching embedding vectors with their associated text and metadata using the EmbeddingsCache.

Example: Embedding Cache Usage

from redisvl.extensions.cache.embeddings import EmbeddingsCache
from redisvl.utils.vectorize import HFTextVectorizer

# Initialize embedding cache
embed_cache = EmbeddingsCache(
    name="embed_cache",
    redis_url="redis://localhost:6379",
    ttl=3600  # 1 hour TTL
)

# Initialize vectorizer with cache
vectorizer = HFTextVectorizer(
    model="sentence-transformers/all-MiniLM-L6-v2",
    cache=embed_cache
)

# First call computes and caches the embedding
embedding = vectorizer.embed("What is machine learning?")

# Subsequent calls retrieve from cache (much faster!)
cached_embedding = vectorizer.embed("What is machine learning?")
>>> Cache hit! Retrieved from Redis in 

> Learn more about [embedding caching](https://docs.redisvl.com/en/stable/user_guide/10_embeddings_cache.html) for improved performance.

### LLM Memory

Improve personalization and accuracy of LLM responses by providing user conversation context. Manage access to memory data using recency or relevancy, *powered by vector search* with the [`MessageHistory`](https://docs.redisvl.com/en/stable/api/message_history.html).

Example: Message History Usage

```python
from redisvl.extensions.message_history import SemanticMessageHistory

history = SemanticMessageHistory(
    name="my-session",
    redis_url="redis://localhost:6379",
    distance_threshold=0.7
)

# Supports roles: system, user, llm, tool
# Optional metadata field for additional context
history.add_messages([
    {"role": "user", "content": "hello, how are you?"},
    {"role": "llm", "content": "I'm doing fine, thanks."},
    {"role": "user", "content": "what is the weather going to be today?"},
    {"role": "llm", "content": "I don't know", "metadata": {"model": "gpt-4"}}
])

# Get recent chat history
history.get_recent(top_k=1)
# >>> [{"role": "llm", "content": "I don't know", "metadata": {"model": "gpt-4"}}]

# Get relevant chat history (powered by vector search)
history.get_relevant("weather", top_k=1)
# >>> [{"role": "user", "content": "what is the weathe

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [redis](https://github.com/redis)
- **Source:** [redis/redis-vl-python](https://github.com/redis/redis-vl-python)
- **License:** MIT
- **Homepage:** https://docs.redisvl.com

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.