@igorromero/ciphersuite-mcp
ciphersuite-mcp
一个提供 AES-256-CBC 加密和解密工具、描述每种算法的资源以及现成可用提示词的 MCP (Model Context Protocol) 服务器——所有这些都可以直接在 VS Code Copilot Chat 中运行。
Related MCP server: Secret Vault MCP Server
功能
能力 | 名称 | 描述 |
🔧 工具 |
| 使用口令加密任何明文消息 |
🔧 工具 |
| 使用相同口令解密先前加密的消息 |
📄 资源 |
| 返回有关加密算法、密钥派生和输出格式的详细信息 |
📄 资源 |
| 返回如何使用解密工具:预期格式、口令规则和常见错误 |
💬 提示词 |
| 预先构建的提示词,要求智能体加密一条消息 |
💬 提示词 |
| 预先构建的提示词,要求智能体解密一条消息 |
加密工作原理
算法:AES-256-CBC
密钥派生:
scrypt(passphrase, fixedSalt, 32)——你可以传入任意口令字符串;服务器会自动派生出一个强 32 字节密钥输出格式:
<IV in hex>:<ciphertext in hex>——请保留完整字符串以便稍后解密IV:每次加密调用都会生成一个新的随机 16 字节 IV,因此同一消息加密两次会产生不同的输出
先决条件
Node.js v24+(参见
package.json中的engines)
安装
npm install无需构建步骤——服务器通过 Node.js 原生 TypeScript 支持直接运行 TypeScript。
在 VS Code 中使用
1. 添加 MCP 服务器配置
在工作区中创建(或打开).vscode/mcp.json,然后添加:
{
"servers": {
"ciphersuite-mcp": {
"command": "node",
"args": ["--experimental-strip-types", "ABSOLUTE_PATH_TO_PROJECT/src/index.ts"]
}
}
}或通过 npm:
{
"servers": {
"ciphersuite-mcp": {
"command": "npx",
"args": ["-y", "@igorromero/ciphersuite-mcp"]
}
}
}提示: 你还可以将此服务器添加到用户级 MCP 配置
~/.vscode/mcp.json,以使其在每个工作区中都可用。
2. 重新加载 VS Code
打开命令面板(Cmd+Shift+P)并运行 Developer: Reload Window(或直接重启 VS Code)。
3. 在 Copilot Chat 中使用
打开 Copilot Chat(Agent 模式)并尝试:
Encrypt the message "Hello, World!" using the passphrase "my-secret-key"Decrypt this message: a3f1...:<ciphertext> using the passphrase "my-secret-key"Show me the encryption://info resource智能体会自动调用合适的工具并返回结果。
运行 MCP Inspector
MCP Inspector 可让你在浏览器 UI 中交互式地探索和测试所有工具、资源和提示词:
npm run mcp:inspect这将在 http://localhost:5173 打开检查器,并将其连接到正在运行的服务器。
运行测试
# Run all tests once
npm test
# Run tests in watch mode (with debugger)
npm run test:dev测试套件涵盖:
加密一条消息
使用正确口令解密消息
列出并读取
encryption://info资源获取两个提示词
错误:使用错误口令解密
错误:解密格式错误的密文
项目结构
src/
index.ts # Entry point — connects the server to stdio transport
mcp.ts # All tools, resources, and prompts are registered here
tests/
mcp.test.ts可用脚本
脚本 | 描述 |
| 启动服务器(供 MCP 客户端使用) |
| 以文件监视和 Node.js 检查器模式启动 |
| 运行所有测试 |
| 以监视模式运行测试 |
| 打开 MCP Inspector UI |
从零开始创建
本节记录了如何一步一步构建此 MCP 服务器——对于将来创建新的 MCP 服务器很有用。
MCP 传输类型
MCP 传输有 3 种类型:
类型 | 类 | 描述 |
|
| 在机器本地运行——本地工具中最常用 |
| — | 作为基于 HTTP 的 API 运行 |
| — | Server-Sent Events——按需处理数据(流式) |
依赖项
// package.json
"dependencies": {
"@modelcontextprotocol/sdk": "^1.27.1",
"@types/node": "^24.11.0",
"zod": "^3.25.76"
}1. 入口点——src/index.ts
入口点创建一个 StdioServerTransport 并将 MCP 服务器连接到它:
// src/index.ts
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { server } from "./mcp.ts";
async function main() {
const transport = new StdioServerTransport()
await server.connect(transport)
console.error('Encrypt MCP Server running on stdio')
}
main().catch((error) => {
console.error("Fatal error in main():", error);
process.exit(1);
});2. 服务器设置——src/mcp.ts
创建带有名称和版本的 MCP 服务器实例:
// src/mcp.ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
export const server = new McpServer({
name: '@igorromero/ciphersuite-mcp',
version: '0.0.1'
})3. 注册工具

工具是 LLM 可以调用以执行操作的函数。使用 server.registerTool,它接受 3 个参数:
工具的名称(字符串)
配置对象,包含:
description——工具的作用;LLM 使用它来决定何时调用inputSchema——相当于请求体,使用 Zod 定义outputSchema——相当于响应体,使用 Zod 定义
异步处理函数——实际实现
server.registerTool(
'encrypt_message',
{
description: 'Encrypt a message',
inputSchema: {
message: z.string().describe("The message to encrypt"),
encryptionKey: z.string().describe(
"Any passphrase to use for encryption — the server derives a strong key from it automatically"
)
},
outputSchema: {
encryptedMessage: z.string().describe(
"The encrypted message (format: iv:ciphertext)"
)
}
},
async ({ message, encryptionKey }) => {
try {
const encryptedMessage = encrypt(message, encryptionKey)
return {
content: [{ type: "text", text: encryptedMessage }],
structuredContent: { encryptedMessage }
}
} catch (error) {
return {
isError: true,
content: [{
type: 'text',
text: `Failed to encrypt message! Error: ${error instanceof Error ? error.message : String(error)}`
}]
}
}
}
)同样的模式也适用于 decrypt_message——只需交换输入/输出 schema 字段并改为调用 decrypt() 即可。
4. 注册资源

资源提供静态或计算信息,帮助 LLM 理解与工具相关的上下文。使用 server.registerResource,它接受 4 个参数:
资源的名称
URI 模板(通常与名称相同)
配置对象,包含
description处理函数,返回
contents——一个由带有uri、mimeType和text的对象组成的数组
server.registerResource(
'encryption://info',
'encryption://info',
{
description: 'Describes the encryption algorithm, key requirements, and output format used by this server',
},
() => ({
contents: [
{
uri: "encryption://info",
mimeType: "text/plain",
text: `
Algorithm : AES-256-CBC
Key derivation: scrypt (passphrase + fixed server salt → 32-byte key)
Output format: <16-byte IV in hex>:<ciphertext in hex> (separated by ":")
Notes:
- Users pass any passphrase — the server derives a strong 32-byte key automatically using scrypt.
- A random IV is generated for every encryption — the same message encrypted twice will produce different output.
- Use the exact same passphrase to decrypt.
- Keep the full "iv:ciphertext" string to decrypt later.
`.trim(),
},
]
})
)decryption://info 资源遵循相同的模式,描述了解密工具的预期输入格式、口令要求和常见错误场景。
5. 注册提示词

提示词是预先构建的消息模板,LLM 可借此以受引导的方式调用工具。使用 server.registerPrompt,它接受 3 个参数:
提示词的名称
配置对象,包含:
description——提示词的作用argsSchema——输入参数,使用 Zod 定义
处理函数,返回
messages——一个由带有role(user或assistant)和content的对象组成的数组
server.registerPrompt(
"encrypt_message_prompt",
{
description: "Prompt to encrypt a plain-text message using the encrypt_message tool",
argsSchema: {
message: z.string().describe("The message to encrypt"),
encryptionKey: z.string().describe(
"Any passphrase to use for encryption — the server derives a strong key from it automatically"
)
}
},
({ message, encryptionKey }) => ({
messages: [
{
role: 'user',
content: {
type: "text",
text: `Please encrypt the following message using the encrypt_message tool.\nMessage: ${message}\nEncryption key: ${encryptionKey}`,
}
}
]
})
)decrypt_message_prompt 遵循相同的模式——将 encryptedMessage 和 encryptionKey 作为参数,并指示 LLM 调用 decrypt_message。
6. 将 MCP 服务器连接到 IDE
VS Code(自动)
在项目根目录下创建 .vscode/mcp.json。VS Code 会自动检测到它:
{
"servers": {
"ciphersuite-mcp": {
"command": "node",
"args": [
"--experimental-strip-types",
"src/index.ts"
]
}
}
}其他 IDE / 其他项目
将 ciphersuite-mcp 服务器条目复制到目标项目或 IDE 的 MCP 配置文件中。服务器通过 stdio 作为子进程运行,因此任何兼容 MCP 的客户端都可以连接到它。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
AlicenseAqualityCmaintenanceEnables AI memory persistence and secure credential management via vault tools for MCP-compatible clients like Claude Desktop, Cursor, and VS Code.1217MIT- FlicenseNot gradedqualityCmaintenanceAES-256-GCM encrypted local secret storage exposed as MCP tools, with secrets captured via native OS dialogs and never passing through the LLM API.
- AlicenseNot gradedqualityCmaintenanceExposes OS keychain or AES-256-GCM encrypted file secrets as MCP tools, allowing reading, setting, and listing secrets without exposing values in conversation messages.10MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for sovereign AES-256-GCM backup encryption and decryption. Enables encrypting, decrypting, verifying, and scoring passphrases with zero network calls.MIT
Related MCP Connectors
Production-grade cryptography toolkit with 31 MCP tools for classical, PQC, and KMS workflows.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
MCP server teaching AI agents to implement TideCloak: auth, E2EE, IGA, security analysis
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/igorgrv1/AI-MCP-from-scratch'
If you have feedback or need assistance with the MCP directory API, please join our Discord server