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 分