This server gives Claude direct access to SQLCipher 4 encrypted databases, the kind used by MoneyMoney, Signal, WhatsApp, KeePass, and 1Password for local storage. It exposes the full set of database operations: schema inspection (tables, columns, indexes), arbitrary SQL queries, and CRUD operations with built-in SQL injection protection. You pass it a database path and passphrase, optionally encrypted with AES-256-GCM and stored in macOS Keychain. Custom cipher profiles let you override the default SQLCipher 4 settings (page size, KDF iterations, HMAC algorithm). Runs via stdio using Java 21 and a modified SQLite JDBC driver, or pull the Docker image if you'd rather not manage dependencies.
MCP server for encrypted SQLite databases
A Model Context Protocol (MCP) server for working with encrypted SQLite databases using SQLCipher. This server provides tools to read database structures, query tables, and perform CRUD operations on encrypted SQLite databases.
Compatible with all MCP clients (Cursor, Claude Desktop, and others).
Works with encrypted databases from: MoneyMoney, 1Password, Signal, WhatsApp, Firefox, Telegram, KeePass, and other applications using SQLCipher encryption.
MCP_DEBUG environment variableMany popular applications use encrypted SQLite databases (SQLCipher) to protect sensitive data. This MCP server is specifically designed to work with these encrypted databases.
If you need to access data from any of these applications or other SQLCipher-encrypted databases, this MCP server provides the tools you need. Note that you need the passphrase of the encrypted database.
sqlite-jdbc-3.50.1.0.jar from sqlite-jdbc-crypt)The easiest way to install this MCP server in Cursor is via the Cursor MCP Store:
This server works with any MCP-compatible client. See the Configuration section below for setup instructions.
Use the pre-built Docker image from GitHub Container Registry:
docker pull ghcr.io/rosch100/mcp-encrypted-sqlite:latest
Quick Start: See DOCKER_QUICKSTART.md for Docker Desktop setup.
Detailed Configuration: See DOCKER_CONFIGURATION.md for advanced options.
Clone the repository:
git clone https://github.com/rosch100/mcp-encrypted-sqlite.git
cd mcp-encrypted-sqlite
Build the project:
./gradlew build installDist
The build process will automatically download sqlite-jdbc-3.50.1.0.jar from sqlite-jdbc-crypt releases and place it in the libs/ directory.
The executable will be available at build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite.
This MCP server works with any MCP-compatible client (Cursor, Claude Desktop, etc.). The configuration format follows the Model Context Protocol specification.
The server communicates via STDIO (standard input/output). Add the following configuration to your MCP client's configuration file:
Configuration file locations:
~/.cursor/mcp.json~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"encrypted-sqlite": {
"command": "/path/to/mcp-encrypted-sqlite/build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite",
"args": [
"--args",
"{\"db_path\":\"/path/to/your/database.sqlite\",\"passphrase\":\"your-passphrase\"}"
]
}
}
}
Optional Parameters:
transport: Defaults to "stdio" (can be omitted)cwd: Not needed when using absolute paths (can be omitted)env: Only needed if Java is not in your system PATH or for custom Java installation:{
"mcpServers": {
"encrypted-sqlite": {
"command": "/path/to/mcp-encrypted-sqlite/build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite",
"args": [
"--args",
"{\"db_path\":\"/path/to/your/database.sqlite\",\"passphrase\":\"your-passphrase\"}"
],
"env": {
"JAVA_HOME": "/path/to/java/home"
}
}
}
}
{
"mcpServers": {
"encrypted-sqlite": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-v", "/path/to/your/database.sqlite:/data/database.sqlite:ro",
"ghcr.io/rosch100/mcp-encrypted-sqlite:latest",
"--args",
"{\"db_path\":\"/data/database.sqlite\",\"passphrase\":\"your-passphrase\"}"
]
}
}
}
When using encrypted passphrases, you must pass the encryption key as an environment variable:
{
"mcpServers": {
"encrypted-sqlite": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "MCP_SQLITE_ENCRYPTION_KEY=your-encryption-key",
"-v", "/path/to/your/database.sqlite:/data/database.sqlite:ro",
"ghcr.io/rosch100/mcp-encrypted-sqlite:latest",
"--args",
"{\"db_path\":\"/data/database.sqlite\",\"passphrase\":\"encrypted:your-encrypted-passphrase\"}"
]
}
}
}
Important Notes:
-e flag must come before the -v flagsecurity find-generic-password -s "mcp-encrypted-sqlite" -a "encryption-key" -w:ro) by default. Remove :ro if you need write accessSecurity Warning: Storing both the encryption key and encrypted passphrase as plain text in your configuration file is a security risk. See DOCKER_CONFIGURATION.md for secure alternatives.
Override the default SQLCipher 4 settings by including a cipherProfile in the configuration JSON:
{
"mcpServers": {
"encrypted-sqlite": {
"command": "/path/to/mcp-encrypted-sqlite/build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite",
"args": [
"--args",
"{\"db_path\":\"/path/to/your/database.sqlite\",\"passphrase\":\"your-passphrase\",\"cipherProfile\":{\"name\":\"SQLCipher 4 defaults\",\"pageSize\":4096,\"kdfIterations\":256000,\"hmacAlgorithm\":\"HMAC_SHA512\",\"kdfAlgorithm\":\"PBKDF2_HMAC_SHA512\"}}"
]
}
}
}
Note: All fields in cipherProfile are optional - only specify the ones you want to override from the defaults. You can also specify cipherProfile in individual tool calls, but it's recommended to configure it once in the MCP server configuration for consistency.
For enhanced security, you can store passphrases in encrypted form. The server uses AES-256-GCM encryption, which provides authenticated encryption and is both secure and fast.
Generate and store key in Keychain:
Run: ./store-key-in-keychain.sh --generate
Encrypt your passphrase:
Run: ./encrypt-passphrase.sh "your-plain-passphrase"
The key is automatically loaded from the Keychain when no environment variable is set.
Benefits:
Generate an encryption key:
Run: java -cp build/libs/mcp-encrypted-sqlite-VERSION.jar com.example.mcp.sqlite.config.PassphraseEncryption
Set the encryption key:
Run: export MCP_SQLITE_ENCRYPTION_KEY="<your-generated-key>"
Encrypt your passphrase:
Run: java -cp build/libs/mcp-encrypted-sqlite-VERSION.jar com.example.mcp.sqlite.util.EncryptPassphrase "your-plain-passphrase"
Use the encrypted passphrase (with encrypted: prefix) in your configuration:
On macOS with Keychain (recommended):
{
"mcpServers": {
"encrypted-sqlite": {
"command": "/path/to/mcp-encrypted-sqlite/build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite",
"args": [
"--args",
"{\"db_path\":\"/path/to/your/database.sqlite\",\"passphrase\":\"encrypted:<encrypted-passphrase>\"}"
]
}
}
}
Note: No env section needed - the key is automatically loaded from macOS Keychain.
With environment variable (cross-platform):
{
"mcpServers": {
"encrypted-sqlite": {
"command": "/path/to/mcp-encrypted-sqlite/build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite",
"args": [
"--args",
"{\"db_path\":\"/path/to/your/database.sqlite\",\"passphrase\":\"encrypted:<encrypted-passphrase>\"}"
],
"env": {
"MCP_SQLITE_ENCRYPTION_KEY": "<your-encryption-key>"
}
}
}
}
Important Security Notes:
MCP_SQLITE_ENCRYPTION_KEY environment variable)encrypted:) and decrypts themPassphraseEncryption.generateKey() to generate strong keys (256 bits / 32 bytes)list_tablesList all tables in the database. By default only table names, with include_columns=true also column details.
Parameters:
db_path (optional if configured): Path to the database filepassphrase (optional if configured): Database passphraseinclude_columns (optional, default: false): If true, column details are also returnedExample:
{
"name": "list_tables",
"arguments": {
"include_columns": true
}
}
get_table_dataRead data from a table with optional filtering, column selection, and pagination.
Parameters:
table (required): Table namecolumns (optional): Array of column names to selectfilters (optional): Object with column-value pairs for filteringlimit (optional, default: 200): Maximum number of rowsoffset (optional, default: 0): Offset for paginationExample:
{
"name": "get_table_data",
"arguments": {
"table": "accounts",
"columns": ["id", "name", "balance"],
"filters": {"status": "active"},
"limit": 50,
"offset": 0
}
}
execute_sqlExecute arbitrary SQL statements (SELECT, INSERT, UPDATE, DELETE, DDL).
Security Warning: This tool executes raw SQL without parameterization. Only use with trusted SQL or ensure proper validation and sanitization is performed before calling this tool. For safer operations, use the other tools (get_table_data, insert_or_update, delete_rows) which use parameterized queries.
Parameters:
sql (required): SQL statement to executeExample:
{
"name": "execute_sql",
"arguments": {
"sql": "SELECT COUNT(*) FROM transactions WHERE amount > 1000"
}
}
insert_or_updatePerform UPSERT operations (INSERT or UPDATE on conflict).
Parameters:
table (required): Table nameprimary_keys (required): Array of primary key column namesrows (required): Array of row objects to insert/updateExample:
{
"name": "insert_or_update",
"arguments": {
"table": "accounts",
"primary_keys": ["id"],
"rows": [
{"id": 1, "name": "Account 1", "balance": 1000.0},
{"id": 2, "name": "Account 2", "balance": 2000.0}
]
}
}
delete_rowsDelete rows from a table based on filters.
Parameters:
table (required): Table namefilters (required): Object with column-value pairs for filteringExample:
{
"name": "delete_rows",
"arguments": {
"table": "transactions",
"filters": {"status": "cancelled"}
}
}
get_table_schemaRetrieves detailed schema information for a table (columns, indexes, foreign keys, constraints).
Parameters:
table (required): Table nameExample:
{
"name": "get_table_schema",
"arguments": {
"table": "accounts"
}
}
list_indexesLists all indexes of a table.
Parameters:
table (required): Table nameExample:
{
"name": "list_indexes",
"arguments": {
"table": "accounts"
}
}
The server supports optional debug output via the MCP_DEBUG environment variable. When enabled, detailed debug information is written to stderr (not stdout, to comply with MCP protocol requirements).
Enable debug mode:
{
"mcpServers": {
"encrypted-sqlite": {
"command": "/path/to/mcp-encrypted-sqlite/build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite",
"args": [
"--args",
"{\"db_path\":\"/path/to/your/database.sqlite\",\"passphrase\":\"your-passphrase\"}"
],
"env": {
"MCP_DEBUG": "true"
}
}
}
}
Debug output includes:
Note: Debug output is disabled by default to keep logs clean. Only enable it when troubleshooting issues.
The server uses SQLCipher 4 defaults by default:
cipher_page_size: 4096kdf_iter: 256000cipher_hmac_algorithm: HMAC_SHA512cipher_kdf_algorithm: PBKDF2_HMAC_SHA512cipher_use_hmac: ONcipher_plaintext_header_size: 0These settings match the defaults used by tools like "DB Browser for SQLite" with SQLCipher 4.
See DEVELOPMENT.md for development setup, building, testing, and project structure.
char[] arrays, though this is not currently implemented.PassphraseEncryption.generateKey() (256 bits / 32 bytes)chmod 600)The MCP server includes extensive debugging features to help diagnose communication problems.
In MCP clients:
stderrManual testing:
Run: ./build/install/mcp-encrypted-sqlite/bin/mcp-encrypted-sqlite --args '{"db_path":"/path/to/db.sqlite","passphrase":"secret"}' 2>&1 | tee mcp-debug.log
1. Server does not start
mcp.json)command and args fields2. JSON Parsing Errors
3. Missing or Incorrect Responses
STDOUT is available (logged at startup)4. Invalid Requests
method, id)method and id fields are present5. Database Connection Problems
The server automatically logs:
Startup Information:
Request Processing:
Error Handling:
Database Operations:
java -versionJAVA_HOME is set correctly in the MCP configurationThe server automatically handles FTS virtual tables that may not have accessible metadata. These tables will appear with empty column lists.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
See NOTICE for detailed attribution information.
Contributions are welcome! Please feel free to submit a Pull Request. See CONTRIBUTING.md for guidelines.
For issues, questions, or contributions, please open an issue on GitHub.
Like this integration? Feel free to buy me a coffee! Your support helps me continue working on cool features.
DB_PATH*Path to the encrypted SQLite database file (inside container: /data/database.sqlite)
DB_PASSPHRASE*secretPassphrase for decrypting the database (or use encrypted: prefix for encrypted passphrases)
hovecapital/read-only-local-postgres-mcp-server
cocaxcode/database-mcp
io.github.infoinlet-marketplace/mcp-mysql
io.github.cybeleri/database-admin
io.github.yash-0620/postgres-mcp-secured