A Model Context Protocol (MCP) server for Database EKM/TDE operations using CipherTrust Application Key Management (CAKM). - Resource-Based Management: Tools are organized by the database objects they manage (e.g., keys, encryption, wallets), not just by actions. - Operational Grouping: Each tool exposes multiple operations (e.g., create, list, rotate) for comprehensive lifecycle management. - Uni
Add this skill
npx mdskills install sanyambassi/thales-cdsp-cakm-mcp-serverComprehensive database TDE/EKM management with excellent Oracle detection logic and multi-platform support
1# Thales CipherTrust Data Security Platform CAKM MCP Server23A Model Context Protocol (MCP) server for Database EKM/TDE operations using CipherTrust Application Key Management (CAKM).45## ๐ Features67- **Resource-Based Management**: Tools are organized by the database objects they manage (e.g., keys, encryption, wallets), not just by actions.8- **Operational Grouping**: Each tool exposes multiple `operations` (e.g., `create`, `list`, `rotate`) for comprehensive lifecycle management.9- **Unified Status & Auditing**: A single tool (`status_tde_ekm`) provides health, compliance, and configuration monitoring across all supported databases.10- **Advanced Oracle TDE Detection**: Intelligent detection of Oracle TDE configurations including:11 - **HSM-only TDE**: Direct HSM wallet usage12 - **HSM with Auto-login**: Forward migrated configurations (HSM primary, auto-login secondary)13 - **FILE wallet TDE**: Password-based software wallets14 - **FILE with Auto-login**: Standard or reverse migrated configurations15 - **Migration Status Recognition**: Automatically identifies forward/reverse migration states based on wallet order and types16- **Database TDE Operations**: Encrypt, decrypt, and manage TDE on multiple database types.17- **CipherTrust Integration**: Seamless integration with CipherTrust Manager via CAKM EKM.18- **Multi-Database Support**: SQL Server and Oracle Database.19- **Key Rotation**: Automated encryption key rotation with key management on Thales CipherTrust Manager.2021> **๐ฅ [Watch Demo Video](https://www.youtube.com/watch?v=5GezP4_CEyY)** - See the MCP server in action managing database encryption2223## ๐ Quick Start2425### Clone the Repository2627```bash28# Clone the repository29git clone https://github.com/sanyambassi/thales-cdsp-cakm-mcp-server.git30cd thales-cdsp-cakm-mcp-server31```3233### Installation3435```bash36# Install dependencies37uv venv && source .venv/bin/activate # Linux/Mac38# uv venv && .venv\Scripts\activate # Windows39uv pip install -e .4041# Configure (copy the example configuration)42# Note: Create your own .env file with database connection details43# See docs/PREREQUISITES.md for configuration examples4445# Test connections46uv run python -m database_tde_server --test-connections47```4849### Usage5051```bash52# Start the MCP server53uv run python -m database_tde_server54```5556## ๐ฆ Installing `uv`5758This project uses `uv` to manage dependencies and run scripts. Please install it using one of the methods below.5960**Windows (PowerShell):**61```powershell62powershell -c "irm https://astral.sh/uv/install.ps1 | iex"63```6465**Linux, macOS, and other shells:**66```bash67curl -LsSf https://astral.sh/uv/install.sh | sh68```6970For more information, visit the [uv installation guide](https://github.com/astral-sh/uv#installation).717273## ๐ง Available Tools7475- **Core Tools**76 - `list_database_connections()`: Lists all configured database connections.77- **Unified Status & Auditing**78 - `status_tde_ekm()`: Provides a unified interface to monitor the health, configuration, and compliance of TDE across both SQL Server and Oracle.79- **SQL Server Tools**80 - `manage_sql_ekm_objects()`: Manages EKM providers, credentials, and their associated server logins.81 - `manage_sql_keys()`: Manages the lifecycle of cryptographic keys (Asymmetric Master Keys and DEKs), including creation, listing, dropping, and rotation.82 - `manage_sql_encryption()`: Encrypts or decrypts one or more SQL Server databases.83- **Oracle Tools**84 - `manage_oracle_tde_deployment()`: Handles high-level TDE deployment workflows like initial setup or migration to/from an HSM.85 - `manage_oracle_configuration()`: Manages TDE-related database parameters.86 - `manage_oracle_wallet()`: Performs all wallet-specific actions (open, close, backup, manage auto-login).87 - `manage_oracle_keys()`: Manages the lifecycle of Master Encryption Keys (MEKs), including rotation and listing.88 - `manage_oracle_tablespace_encryption()`: Manages the encryption and decryption of specific tablespaces.8990## ๐ค AI Assistant Integration9192Add to your AI assistant configuration:9394### Claude Desktop95```json96{97 "mcpServers": {98 "database-tde": {99 "command": "uv",100 "args": ["run", "python", "-m", "database_tde_server"],101 "cwd": "/path/to/cakm-mcp-server-sql-oracle",102 "env": {103 "DB_TDE_SERVER_NAME": "database-tde-mcp",104 "DB_TDE_LOG_LEVEL": "INFO",105 "DB_TDE_DATABASE_CONNECTIONS": "[{\"name\":\"prod_sql\",\"db_type\":\"sqlserver\",\"host\":\"sql-prod.company.com\",\"port\":1433,\"username\":\"tde_admin\",\"password\":\"secure_password\"},{\"name\":\"oracle_cdb1\",\"db_type\":\"oracle\",\"host\":\"oracle-prod.company.com\",\"port\":1521,\"username\":\"sys\",\"password\":\"oracle_password\",\"oracle_config\":{\"oracle_home\":\"/u01/app/oracle/product/21.0.0/dbhome_1\",\"oracle_sid\":\"cdb1\",\"service_name\":\"orcl\",\"mode\":\"SYSDBA\",\"wallet_root\":\"/opt/oracle/wallet\"},\"ssh_config\":{\"host\":\"oracle-prod.company.com\",\"username\":\"oracle\",\"private_key_path\":\"/path/to/private-key.pem\",\"port\":22,\"timeout\":30}}]"106 }107 }108 }109}110```111112### Cursor AI (mcp.json)113```json114{115 "mcpServers": {116 "database-tde": {117 "command": "uv",118 "args": ["run", "python", "-m", "database_tde_server"],119 "cwd": "/path/to/cakm-mcp-server-sql-oracle",120 "env": {121 "DB_TDE_SERVER_NAME": "database-tde-mcp",122 "DB_TDE_LOG_LEVEL": "INFO",123 "DB_TDE_DATABASE_CONNECTIONS": "[{\"name\":\"prod_sql\",\"db_type\":\"sqlserver\",\"host\":\"sql-prod.company.com\",\"port\":1433,\"username\":\"tde_admin\",\"password\":\"secure_password\"},{\"name\":\"oracle_cdb1\",\"db_type\":\"oracle\",\"host\":\"oracle-prod.company.com\",\"port\":1521,\"username\":\"sys\",\"password\":\"oracle_password\",\"oracle_config\":{\"oracle_home\":\"/u01/app/oracle/product/21.0.0/dbhome_1\",\"oracle_sid\":\"cdb1\",\"service_name\":\"orcl\",\"mode\":\"SYSDBA\",\"wallet_root\":\"/opt/oracle/wallet\"},\"ssh_config\":{\"host\":\"oracle-prod.company.com\",\"username\":\"oracle\",\"private_key_path\":\"/path/to/private-key.pem\",\"port\":22,\"timeout\":30}}]"124 }125 }126 }127}128```129130### Gemini CLI (settings.json)131```json132{133 "mcpServers": {134 "database-tde": {135 "command": "uv",136 "args": ["run", "python", "-m", "database_tde_server"],137 "cwd": "/path/to/cakm-mcp-server-sql-oracle",138 "env": {139 "DB_TDE_SERVER_NAME": "database-tde-mcp",140 "DB_TDE_LOG_LEVEL": "INFO",141 "DB_TDE_DATABASE_CONNECTIONS": "[{\"name\":\"prod_sql\",\"db_type\":\"sqlserver\",\"host\":\"sql-prod.company.com\",\"port\":1433,\"username\":\"tde_admin\",\"password\":\"secure_password\"},{\"name\":\"oracle_cdb1\",\"db_type\":\"oracle\",\"host\":\"oracle-prod.company.com\",\"port\":1521,\"username\":\"sys\",\"password\":\"oracle_password\",\"oracle_config\":{\"oracle_home\":\"/u01/app/oracle/product/21.0.0/dbhome_1\",\"oracle_sid\":\"cdb1\",\"service_name\":\"orcl\",\"mode\":\"SYSDBA\",\"wallet_root\":\"/opt/oracle/wallet\"},\"ssh_config\":{\"host\":\"oracle-prod.company.com\",\"username\":\"oracle\",\"private_key_path\":\"/path/to/private-key.pem\",\"port\":22,\"timeout\":30}}]"142 }143 }144 }145}146```147148### Architecture Overview149```150MCP Server โ Database Server โ CAKM Provider/Library โ CipherTrust Manager151```152153**Note**: This MCP server communicates only with database servers. The CAKM providers installed on database servers handle all communication with CipherTrust Manager.154155### Oracle TDE Enablement Logic156157The server uses Oracle-documented logic to determine TDE status based on wallet configurations and TDE parameters:158159**โ TDE is ENABLED when:**160- Any wallet shows `OPEN` status AND Master Encryption Keys (MEKs) exist161162**๐ Wallet Order Types (from Oracle V$ENCRYPTION_WALLET):**163- **SINGLE**: Only one wallet type configured164- **PRIMARY**: Primary wallet in a dual-wallet configuration165- **SECONDARY**: Secondary wallet in a dual-wallet configuration166167**๐ง TDE Configuration Parameter Values:**168- **FILE**: TDE configured to use FILE wallets only169- **HSM**: TDE configured to use HSM wallets only170- **HSM|FILE**: TDE configured with HSM as primary, FILE as secondary171- **FILE|HSM**: TDE configured with FILE as primary, HSM as secondary172173**๐ Supported TDE Scenarios:**1741. **HSM-only TDE**: HSM wallet OPEN (SINGLE), TDE_CONFIGURATION=HSM1752. **HSM with Auto-login (Migrated)**: HSM wallet OPEN (PRIMARY), auto-login wallet OPEN (SECONDARY), TDE_CONFIGURATION=HSM|FILE1763. **HSM with Auto-login (Not Migrated)**: HSM wallet OPEN (PRIMARY), auto-login wallet OPEN_NO_MASTER_KEY (SECONDARY), TDE_CONFIGURATION=HSM|FILE1774. **FILE wallet TDE**: PASSWORD wallet OPEN (SINGLE), TDE_CONFIGURATION=FILE1785. **FILE with Auto-login (Reverse Migrated)**: PASSWORD wallet OPEN (PRIMARY), auto-login wallet OPEN (SECONDARY), TDE_CONFIGURATION=FILE|HSM1796. **FILE with Auto-login**: PASSWORD wallet OPEN (PRIMARY), auto-login wallet OPEN (SECONDARY), TDE_CONFIGURATION=FILE180181**๐ Migration Detection Logic:**182- **Forward Migration**: HSM becomes PRIMARY (HSM|FILE configuration) โ Database migrated from FILE to HSM183- **Reverse Migration**: FILE becomes PRIMARY (FILE|HSM configuration) โ Database migrated from HSM back to FILE184- **WALLET_ORDER** and **TDE_CONFIGURATION** are correlated to determine the migration state185186**๐ Status Information:**187- TDE configuration parameters validate the expected wallet hierarchy188- Wallet order and TDE_CONFIGURATION together determine the deployment scenario189190## ๐ง Oracle TDE Operations Guide191192The `oracle_tde_deployment` tool provides different operations for various TDE setup scenarios:193194### Operation Types & Use Cases195196**1. HSM-Only TDE Setup (No Auto-login)**197```json198{199 "oracle_connection": "oracle_cdb2",200 "operation": "setup_hsm_only",201 "ciphertrust_username": "tdeuser",202 "ciphertrust_password": "Thales123!",203 "ciphertrust_domain": "TDE",204 "auto_restart": true205}206```207- **Use when**: "Skip auto-login wallet creation" or "HSM only"208- **Creates**: HSM keystore only209- **Result**: Manual wallet opening required after restarts210- **No software_wallet_password needed**211212**2. Complete TDE Setup (HSM + Auto-login)**213```json214{215 "oracle_connection": "oracle_cdb2",216 "operation": "setup_hsm_with_autologin",217 "ciphertrust_username": "tdeuser",218 "ciphertrust_password": "Thales123!",219 "ciphertrust_domain": "TDE",220 "software_wallet_password": "Thales123!",221 "auto_restart": true222}223```224- **Use when**: "Set up complete TDE with auto-login"225- **Creates**: HSM + software wallet + auto-login keystore226- **Result**: Database starts automatically without manual intervention227- **Requires software_wallet_password**228229**3. Add Auto-login to Existing TDE**230```json231{232 "oracle_connection": "oracle_cdb2",233 "operation": "add_autologin",234 "ciphertrust_username": "tdeuser",235 "ciphertrust_password": "Thales123!",236 "ciphertrust_domain": "TDE",237 "software_wallet_password": "Thales123!",238 "auto_restart": true239}240```241- **Use when**: Database has HSM TDE, want to add auto-login242- **Creates**: Software wallet + auto-login for existing HSM setup243- **Requires software_wallet_password**244245**4. Check TDE Status**246```json247{248 "oracle_connection": "oracle_cdb2",249 "operation": "get_tde_status"250}251```252- **Use when**: Want to see current TDE configuration253- **Returns**: Comprehensive wallet and TDE status254- **No credentials needed**255256### Quick Reference257- **"Skip auto-login"** โ Use `setup_hsm_only`258- **"Complete TDE setup"** โ Use `setup_hsm_with_autologin`259- **"Add auto-login to existing"** โ Use `add_autologin`260- **"Check what I have"** โ Use `get_tde_status`261262**๐ References:**263- [Oracle V$ENCRYPTION_WALLET Documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/V-ENCRYPTION_WALLET.html)264- [Oracle TDE_CONFIGURATION Parameter](https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/TDE_CONFIGURATION.html)265266### Example Prompts267```268"Show me the TDE status of all my databases"269"For my 'prod_sql' connection, list all the asymmetric keys using the 'manage_sql_keys' tool"270"Rotate the master key on the 'Db05' database using the 'prod_sql' connection"271"Encrypt the 'SalesDB' database on my 'prod_sql' server"272"What is the wallet status for my 'oracle_cdb2' connection?"273```274275### Important Notes276- **Automatic Database Restarts**: When specified in prompts, MCP tools can automatically restart Oracle databases as part of TDE operations277- **SSH Authentication**: Oracle connections support both private key and password authentication278 - Private key: Use `"private_key_path": "/path/to/key.pem"` in ssh_config279 - Password: Use `"password": "your_ssh_password"` in ssh_config (instead of private_key_path)280- **Supported Databases**: Microsoft SQL Server and Oracle Database are supported281282## ๐ Documentation283284- [Prerequisites](docs/PREREQUISITES.md) - System requirements and setup285- [Testing Guide](docs/TESTING.md) - Comprehensive testing procedures286- [Example Prompts](docs/EXAMPLE_PROMPTS.md) - Ready-to-use testing prompts for SQL Server and Oracle287288## ๐ค Contributing2892901. Fork the repository2912. Create a feature branch2923. Make your changes2934. Add tests for new functionality2945. Ensure all tests pass2956. Submit a pull request296297## ๐ License298299This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.300
Full transparency โ inspect the skill content before installing.