Skip to main content

SafeBase

Tests

Encrypted file-based storage accessed via MCP, with human-gated per-bucket passwords.

What it is

A Python MCP server that provides encrypted file-based storage organized as databases, buckets, and files. The AI agent reads and writes data through MCP tool calls. The human gates access by entering per-bucket passwords into native OS dialogs that the server pops up on their desktop. The AI never sees the password.

  • Database = a folder
  • Bucket = a subfolder inside a database, each with its own password
  • File = one encrypted JSON file inside a bucket

All files are encrypted at rest using Fernet (AES-128-CBC + HMAC-SHA256). Passwords are never stored in plaintext — only bcrypt hashes and per-bucket salts live on disk.

Quick Start

1. Install:

pip install -r requirements.txt

Requires tkinter (bundled with Python on Windows and macOS; on Linux may need python3-tk).

2. Create the storage directory (outside any git repo):

mkdir C:\Users\YourName\safebase-data

3. Configure your MCP client (e.g. Windsurf mcp_config.json):

{
  "mcpServers": {
    "safebase": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/lesichkovm/mcp-safebase", "safebase-server"],
      "env": {
        "SAFEBASE_ROOT": "C:\\Users\\YourName\\safebase-data"
      }
    }
  }
}

No password env var. The password is set per-bucket by the human via a dialog on first use.

4. Use it:

The MCP client starts the server automatically when the AI calls a tool. The first time the AI writes to a new bucket, a dialog appears on your screen to create a password for that bucket.

Tools

Tool Description Password dialog? Editor dialog?
list_databases List all databases (folders) in the root No No
create_database Create a new database (folder) No No
list_buckets List buckets (subfolders) in a database No No
create_bucket Create a new bucket (subfolder) in a database No No
list_files List files in a bucket No No
put_file Write an encrypted JSON file to a bucket Yes¹ No
get_file Read and decrypt a file from a bucket Yes¹ No
edit_file Open a GUI editor on the human's screen to edit a stored secret. The AI never sees the content — only a success/cancel confirmation. Yes¹ Yes
delete_file Delete a file from a bucket No No
delete_bucket Delete a bucket and all its contents No No
query_bucket List all files in a bucket with optional field filtering Yes¹ No
change_bucket_password Change a bucket's password (re-encrypts all files) Yes² No

Dialogs shown to the human (the AI never sees any dialog content):

  • Password dialog — a native OS window where the human enters or creates the bucket password. Shown by any tool marked "Yes¹" when the key is not already in memory (first use, or after the session duration expires). change_bucket_password (Yes²) shows it twice: once for the current password, once for the new one.
  • Editor dialog — only edit_file opens this. It's a tkinter window with an editable text field pre-filled with the decrypted JSON. The human edits the content directly and clicks Save (or Cancel). The AI receives only "File updated successfully" or "Edit cancelled by user" — never the file content.

Documentation

  • Specification — full technical spec: architecture, storage model, encryption, password lifecycle, threat model, error handling
  • Password System — how per-bucket passwords work, session duration, changing passwords, what happens when you cancel
  • Security — threat model, what SafeBase protects against and what it doesn't
  • Usage Examples — concrete examples: SME candidates, tender leads, different schemas

Testing

pytest test_server.py -v   # 101 tests
python test_smoke.py       # quick smoke test (headless)

Tests mock the dialog functions, so they run without tkinter or a display.

License

AGPL-3.0 — see LICENSE. Commercial use requires a separate commercial license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_safebase-0.1.0.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_safebase-0.1.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_safebase-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_safebase-0.1.0.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_safebase-0.1.0.tar.gz
Algorithm Hash digest
SHA256 569a76b10d5f1666bc638a749b45eaaac98a3a68fcfeceda1d5d2c8999e353c4
MD5 36d2f27c80fdbefb92864050266e99f0
BLAKE2b-256 189a60187cd3d6057362e08d533084da4731055eadcaecc2c92c5a925cc7e1b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_safebase-0.1.0.tar.gz:

Publisher: publish.yml on lesichkovm/mcp-safebase

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_safebase-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_safebase-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_safebase-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3e621885497692368b2fd678149fd44fad1e9c33ff04a0637a1a594b9c0ec7b
MD5 60d65302826c02cb9e8fb5a589966a78
BLAKE2b-256 5eb03df6716575f3e50899346673f52e349edf41489a09b96bedbe6347ccff1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_safebase-0.1.0-py3-none-any.whl:

Publisher: publish.yml on lesichkovm/mcp-safebase

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page