Credential Vault MCP
by CipherSatoru
README.md
# π Credential Vault MCP
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
[](https://www.typescriptlang.org/)
[](https://doc.libsodium.org/)
[](https://modelcontextprotocol.io/)
**Secure credential storage for AI agents.** Keep your passwords, API keys, and secrets encrypted and invisible to AI models. When agents need credentials, they get a secure referenceβnever the actual value.
## Why Credential Vault?
AI agents are incredibly powerful, but they shouldn't have access to your sensitive credentials. Credential Vault solves this with a **security-first architecture**:
- π **End-to-End Encryption**: ChaCha20-Poly1305 encryption with Argon2i key derivation
- π» **Agent-Invisible**: Agents see only credential IDs, never actual values
- π‘οΈ **Zero Trust**: Credentials stored separately from AI context
- π **Full Audit Trail**: Track every credential access and modification
- π **Conflict Detection**: Automatically detect credential changes and duplicates
- π― **Easy Setup**: One-command initialization, MCP integration ready
## Security Architecture
```
βββββββββββββββββββββββββββββββββββββββββββ
β AI Agent / Claude β
β (Cannot see credential values) β
ββββββββββββββ¬βββββββββββββββββββββββββββββ
β
β Requests: "Get stripe_api_key"
β Receives: {credential_id: "cred_xxx", name: "stripe_api_key"}
β
ββββββββββββββΌβββββββββββββββββββββββββββββ
β MCP Tool Interface β
β β’ store_credential β
β β’ get_credential_reference β
β β’ list_credentials β
ββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββββββββββββββββββ
β Credential Storage (Encrypted) β
β ~/.credential-vault-mcp/vault.json β
β β
β ChaCha20-Poly1305 Encryption β
β Argon2i Key Derivation β
β 600 File Permissions (User Only) β
ββββββββββββββββββββββββββββββββββββββββββββ
```
## Quick Start
### 1. Installation
```bash
npm install -g credential-vault-mcp
```
### 2. Initialize Vault
```bash
credential-vault init
```
You'll be prompted to set a master password. This password:
- Never leaves your machine
- Is never sent to any server
- Is used to derive an encryption key (not stored directly)
- Must be at least 8 characters
### 3. Add Your First Credential
```bash
credential-vault add stripe_api_key --type api_key
```
### 4. Configure MCP in Claude Code / Claude Desktop
Add this to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"credential-vault": {
"command": "credential-vault-mcp",
"args": []
}
}
}
```
Or for development:
```json
{
"mcpServers": {
"credential-vault": {
"command": "npx",
"args": ["credential-vault-mcp"]
}
}
}
```
### 5. Use in Claude
Tell Claude:
> I have credentials stored in Credential Vault MCP. Can you initialize the vault with my master password, then retrieve my stripe_api_key?
Claude will:
1. Call `initialize_vault` tool with your master password
2. Call `get_credential_reference` to get credential ID
3. Never see the actual API key value
## CLI Commands
### List all credentials
```bash
credential-vault list
```
### Get a credential value
```bash
credential-vault get stripe_api_key
```
### Delete a credential
```bash
credential-vault delete stripe_api_key
```
### View audit log
```bash
credential-vault audit 100
```
### Verify vault integrity
```bash
credential-vault verify
```
## Available MCP Tools
### `initialize_vault`
Initialize the vault with master password. **Call this first.**
```json
{
"master_password": "your-secure-password-8+chars"
}
```
### `store_credential`
Store a new credential (encrypted).
```json
{
"name": "stripe_api_key",
"value": "sk_live_...",
"type": "api_key"
}
```
Types: `api_key`, `password`, `token`, `connection_string`, `ssh_key`, `custom`
### `get_credential_reference`
Get a credential reference (safe for agents).
```json
{
"credential_name": "stripe_api_key"
}
```
Returns: `{ credential_id: "cred_xxx", name: "...", type: "..." }`
### `list_credentials`
List all stored credentials (no values).
### `delete_credential`
Permanently delete a credential.
### `get_audit_log`
View access and modification history.
## Security Best Practices
### β
DO
- β
Use a **strong, unique master password** (20+ characters recommended)
- β
Store your master password in a password manager
- β
Review audit logs regularly
- β
Rotate sensitive credentials periodically
- β
Run `credential-vault verify` to check vault integrity
- β
Keep your system and dependencies updated
### β DON'T
- β Share your master password
- β Store master password in plaintext
- β Use the same master password as other services
- β Store credentials in public/shared environments without encryption
- β Ignore audit log warnings about conflicts
- β Commit `.credential-vault-mcp/` to version control
## File Structure
```
~/.credential-vault-mcp/
βββ vault.json # Encrypted credential storage (mode: 600)
βββ [secure directory] # Stored in user home, readable only by user
```
**Permissions**: Vault directory and file are created with `0700` / `0600` permissions (user read/write only).
## Encryption Details
- **Algorithm**: ChaCha20-Poly1305 (AEAD)
- **Key Derivation**: Argon2i (OPSLIMIT_MODERATE, MEMLIMIT_MODERATE)
- **Nonce**: Random 24-byte nonce per credential
- **Integrity**: Poly1305 MAC prevents tampering
- **Library**: libsodium.js (audited crypto library)
Each credential is encrypted independently with a random nonce. Even if one credential is compromised, others remain secure.
## Advanced Usage
### Using with different Claude interfaces
#### Claude.ai Code
Add to MCP settings in Code interface
#### Claude Desktop App
Edit `claude_desktop_config.json`:
```json
{
"mcpServers": {
"credential-vault": {
"command": "npx",
"args": ["credential-vault-mcp"]
}
}
}
```
#### VS Code Extension
Configure in extension settings for Claude extension
### Backing up credentials
**Important**: Your master password is required to decrypt credentials.
```bash
# Backup encrypted vault (safe - encrypted)
cp ~/.credential-vault-mcp/vault.json ~/backup/vault.json.backup
# Never do this:
# β cp ~/.credential-vault-mcp/vault.json /public/location
# β git add vault.json
```
### Handling master password changes
Currently: Delete old vault and create new one
```bash
rm ~/.credential-vault-mcp/vault.json
credential-vault init
```
Then re-add credentials with new master password.
## Troubleshooting
### "Vault not initialized" error
```bash
# Initialize first
credential-vault init
```
### "Permission denied" error
Check file permissions:
```bash
ls -la ~/.credential-vault-mcp/vault.json
# Should show: -rw------- (600)
```
Fix permissions:
```bash
chmod 600 ~/.credential-vault-mcp/vault.json
```
### Forgotten master password?
Unfortunately, there's no recovery. The password is required to decrypt credentials.
**Prevention**: Store master password in a password manager with recovery codes.
### "Conflict detected" warning
This means a credential with the same value exists under a different name. This could indicate:
- Password reuse (audit the old credential)
- Accidental duplicate entry
- Shared secret across services
Check audit log:
```bash
credential-vault audit
```
## Development
### Clone & Install
```bash
git clone https://github.com/CipherSatoru/credential-vault-mcp.git
cd credential-vault-mcp
npm install
```
### Build
```bash
npm run build
```
### Run in development
```bash
npm run dev
```
### Test CLI
```bash
npm run cli -- init
```
## Contributing
Contributions welcome! This is security-sensitive software, so:
1. **Security first**: Test all encryption paths
2. **No plaintext logging**: Credentials must never be logged
3. **Audit trail**: Track what happens
4. **Documentation**: Update SECURITY.md for significant changes
## License
MIT License - See LICENSE file for details
## Support
- π [Read SECURITY.md](./SECURITY.md) for security details
- π [Report issues](https://github.com/CipherSatoru/credential-vault-mcp/issues)
- π¬ [Discussions](https://github.com/CipherSatoru/credential-vault-mcp/discussions)
## Disclaimer
This tool encrypts credentials locally on your machine. However:
- The MCP interface is only as secure as its integration
- Running on a compromised machine still exposes credentials
- Master password security is your responsibility
- No encryption is perfect - use defense in depth
Always follow your organization's security policies when handling credentials.
---
**Made with π for secure AI agent workflows**
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessSyncing