Skip to main content
Glama
igorgrv1

@igorromero/ciphersuite-mcp

by igorgrv1

ciphersuite-mcp

AES-256-CBC 暗号化・復号化ツール、各アルゴリズムを説明するリソース、すぐに使えるプロンプトを提供する MCP (Model Context Protocol) サーバーです。これらはすべて VS Code Copilot Chat 内で直接実行できます。

tools

Related MCP server: Secret Vault MCP Server

機能

種別

名前

説明

🔧 ツール

encrypt_message

任意の平文メッセージをパスフレーズで暗号化します

🔧 ツール

decrypt_message

以前暗号化したメッセージを同じパスフレーズで復号化します

📄 リソース

encryption://info

暗号化アルゴリズム、鍵導出、出力形式に関する詳細を返します

📄 リソース

decryption://info

復号化ツールの使い方を返します(期待される形式、パスフレーズのルール、よくあるエラー)

💬 プロンプト

encrypt_message_prompt

エージェントにメッセージの暗号化を依頼するビルド済みプロンプトです

💬 プロンプト

decrypt_message_prompt

エージェントにメッセージの復号化を依頼するビルド済みプロンプトです

暗号化の仕組み

  • アルゴリズム: AES-256-CBC

  • 鍵導出: scrypt(passphrase, fixedSalt, 32) — 任意のパスフレーズ文字列を渡すと、サーバーが強力な32バイトの鍵を自動的に導出します

  • 出力形式: <IV(16進数)>:<暗号文(16進数)> — 後で復号化するために、完全な文字列を保持してください

  • IV: 暗号化のたびに新しいランダムな16バイトの IV が生成されるため、同じメッセージを2回暗号化すると異なる出力になります


前提条件

  • Node.js v24+package.jsonengines を参照)


インストール

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"]
    }
  }
}

ヒント: このサーバーを ~/.vscode/mcp.json のユーザーレベル MCP 設定に追加すると、すべてのワークスペースで利用できるようになります。

2. VS Code をリロードする

コマンドパレット(Cmd+Shift+P)を開き、Developer: Reload Window を実行します(または VS Code を再起動するだけでも構いません)。

3. Copilot Chat で使用する

Copilot Chat(エージェントモード)を開いて、次を試してください:

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

利用可能なスクリプト

スクリプト

説明

npm start

サーバーを起動します(MCP クライアントが使用)

npm run dev

ファイル監視と Node.js インスペクタ付きで起動します

npm test

すべてのテストを実行します

npm run test:dev

ウォッチモードでテストを実行します

npm run mcp:inspect

MCP Inspector UI を開きます



ゼロから作成する

このセクションでは、この MCP サーバーを段階的に構築した方法を説明します — 将来新しい MCP サーバーを作成する際に役立ちます。

MCP トランスポートの種類

MCP トランスポートには3種類あります:

種類

クラス

説明

stdio

StdioServerTransport

マシン上でローカルに実行されます — ローカルツールでは最も一般的です

http

HTTP 経由の API として実行されます

sse

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. ツールの登録

tools

ツールは、LLM がアクションを実行するために呼び出せる関数です。3つの引数を取る server.registerTool を使用します:

  1. ツールの名前(文字列)

  2. 次を含む設定オブジェクト

    • description — ツールが何をするか。LLM はこれを参照して呼び出しタイミングを判断します

    • inputSchema — リクエストボディに相当し、Zod で定義します

    • outputSchema — レスポンスボディに相当し、Zod で定義します

  3. 非同期ハンドラー関数 — 実際の実装

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 にも同じパターンが当てはまります。入出力スキーマのフィールドを入れ替えて、代わりに decrypt() を呼び出すだけです。


4. リソースの登録

resource

リソースは、LLM がツールの周辺コンテキストを理解するのに役立つ、静的または計算済みの情報を提供します。4つの引数を取る server.registerResource を使用します:

  1. リソースの名前

  2. URI テンプレート(通常は名前と同じ)

  3. description を含む設定オブジェクト

  4. contents を返すハンドラー関数urimimeTypetext を持つオブジェクトの配列

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. プロンプトの登録

prompt

プロンプトは、LLM がガイド付きでツールを呼び出すために使用できる、ビルド済みのメッセージテンプレートです。3つの引数を取る server.registerPrompt を使用します:

  1. プロンプトの名前

  2. 次を含む設定オブジェクト

    • description — プロンプトが何をするか

    • argsSchema — 入力パラメータ。Zod で定義します

  3. messages を返すハンドラー関数roleuser または 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 も同じパターンです。encryptedMessageencryptionKey を引数に取り、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 互換のクライアントならどれでも接続できます。

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    A
    quality
    C
    maintenance
    Enables AI memory persistence and secure credential management via vault tools for MCP-compatible clients like Claude Desktop, Cursor, and VS Code.
    12
    17
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    AES-256-GCM encrypted local secret storage exposed as MCP tools, with secrets captured via native OS dialogs and never passing through the LLM API.
  • A
    license
    Not graded
    quality
    C
    maintenance
    Exposes OS keychain or AES-256-GCM encrypted file secrets as MCP tools, allowing reading, setting, and listing secrets without exposing values in conversation messages.
    10
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for sovereign AES-256-GCM backup encryption and decryption. Enables encrypting, decrypting, verifying, and scoring passphrases with zero network calls.
    MIT

View all related MCP servers

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

View all MCP Connectors

Latest Blog Posts

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