关于 YourSUUID
yoursuuid 是用于生成、验证和解码标识符的 JavaScript 库,也提供 CLI 和 MCP 服务,面向开发者。它支持多种 UUID、ULID 和 NanoID,并附带 HMAC、JWT、代码转换等开发工具。
主要功能
- 01生成 UUID v4、v5、v7、ULID 和 NanoID
- 02验证并解析 UUID 信息
- 03提供命令行生成与检查命令
- 04提供 HMAC、JWT 和 bcrypt 工具
- 05转换 JSON、SQL 与代码格式
适用场景
- 01为应用生成不同类型的标识符
- 02检查 UUID 版本、变体和时间戳
- 03在命令行批量生成或检查 ID
- 04通过 MCP 调用开发辅助工具
MCP 相关
MCP 服务向 AI 助手提供标识符生成与检查,以及 HMAC、JWT、bcrypt 和代码转换等工具。托管端点提供标识符工具;HMAC、JWT 和 bcrypt 在本地运行。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://yoursuuid.com/mcpclaude mcp add --transport http sohan724code-yoursuuid https://yoursuuid.com/mcp{"mcpServers":{"sohan724code-yoursuuid":{"type":"http","url":"https://yoursuuid.com/mcp"}}}在 Cursor 中打开{"servers":{"sohan724code-yoursuuid":{"type":"http","url":"https://yoursuuid.com/mcp"}}}在 VS Code 中打开{"mcpServers":{"sohan724code-yoursuuid":{"type":"http","url":"https://yoursuuid.com/mcp"}}}{"mcpServers":{"sohan724code-yoursuuid":{"serverUrl":"https://yoursuuid.com/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
详细介绍
yoursuuid
零依赖的 UUID v4 / v5 / v7、ULID 和 NanoID 生成、验证与解码库,适用于浏览器、Node 20+、 Deno、Bun 和边缘运行时。提供 CLI 和 MCP 服务。采用 MIT 许可证。
随机数仅来自 crypto.getRandomValues。UUID v7 和 ULID 在进程内保持单调递增,因此同一毫秒内创建的 ID 仍会按创建顺序排序。
安装
npm install yoursuuid
库
import { uuidv4, uuidv7, uuidv5, ulid, nanoid, parseUuid, isUuid } from 'yoursuuid'
uuidv7() // '0192d3a1-7c4f-7b2a-9d1e-3f5a6b7c8d9e'
uuidv4() // random v4
await uuidv5('example.com', 'dns') // deterministic, SHA-1 name-based
ulid() // '01JB8S3Y2F7Q9X4M5N6P7R8S9T'
nanoid(12) // 'V1StGXR8_Z5j'
parseUuid('0192d3a1-7c4f-7b2a-9d1e-3f5a6b7c8d9e')
// { valid: true, uuid: '…', version: 7, variant: 'rfc9562', timestamp: Date(2024-10-28T14:57:08.687Z) }
isUuid('{0192D3A1-7C4F-7B2A-9D1E-3F5A6B7C8D9E}') // true — braces, urn:uuid: and missing hyphens are accepted
开发者工具(yoursuuid/devtools)
import { hmac, jsonToTypescript, jsonToZod, describeCron, cronNextRuns, jwtSign, bcryptHash } from 'yoursuuid/devtools'
await hmac('SHA-256', 'secret', 'message') // hex; also 'base64' and 'base64url'
jsonToTypescript('{"id":1,"tags":["a"]}', { rootName: 'User' })
jsonToZod('{"id":1}', { rootName: 'User' })
describeCron('0 9 * * 1-5') // 'At 09:00 on Monday through Friday'
cronNextRuns('*/15 * * * *', { count: 3, utc: true }) // [Date, Date, Date]
await jwtSign({ sub: 'a' }, 'secret', 'HS256')
bcryptHash('password', 10)
Cron 遵循标准的 5 字段 Vixie 语义:名称(JAN、MON)、范围、步长、列表、7 = 星期日、@daily 风格的宏,以及当日期和星期都受限时采用“日期或星期”的规则。
CLI
npx yoursuuid # one UUID v4
npx yoursuuid v7 -n 5 # five UUID v7
npx yoursuuid ulid -n 3
npx yoursuuid nanoid --size 12
npx yoursuuid v5 example.com --namespace dns
npx yoursuuid inspect 0192d3a1-7c4f-7b2a-9d1e-3f5a6b7c8d9e
npx yoursuuid hmac "message" --key secret --alg sha256
npx yoursuuid jwt sign '{"sub":"a"}' --secret secret
npx yoursuuid bcrypt hash "password" --cost 10
npx yoursuuid cron "*/15 9-17 * * 1-5" --utc
npx yoursuuid cron build --minute 0 --hour 9 --dow 1-5
curl -s https://api.github.com/users/octocat | npx yoursuuid json2ts --name User
npx yoursuuid json2zod payload.json --name User
npx yoursuuid chmod 755
npx yoursuuid compose "docker run -d -p 8080:80 nginx"
标志:--upper、--no-hyphens。
MCP 服务
让 AI 助手(Claude、Cursor、VS Code、Windsurf……)在本地生成和检查标识符。
{
"mcpServers": {
"yoursuuid": { "command": "npx", "args": ["-y", "yoursuuid", "mcp"] }
}
}
工具:generate_uuid、generate_uuid_v5、generate_ulid、generate_nanoid、inspect_uuid、hmac、
jwt_sign、jwt_verify、bcrypt_hash、bcrypt_verify、base58、base32、json_to_typescript、
json_to_zod、json_to_go、json_to_rust、format_sql、curl_to_code、cron_next_runs、build_cron、
explain_regex、explain_chmod、docker_run_to_compose。
不想安装?托管的 Streamable HTTP 端点 https://yoursuuid.com/mcp 提供标识符工具。HMAC、JWT
和 bcrypt 仍在本地服务上运行,因此密钥不会离开你的设备。
为什么使用 v7?
UUID v7 将毫秒级时间戳置于开头,因此数据库索引会按顺序接收键,而不是随机分散到各个页面。 参见 UUID v7 可视化工具和 冲突计算器。
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。