About nextjs-cache-handler-mcp
nextjs-cache-handler-mcp is an MCP server for inspecting and operating Next.js Redis caches, aimed at developers and AI agents working with deployments. It checks tag state, simulates SWR behavior, and gates invalidation behind confirmation.
Key features
- 01Check Redis cache health
- 02Search and decode cache entries
- 03Inspect tag state across both layers
- 04Simulate SWR freshness and reads
- 05Soft or hard tag invalidation
Use cases
- 01Diagnosing why a page is not updating
- 02Checking entry TTLs and tags
- 03Assessing invalidation across cache layers
- 04Invalidating a tag after confirmation
MCP support
The local stdio MCP server connects to the user's Redis and gives AI agents cache inspection and operation tools; invalidation is a dry run unless confirmed.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y @leejpsd/nextjs-cache-handler-mcpREDIS_URLSecretRedis connection string the cache handler usesDEPLOYMENT_VERSIONDeploy namespace (recommended)HASH_TAGSet 'true' when handlers use hashTag: true (Redis Cluster)Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
7Saved tool list · updated 2w ago
This tool takes no parameters.
Details
From the project README@leejpsd/nextjs-cache-handler-mcp
MCP (Model Context Protocol) server for
@leejpsd/nextjs-cache-handler
Redis caches. Lets AI agents (Claude Code, Cursor, …) inspect and operate a
running deployment's Next.js cache: "why isn't this page updating?"
becomes a tag_state call instead of guesswork.
Setup
Project .mcp.json (Claude Code picks this up automatically):
{
"mcpServers": {
"nextjs-cache": {
"command": "npx",
"args": ["-y", "@leejpsd/nextjs-cache-handler-mcp"],
"env": {
"REDIS_URL": "redis://127.0.0.1:6379",
"DEPLOYMENT_VERSION": "your-deploy-id"
}
}
}
}
Runs locally over stdio and connects to YOUR Redis — nothing is hosted.
AWS/ElastiCache note: ElastiCache is VPC-internal, so a locally running MCP server needs an SSH tunnel/bastion (point REDIS_URL at the tunnel). Agents running inside the VPC (CI, in-cluster) connect directly. Pair with the AWS agent skills/MCP: they handle the infrastructure, this server handles cache semantics.
Tools
| Tool | What it answers | Writes? |
|---|---|---|
cache_health | Is Redis up? What's cached, per layer/kind? | no |
cache_search | Which keys match this pattern? | no |
cache_inspect | Decode one entry: kind, age, tags, TTL, compression, sizes | no |
tag_state | Is this tag invalidated right now, on BOTH cache layers? | no |
explain_key | Parse a raw Redis key into layer/kind/namespace/key | no |
simulate_swr | Would this entry be fresh / stale / expired, and what happens on read? | no |
invalidate_tag | Soft (SWR) or hard invalidation — dry-run unless confirm: true | gated |
Env: REDIS_URL (required), DEPLOYMENT_VERSION (recommended — scopes
namespace-aware tools), CACHE_KEY_PREFIX / ISR_KEY_PREFIX (only when the
handlers use custom prefixes).
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.