UP
OfficialDatabase

Upstash MCP Server: Manage Redis with Natural Language

Manage Redis on Upstash with natural language using the MCP server to run commands, monitor data, and streamline database administration.

Quick Install
npx -y @upstash/mcp-server

Overview

The Upstash MCP Server provides an MCP (Model Context Protocol) compliant API that lets developers manage Upstash Redis instances using natural language and programmatic tool calls. It exposes a small HTTP service that maps high-level requests into Redis operations, and can be used by LLM-based agents or directly by tooling to run commands, inspect keys, and monitor data without embedding Redis credentials in many places.

For developers building chatops, admin dashboards, or AI assistants, the server simplifies Redis administration: it registers a set of Redis-focused tools (get/set/scan/execute/statistics), describes them in an MCP format, and executes them securely against your Upstash database. This reduces friction when integrating Redis into model-driven workflows and helps surface database state to models in a controlled way.

Features

  • MCP-compliant HTTP API that exposes Redis operations as tools
  • Natural language support (optional LLM integration) to translate conversational requests to Redis commands
  • Built-in tool set: get, set, delete, scan, keys, execute (arbitrary Redis commands), and basic stats
  • Works with Upstash Redis via REST credentials (TLS + token-based auth)
  • Docker-ready and simple local development (Node.js)
  • Access control and auditing hooks to limit and log operations

Installation / Configuration

Prerequisites:

  • Node.js 18+ or Docker
  • Upstash Redis REST URL and token
  • Optional: an LLM API key (e.g., OpenAI) to enable natural language translation

Clone and install dependencies:

git clone https://github.com/upstash/mcp-server.git
cd mcp-server
npm install

Create a .env file in the project root with your Upstash credentials and server options:

# .env
PORT=8080
UPSTASH_REDIS_REST_URL=https://us1-xxxxx.upstash.io
UPSTASH_REDIS_REST_TOKEN=your_upstash_token_here

# Optional: enable LLM-based NL -> Redis translation
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini

Start the server locally:

npm run dev
# or for production
npm start

Run with Docker:

docker build -t upstash-mcp-server .
docker run -p 8080:8080 \
  -e UPSTASH_REDIS_REST_URL="$UPSTASH_REDIS_REST_URL" \
  -e UPSTASH_REDIS_REST_TOKEN="$UPSTASH_REDIS_REST_TOKEN" \
  -e PORT=8080 \
  upstash-mcp-server

By default the server listens on PORT (8080). Configure environment variables to match your deployment.

Available Tools / Resources

The server exposes a set of Redis-focused tools in MCP form. Common tool names and behaviors:

Tool NamePurpose
redis.getRetrieve the value of a key
redis.setSet the value of a key (with optional TTL)
redis.delDelete a key
redis.scanIncrementally scan for keys (cursor-based)
redis.execExecute an arbitrary Redis command (use with care)
redis.infoFetch server stats and info
redis.monitorLightweight monitoring / tail of recent commands (if enabled)

Typical MCP endpoints (defaults; check your deployment):

  • GET /mcp/tools — list available tools and their input/output schemas
  • POST /mcp/run — execute a named tool with JSON arguments

Example: fetch tool list

curl http://localhost:8080/mcp/tools

Example: run a tool (GET key “user:123”)

curl -X POST http://localhost:8080/mcp/run \
  -H "Content-Type: application/json" \
  -d '{
    "tool":"redis.get",
    "args":{"key":"user:123"}
  }'

If you enable LLM integration, you can also POST a natural language prompt and let the server translate it to tool invocations:

curl -X POST http://localhost:8080/mcp/ask \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Show sessions created in the last hour"}'

(Implementation depends on whether you supply OPENAI_API_KEY; the server will call your LLM and map the response to tool executions.)

Use Cases

  • ChatOps for Redis: connect a Slack bot or internal chat assistant to the MCP Server so engineers can query keys, inspect counters, or clear caches with natural language.
  • Safe LLM-assisted administration: allow an LLM agent to run read-only exploration (scan/get/info) and limited write operations (set/del) under an auditable gateway rather than giving the model direct database credentials.
  • Data exploration and debugging: developers can ask for recent keys, sample values, or usage stats during incident response without switching clients.
  • Automation