"This is your last chance. After this, there is no going back."
Morpheus is a intentionally dumb credential gatekeeper that guards Vaultwarden credentials through Discord-based human approvals. No AI, no LLM, no prompt processingβjust API key validation, Discord notifications, and human oversight.
βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β β β β β β β
β Neo βββββΆβ Morpheus βββββΆβ Discord βββββΆβ Pranav β
β (AI Agent) β β Gatekeeper β β Bot β β (Human) β
β β β β β β β β
βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β
βΌ βΌ
βββββββββββββββ β
Approve
β β β Deny
β Vaultwarden β β° Timeout
β Vault β
β β
βββββββββββββββ
- Neo sends
POST /requestwith{service, scope, reason}+ API key - Morpheus validates API key and checks if service/scope exists in vault
- Posts approval request to Discord channel
#morpheus-approvals - Returns a
request_idimmediately (non-blocking) - Pranav reacts with β (approve) or β (deny) on Discord
- Neo polls
POST /pickupwith therequest_id - If approved: Morpheus fetches credential from Vaultwarden, returns it
- If denied: returns denial
- Timeout: 10 minutes β auto-deny (fail-safe)
- All actions logged to Discord channel
#gatekeeper-logs
- API key validation on every request
- Human approval required for all credential access
- Rate limiting: 10 requests/minute per IP
- Scope-based access control via Vaultwarden custom fields
- Request timeout: auto-deny after 10 minutes
- Audit logging to Discord
- No credential storage - fetched on-demand from vault
- LAN-only deployment - never publicly exposed
- Go to Discord Developer Portal
- Create new application: "Morpheus"
- Create a bot, copy the token
- Enable MESSAGE CONTENT intent
- Generate invite link with permissions:
- Send Messages
- Read Messages
- Add Reactions
- Read Message History
- Invite bot to your Discord guild
# Copy environment template
cp .env.example .env
# Edit .env with your values
nano .envRequired configuration:
DISCORD_BOT_TOKEN- Bot token from Discord Developer PortalMORPHEUS_API_KEY- Secure API key for Neo to useVAULTWARDEN_MASTER_PASSWORD- Master password for your Vaultwarden accountVAULTWARDEN_URL- Your Vaultwarden instance URL
# Build and start
make build
make up
# Check status
make health
make logsThat's it! Morpheus is now running on http://localhost:8000
Submit a credential request for Discord approval. This does not return credentials β it starts the approval flow.
Headers:
X-API-Key: your_api_keyContent-Type: application/json
Body:
{
"service": "aws-prod",
"scope": "read-only",
"reason": "Need to check S3 bucket permissions for debugging"
}Response:
{
"request_id": "a1b2c3d4",
"status": "pending",
"message": "Request submitted, waiting for approval"
}Fetch credentials for an approved request. Poll this endpoint after submitting a request.
Headers:
X-API-Key: your_api_keyContent-Type: application/json
Body:
{
"request_id": "a1b2c3d4"
}Response (approved):
{
"request_id": "a1b2c3d4",
"approved": true,
"credential": {
"service": "aws-prod",
"scope": "read-only",
"username": "AKIA...",
"password": "secret...",
"notes": "Production AWS account",
"custom_field": "value"
},
"message": "Access approved"
}Response (pending):
{
"request_id": "a1b2c3d4",
"approved": false,
"message": "Request still pending approval"
}Response (denied/timeout):
{
"request_id": "a1b2c3d4",
"approved": false,
"message": "Request denied"
}List available services and system status.
Headers:
X-API-Key: your_api_key
Response:
{
"status": "online",
"services": ["aws-prod", "github-api", "openai-api"],
"vault_connected": true,
"discord_connected": true
}Health check endpoint (no authentication required).
Response:
{
"status": "healthy",
"timestamp": "2024-02-15 20:30:00 UTC",
"vault_status": "connected",
"discord_status": "connected"
}For each service in your Vaultwarden vault:
- Item Name: Use as the
serviceparameter (e.g., "aws-prod") - Custom Field: Add
scopesfield with comma-separated allowed scopes:Field Name: scopes Field Value: read-only,admin,billing - Credentials: Store in username/password fields as usual
- Additional Fields: Any custom fields will be included in the response
Name: github-api
Username: pranavprem
Password: ghp_xxxxxxxxxxxx
Custom Fields:
scopes: repo,admin,webhook
api_url: https://api.github.com
Notes: GitHub API token for automation
# Management
make build # Build Docker image
make up # Start services
make down # Stop services
make restart # Restart services
make logs # View logs
make status # Show container status
make health # Check API health
make clean # Clean up everything
# Manual Docker commands
docker-compose up -d # Start detached
docker-compose logs -f morpheus # Follow logs
docker-compose exec morpheus /bin/bash # Shell access- HTTP:
GET /health- API health status - Docker: Built-in health check every 30s
- Discord: Bot status visible in health response
- Application logs:
make logs - Discord audit trail:
#gatekeeper-logschannel - Request/response logs: Include request ID for tracking
Monitor these key metrics:
- Request success/failure rates
- Average approval times
- Timeout frequency
- Vault connection health
- Discord bot connectivity
# Install dependencies
pip install -r requirements.txt
# Set environment variables
export DISCORD_BOT_TOKEN="your_token"
export MORPHEUS_API_KEY="your_key"
# ... other vars
# Run locally
cd app
python -m uvicorn main:app --reload --port 8000morpheus/
βββ app/
β βββ main.py # FastAPI application
β βββ discord_bot.py # Discord bot for approvals
β βββ vault.py # Vaultwarden/bw CLI wrapper
β βββ config.py # Configuration management
βββ docker-compose.yml # Docker services
βββ Dockerfile # Container image
βββ Makefile # Build automation
βββ requirements.txt # Python dependencies
βββ .env.example # Environment template
βββ .gitignore # Git ignore rules
βββ README.md # This file
- Never commit
.env- credentials should never be in git - Rotate API keys regularly
- Monitor Discord channels for unusual activity
- Use least-privilege scopes in Vaultwarden items
- Deploy LAN-only - never expose publicly
- Regular backups of Vaultwarden vault
- Bot token security - treat like a password
Bot not responding to reactions:
- Check MESSAGE CONTENT intent is enabled
- Verify bot has permissions in channels
- Check bot is in the correct guild
Vault connection failed:
- Verify Vaultwarden URL is accessible from container
- Check master password is correct
- Ensure Bitwarden CLI is properly installed
API key rejected:
- Verify
X-API-Keyheader is included - Check API key matches
.envconfiguration - Ensure no extra whitespace in key
Timeouts:
- Default timeout is 10 minutes
- Check Discord notifications are working
- Verify approver user ID is correct
# Check container logs
make logs
# Test health endpoint
curl http://localhost:8000/health
# Test API key validation
curl -H "X-API-Key: your_key" http://localhost:8000/status
# Check Discord bot status
docker-compose exec morpheus python -c "from app.discord_bot import bot; print(bot.is_ready())"MIT License - See LICENSE file for details.
This is a personal project, but improvements are welcome:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
"Welcome to the real world." - Morpheus