Nextjs Cache Handler Mcp

io.github.leejpsd由 GitHub 账号 leejpsd 发布v0.1.2更新于 Oct 24, 2026

Inspect and operate Next.js Redis caches: health, tag state, SWR simulation, safe invalidation.

概览

AI 生成的概览

通过本地 stdio 检查与操作 Next.js Redis 缓存,涵盖健康状态、标签、SWR 模拟与安全失效。

可以做什么
检查 Redis 缓存健康状态,并按层级与类型列出已缓存内容。按模式搜索缓存键,并解析原始 Redis 键的层级、类型、命名空间与键名。解码单个缓存条目,查看类型、年龄、标签、TTL、压缩与大小。查询某个标签在两层缓存上是否已失效,并模拟条目在新鲜、过期或已过期时读取会发生什么。以软性或硬性方式使标签失效,默认仅试运行,需明确确认才实际执行。
适用场景
适用于使用 @leejpsd/nextjs-cache-handler 搭配 Redis 的 Next.js 部署,需要排查页面为何不更新、标签是否已失效,或缓存条目处于新鲜、过期或已过期状态时。
运行要求
需在本机以 npm 包运行(npx),并可连接 Redis。必须设置 REDIS_URL 连接字符串;建议设置 DEPLOYMENT_VERSION 以限定命名空间。若处理器使用自定义前缀,另需 CACHE_KEY_PREFIX 或 ISR_KEY_PREFIX;Redis Cluster 配合 hashTag 时需设置 HASH_TAG。若 Redis 位于 VPC 内(如 ElastiCache),需先建立 SSH 隧道或堡垒机。
安装前请注意
需要 Redis 连接字符串(REDIS_URL),属于敏感凭据,请通过环境变量提供并避免泄露。invalidate_tag 会更改缓存数据,虽默认试运行,仍须确认参数后才会实际失效标签。服务器会连接您自己的 Redis,请确认指向正确的部署命名空间,以免影响其他环境。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Nextjs Cache Handler Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

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):

json
{  "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

ToolWhat it answersWrites?
cache_healthIs Redis up? What's cached, per layer/kind?no
cache_searchWhich keys match this pattern?no
cache_inspectDecode one entry: kind, age, tags, TTL, compression, sizesno
tag_stateIs this tag invalidated right now, on BOTH cache layers?no
explain_keyParse a raw Redis key into layer/kind/namespace/keyno
simulate_swrWould this entry be fresh / stale / expired, and what happens on read?no
invalidate_tagSoft (SWR) or hard invalidation — dry-run unless confirm: truegated

Env: REDIS_URL (required), DEPLOYMENT_VERSION (recommended — scopes namespace-aware tools), CACHE_KEY_PREFIX / ISR_KEY_PREFIX (only when the handlers use custom prefixes).

来源:mcp/README.md,提交 348ec05

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分