Cacheport

io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.0更新於 Nov 7, 2026

Key-value cache over Redis: set, get, delete and list keys.

已驗證STDIO僅桌面資料庫檔案與儲存

概覽

AI 產生的概覽

輕量的 stdio MCP 伺服器,讓助理透過一般 TCP 連線對 Redis 快取執行 set、get、delete 與 list 操作。

可以做什麼
  • 設定鍵值對,可選擇以秒為單位的到期時間
  • 依鍵讀取值,鍵不存在時回傳 null
  • 刪除單一或多個鍵,並回報實際刪除的數量
  • 依 Redis glob 模式列出鍵名,預設列出全部鍵
適用情境
適合助理需要在既有 Redis 執行個體中讀寫短期快取資料的情況,例如在步驟之間暫存工作階段資料、功能旗標或臨時值。它只是簡單的鍵值前端,並非通用的 Redis 管理工具。
執行需求
透過 npx 或 Docker 映像以 stdio 在本機執行。需要可連線的 Redis 伺服器,目標以 redis:// 或 rediss:// URL 提供,可經由 REDIS_URL、CACHEPORT_REDIS_URL,或拆分變數 REDIS_HOST、REDIS_PORT、REDIS_PASSWORD 指定,預設連線 localhost:6379。MCP 伺服器本身未宣告任何驗證。
安裝前請注意
這些工具會寫入、覆寫與刪除所連線 Redis 資料庫中的資料,delete 一次可刪除多個鍵,請只指向可承受資料遺失的快取。密碼可能出現在 URL 或 REDIS_PASSWORD 中,避免寫入共用設定。list 使用 KEYS 指令,在大型資料庫上可能較慢。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Cacheport,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

cacheport

cacheport is a small, honest front end for a Redis cache. It stores a value under a key (optionally with an expiry), reads it back, deletes one key or several at once, and lists the keys that match a glob pattern. That is the whole job, and it does it by speaking Redis's own wire protocol, RESP, over a plain TCP socket — there is no client library bundled and nothing between you and the server's actual replies.

When Redis is not there, cacheport says so. The MCP server starts and lists its tools with no server behind it at all; only an actual operation touches the socket, and a refused connection or a server error comes back as an error, never as a made-up value.

Install

bash
npx @reneturcios/cacheport get mykey

Or run the container image:

bash
docker run -i ghcr.io/cloudcorprecords/cacheport

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

bash
# Store a value, with and without an expirycacheport set greeting "hello world"cacheport set session abc123 --expire-seconds 3600
# Read it back (prints (nil) when the key is gone)cacheport get greeting
# Delete one key, or several in one call; prints how many were removedcacheport delete greetingcacheport delete session old-session temp-key
# List keys; the pattern is a Redis glob and defaults to *cacheport listcacheport list "user:*"
# Start the MCP server (Redis URL optional, see below)cacheport mcp redis://localhost:6379
cacheport --version

Exit codes: 0 on success, 1 when the cache or the connection fails (the error says which), 2 for usage errors.

The target is a normal Redis URL: redis:// or rediss://, with a host, an optional port (default 6379), an optional password in the userinfo, and an optional database index as the path (/2 selects db 2). Commands and mcp alike can take the target from the environment instead: REDIS_URL first, then CACHEPORT_REDIS_URL, then the split variables REDIS_HOST / REDIS_PORT / REDIS_PASSWORD (or their CACHEPORT_ spellings). With none of those set, cacheport talks to localhost:6379.

How it talks to Redis

Each operation opens a connection, writes the command as a RESP array of bulk strings, and decodes the reply — a simple string for SET, a bulk string (or nil) for GET, an integer for DEL, an array for KEYS. When the target carries a password or a non-zero database index, AUTH and SELECT run first on the same connection. Server error replies surface with the server's own message attached.

An expiry passed to set is sent as EX <seconds>; fractional seconds are floored, and a non-positive expiry is refused before anything is sent.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/cacheport mcp redis://localhost:6379

MCP client configuration:

json
{  "mcpServers": {    "cacheport": {      "command": "npx",      "args": ["-y", "@reneturcios/cacheport", "mcp"],      "env": { "REDIS_URL": "redis://localhost:6379" }    }  }}

Tools

ToolInputWhat it returns
setkey (string, required), value (string, required), expireSeconds (number, optional)The server status reply, normally OK.
getkey (string, required)The stored string, or null when the key does not exist.
deletekey (string or array of strings, required)How many keys were actually removed.
listpattern (string, optional, default *)The key names matching the glob pattern.

Connection failures and server errors come back as tool errors with the underlying message — never as invented values.

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # node test runner over test/*.test.ts, no network, no live Redisnpm run dev     # run the CLI from source via tsx

The core logic sits behind an injectable executor interface, which is what the test suite drives: the RESP encoder and decoder, URL parsing, and all four operations are covered against a fake in-memory executor.

License

MIT — see LICENSE.

來源:README.md,提交 100c4b5

工具

4

set

Set a Redis key-value pair with optional expiration

輸入參數key必填value必填expireSeconds

get

Get a value by key from Redis

輸入參數key必填

delete

Delete one or more keys from Redis

輸入參數key必填

list

List Redis keys matching a pattern

輸入參數pattern

版本歷史

1
  1. v0.1.0最新Oct 31, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分