wjdwo951219

MCP-Cipher

Community wjdwo951219
Updated

MCP-Cipher

MCP-Cipher is a Java-based Model Context Protocol (MCP) compatible tool that provides cryptographic operations such as AES/RSA encryption, hashing, HMAC, and key generation.

It is designed to be used by any AI agent or tool host that supports the MCP specification.

โšก Secure, Extensible, and Lightweight

MCP-Cipher is designed to be:

  • Secure, using standard Java crypto libraries (AES, RSA, SHA, HMAC)
  • Extensible, with modular classes (AESTool, RSATool, HashTool)
  • Lightweight, using no external cryptography dependencies

Installation

Please refer to the ๐Ÿ“„llms-install.md file for step-by-step installation instructions for Claude Desktop, MCP CLI, and more.

Features by Category

๐Ÿ” AES (AESTool)

  • encryptAES(plainText, key) โ€“ AES encryption (ECB mode, Base64)
  • decryptAES(cipherText, key) โ€“ AES decryption
  • encryptAESWithIV(plainText, key) โ€“ AES CBC mode with random IV (returns IV:cipherText)
  • decryptAESWithIV(cipherWithIV, key) โ€“ AES CBC decryption
  • generateAESKey(bitSize) โ€“ Generate 128/192/256-bit AES key
  • validateAESKey(key) โ€“ Check key validity (length, non-null)
  • encryptJSON(json, key) โ€“ AES CBC encryption for JSON
  • decryptJSON(cipher, key) โ€“ AES CBC decryption for JSON
  • toHex(byte[]) / fromHex(hex) โ€“ Hex encoding/decoding

๐Ÿ” RSA (RSATool)

  • generateRSAKeyPair() โ€“ Generates a Base64 public/private key pair
  • encryptRSA(plainText, publicKey) โ€“ Encrypt using public key
  • decryptRSA(cipherText, privateKey) โ€“ Decrypt using private key
  • encryptLongRSA(plainText, publicKey) โ€“ Encrypt long string (chunked)
  • decryptLongRSA(cipherText, privateKey) โ€“ Decrypt long RSA text
  • signData(data, privateKey) โ€“ Sign data using RSA private key
  • verifySignature(data, signature, publicKey) โ€“ Verify RSA signature
  • formatKeyToPEM(base64Key, isPublic) โ€“ Convert Base64 key to PEM format
  • decryptPEMKey(pem, isPublic) โ€“ Extract Base64 from PEM
  • signJSON(json, privateKey) โ€“ Sign full JSON document
  • validateRSAKey(base64Key) โ€“ Check if Base64 RSA key looks valid

๐Ÿ”’ Hashing (HashTool)

  • generateSHA256(input) โ€“ SHA-256 hash (hex)
  • generateSHA512(input) โ€“ SHA-512 hash (hex)
  • generateMD5(input) โ€“ MD5 hash (hex)
  • compareHash(input, expectedHash, algorithm) โ€“ Compare string with hash
  • generateSaltedHash(input, salt, algorithm) โ€“ Salted hash
  • generateRandomSalt(length) โ€“ Generate secure random salt
  • isHash(input) โ€“ Check if string looks like a valid hash
  • isHashMatchWithSalt(input, salt, expectedHash, algorithm) โ€“ Salted hash comparison
  • hashBase64(input, algorithm) โ€“ Generate Base64-encoded hash

โ„น๏ธ All functions are annotated with @Tool and can be auto-discovered by any compliant MCP host at runtime.

Usage Examples

Once installed in an MCP-compatible host:

  • encryptAES("hello", "mys3cretKey") โ†’ Base64EncryptedText
  • decryptAESWithIV("IV:Base64Cipher", "mys3cretKey") โ†’ hello
  • generateRSAKeyPair() โ†’ { publicKey, privateKey }
  • signData("important", privateKey) โ†’ Base64Signature
  • generateSHA256("secure") โ†’ HexSHA256Hash

Technical Details

  • Built with Spring Boot and spring-ai-mcp-server-spring-boot-starter
  • MCP-compatible methods are annotated with @Tool
  • manifest.json is automatically generated using ClassGraph to scan the tool package
  • Executable jar is placed under ./libs for use by MCP hosts

Build Instructions

./gradlew clean build

This will:

  • Build the executable Spring Boot jar
  • Generate manifest.json
  • Copy the jar to ./libs for publication

Output

The following files will be generated and should be committed:

  • libs/MCP-Cipher-0.0.1-SNAPSHOT.jar
  • manifest.json

License

This project is licensed under the MIT License. See the LICENSE file for details.

ยฉ 2025 JUNG JE KIM Original author and maintainer: JUNG JE KIM

Author

MCP Server ยท Populars

MCP Server ยท New

    nhadaututtheky

    NeuralMemory

    NeuralMemory stores experiences as interconnected neurons and recalls them through spreading activation, mimicking how the human brain works. Instead of searching a database, memories are retrieved through associative recall - activating related concepts until the relevant memory emerges.

    Community nhadaututtheky
    norrietaylor

    Distillery

    Team knowledge evaporates daily โ€” pairing sessions, debugging context, architectural rationale lost to Slack. Distillery captures it at the point of creation, connects it into a living graph, and surfaces it conversationally. It monitors feeds, tracks what matters to your projects, and alerts you before you know to ask. A team brain that learns.

    Community norrietaylor
    ennisaaaaaaaa-stack

    Tideline ๆฝฎ็—•

    Tideline-Memory is a long-term memory system built for AI Agents. Most agent memory: You ask, it finds. Tideline: The agent wakes up already knowing who he is, not querying "who am I?" every session. Achieving accurate memory hits while also preventing memory from expanding at scale.No compression, no forgetting.

    Get-Concord-AI

    Concord MCP

    Live messaging for coding agents

    Community Get-Concord-AI
    alijancb

    Subio MCP

    Open-source MCP server for discovering fast-growing internet conversations with Subio

    Community alijancb