Skip to main content
Glama
czangyeob

MCP PII Tools

by czangyeob

mcp_encrypt_pii_item

Encrypts personally identifiable information (PII) like names, phone numbers, and emails using advanced cryptographic methods to protect sensitive data.

Instructions

MCP Tool: PII 항목 암호화

Args:
    pii_value (str): 암호화할 PII 값
    pii_type (str): PII 유형 (이름, 전화번호, 이메일 등)
    
Returns:
    Dict[str, Any]: 암호화 결과

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pii_valueYes
pii_typeYes

Implementation Reference

  • The MCP tool handler function decorated with @mcp.tool(). It instantiates PIICrypto and calls its encrypt_pii_item method to perform the encryption, returning a structured result dictionary.
    def mcp_encrypt_pii_item(pii_value: str, pii_type: str) -> Dict[str, Any]:
        """
        MCP Tool: PII 항목 암호화
        
        Args:
            pii_value (str): 암호화할 PII 값
            pii_type (str): PII 유형 (이름, 전화번호, 이메일 등)
            
        Returns:
            Dict[str, Any]: 암호화 결과
        """
        try:
            crypto = PIICrypto()
            encrypted_value = crypto.encrypt_pii_item(pii_value, pii_type)
            
            return {
                "success": True,
                "original_value": pii_value,
                "encrypted_value": encrypted_value,
                "pii_type": pii_type,
                "encryption_method": "deterministic" if pii_type in crypto.deterministic_types else "fpe"
            }
        except Exception as e:
            return {
                "success": False,
                "error": str(e),
                "original_value": pii_value,
                "encrypted_value": "",
                "pii_type": pii_type
            }
  • JSON schema definition for the encrypt_pii_item tool in the MCP_TOOLS dictionary, specifying input parameters and their types/descriptions.
    "encrypt_pii_item": {
        "name": "encrypt_pii_item",
        "description": "개별 PII 항목을 암호화합니다. 이름, 주소, 이메일은 결정론적 암호화, 전화번호, 신용카드번호 등은 FPE(형식 유지 암호화)를 사용합니다.",
        "parameters": {
            "type": "object",
            "properties": {
                "pii_value": {
                    "type": "string",
                    "description": "암호화할 PII 값"
                },
                "pii_type": {
                    "type": "string",
                    "description": "PII 유형 (이름, 전화번호, 이메일, 주소, 신용카드번호, 여권번호, 주민등록번호 등)"
                }
            },
            "required": ["pii_value", "pii_type"]
        }
  • Core encryption logic in PIICrypto class. Routes to deterministic_encrypt for types like '이름', '주소', '이메일'; to fpe_encrypt for '전화번호', etc.; handles the actual encryption based on PII type.
    def encrypt_pii_item(self, pii_value: str, pii_type: str) -> str:
        """
        PII 항목을 유형에 따라 적절한 방식으로 암호화
        
        Args:
            pii_value: PII 값
            pii_type: PII 유형
            
        Returns:
            암호화된 값
        """
        if not pii_value:
            return pii_value
        
        if pii_type in self.deterministic_types:
            return self.deterministic_encrypt(pii_value, pii_type)
        elif pii_type in self.fpe_types:
            return self.fpe_encrypt(pii_value, pii_type)
        else:
            # 기본적으로 결정론적 암호화 사용
            return self.deterministic_encrypt(pii_value, pii_type)

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/czangyeob/mcp-pii-tools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server