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、壓縮與大小。查詢某個標籤在兩層快取上是否已失效,並模擬項目在新鮮、過期或已過期時讀取會發生什麼。以軟性或硬性方式讓標籤失效,預設為試跑,需明確確認才實際執行。
適用情境
當 Next.js 部署使用 @leejpsd/nextjs-cache-handler 搭配 Redis,且需要釐清頁面為何沒有更新、標籤是否已失效或快取項目處於新鮮、過期或已過期狀態時適用。
執行需求
需在本機以 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 分