Skip to main content
MCP server CX Codex

nextjs-cache-handler-mcp — Claude Code MCP server

This MCP server lets an AI agent inspect a Next.js Redis cache, trace tag state, model SWR reads, and invalidate tags with a confirmation gate.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env REDIS_URL=<REDIS_URL> --env DEPLOYMENT_VERSION=<DEPLOYMENT_VERSION> --env HASH_TAG=<HASH_TAG> --transport stdio mcp -- npx -y @leejpsd/nextjs-cache-handler-mcp
Open on GitHub

What nextjs-cache-handler-mcp does

The server exposes cache diagnostics for a running Next.js deployment. An agent can test Redis health, search matching keys, decode one entry, and inspect its layer, kind, tags, TTL, age, compression, and size. It can also split a raw Redis key into its namespace parts. tag_state checks invalidation across both cache layers, while simulate_swr predicts whether a read sees fresh, stale, or expired data.

invalidate_tag offers soft and hard invalidation, but remains a dry run until confirm: true is supplied. The process runs on the machine hosting the MCP setup and reaches Redis through REDIS_URL, which is required. DEPLOYMENT_VERSION scopes namespace-aware operations; custom cache handlers may also need CACHE_KEY_PREFIX or ISR_KEY_PREFIX. For AWS ElastiCache, a local process needs an SSH tunnel or bastion into the VPC. Without REDIS_URL, the server cannot connect to Redis.

What it helps with

  • check Redis health and cache contents
  • search Next.js keys by pattern
  • inspect an entry’s tags and TTL
  • trace tag invalidation across cache layers
  • predict fresh, stale, or expired reads

Example prompts for the agent

  • Ask the agent to run cache_health and report the Redis status and cached layers.
  • Use tag_state to check whether the products tag is invalidated on both layers.
  • Run simulate_swr for this entry and explain what a read will do.

How to install nextjs-cache-handler-mcp

Platform CLI

claude mcp add --env REDIS_URL=<REDIS_URL> --env DEPLOYMENT_VERSION=<DEPLOYMENT_VERSION> --env HASH_TAG=<HASH_TAG> --transport stdio mcp -- npx -y @leejpsd/nextjs-cache-handler-mcp

Replace <…> with your own values

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about nextjs-cache-handler-mcp

How do I install nextjs-cache-handler-mcp in Claude Code?

Run claude mcp add nextjs-cache-handler-mcp -e REDIS_URL=<REDIS_URL> -- npx -y @leejpsd/nextjs-cache-handler-mcp. This registers the server with the required REDIS_URL variable.

What does nextjs-cache-handler-mcp do?

It gives an agent access to Next.js Redis cache diagnostics, including key searches, tag status, SWR simulation, and controlled tag invalidation. Invalidation stays in dry-run mode until confirm: true is passed.

How does it connect to AWS ElastiCache?

A locally running process needs an SSH tunnel or bastion into the VPC, with REDIS_URL aimed at that tunnel. A process inside the VPC can connect directly.

Similar MCP servers

All MCP servers for Backend and APIs →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor