npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

n8n-nodes-mbs-backup

v1.2.0

Published

MBS Retrieve Backup node for n8n - download MBS PostgreSQL backup files via SFTP with dynamic credentials

Downloads

486

Readme

n8n-nodes-mbs-backup

NPM Version License

Custom n8n node for retrieving MBS PostgreSQL backup files via SFTP.

This node automatically finds and downloads all backup files from MBS backup directories, handling the dynamic timestamp-based folder naming that MBS uses.

Features

  • 🔐 Secure SFTP Connection - Encrypted file transfers
  • 📁 Automatic Folder Discovery - Finds the latest backup folder by company code
  • 🔄 Recursive Download - Downloads all files including subdirectories
  • 🎯 Pattern Matching - Optional file filtering with wildcard support
  • 📦 Binary Data Output - Files ready for S3 upload or further processing
  • 🏢 Multi-Tenant Support - Configurable company codes for multiple MBS customers

Installation

Via n8n Community Nodes (Recommended)

  1. Go to SettingsCommunity Nodes in your n8n instance
  2. Click Install a Community Node
  3. Enter: n8n-nodes-mbs-backup
  4. Click Install

Via npm (Docker/Self-Hosted)

# For Docker installations
docker exec -it <n8n-container-name> npm install -g n8n-nodes-mbs-backup

# Restart n8n
docker restart <n8n-container-name>

Quick Start

Option A: Using AWS Secrets Manager (Recommended)

This is the most secure approach - retrieve credentials dynamically from AWS Secrets Manager.

1. Store SFTP credentials in AWS Secrets Manager:

aws secretsmanager create-secret \
  --name mbs/sftp/credentials \
  --secret-string '{
    "host": "transfer.cdg.ws",
    "port": 22,
    "username": "your-username",
    "password": "your-password"
  }'

2. Create workflow:

[AWS Secrets Manager Node]
  Secret Name: mbs/sftp/credentials
  Parse JSON: Yes
  ↓
[MBS Retrieve Backup Node]
  Host: ={{$json.host}}
  Port: ={{$json.port}}
  Username: ={{$json.username}}
  Password: ={{$json.password}}
  Company Code: CO655
  Base Path: /fromcdg/backup/

Option B: Hardcoded Credentials

For testing or non-production use:

1. Add MBS Retrieve Backup Node

  • Host: transfer.cdg.ws
  • Port: 22
  • Username: your-sftp-username
  • Password: your-sftp-password
  • Company Code: CO655
  • Base Path: /fromcdg/backup/

3. What Happens Next

The node will:

  1. Connect to your SFTP server
  2. Find the folder matching CO655-YYYY-MM-DD-HH-MM-SS pattern
  3. Download all .dat.gz files and toc.dat
  4. Output one item per file with binary data attached

Usage Examples

Example 1: Download All MBS Backup Files

[MBS Retrieve Backup]
├─ Company Code: CO655
├─ Base Path: /fromcdg/backup/
└─ File Pattern: *

Output: All files from the latest backup folder (1,079+ .dat.gz files + toc.dat)

Example 2: Download Only .dat.gz Files

[MBS Retrieve Backup]
├─ Company Code: CO655
├─ Base Path: /fromcdg/backup/
└─ File Pattern: *.dat.gz

Output: Only compressed data files, excluding toc.dat

Example 3: Complete Backup Pipeline

[Schedule Trigger (Daily 2 AM)]
  ↓
[MBS Retrieve Backup]
  ↓
[AWS S3 (Upload Multiple Files)]
  ↓
[Slack Notification (Success/Failure)]

Node Parameters

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | Host | String | Yes | ={{$json.host}} | SFTP server hostname | | Port | Number | Yes | 22 | SFTP server port | | Username | String | Yes | ={{$json.username}} | SFTP username (supports expressions) | | Password | String | Yes | ={{$json.password}} | SFTP password (supports expressions) | | Company Code | String | Yes | - | Company identifier (e.g., CO655 for Archtop) | | Base Path | String | Yes | /fromcdg/backup/ | Base directory on SFTP server | | File Pattern | String | No | * | File pattern to match (supports * wildcard) | | Binary Property Name | String | Yes | data | Property name for binary file data |

Output Format

Each downloaded file produces one item:

{
  "json": {
    "fileName": "3591.dat.gz",
    "filePath": "/fromcdg/backup/CO655-2024-01-15-14-30-45/3591.dat.gz",
    "fileSize": 245678,
    "backupFolder": "CO655-2024-01-15-14-30-45",
    "companyCode": "CO655",
    "modifyTime": 1705330245000
  },
  "binary": {
    "data": {
      "data": "...", // File contents as Buffer
      "fileName": "3591.dat.gz",
      "mimeType": "application/gzip"
    }
  }
}

MBS Backup Structure

MBS creates backup folders with this naming pattern:

/fromcdg/backup/
└── CO655-2024-01-15-14-30-45/  (Company code + timestamp)
    ├── 3591.dat.gz
    ├── 3592.dat.gz
    ├── ... (1,079+ files)
    └── toc.dat

Important: MBS only keeps ONE backup at a time. Old backups are deleted when new ones are created.

Dynamic Credentials

This node accepts SFTP credentials as parameters, making it perfect for dynamic credential flows:

From AWS Secrets Manager:

[AWS Secrets Manager] → [MBS Retrieve Backup]
  - Host: ={{$json.host}}
  - Username: ={{$json.username}}
  - Password: ={{$json.password}}

From any previous node: The node accepts expressions for all credential fields, so you can retrieve credentials from:

  • AWS Secrets Manager
  • Environment variables
  • Configuration nodes
  • API responses
  • Any other n8n node output

Common Use Cases

1. Daily Backup to S3

Download MBS backups daily and upload to AWS S3 for long-term storage:

Schedule → MBS Retrieve Backup → AWS S3 Upload → Slack Notification

2. Dynamic Credentials from AWS Secrets

Retrieve SFTP credentials from AWS Secrets Manager:

AWS Secrets Manager → MBS Retrieve Backup → Process Files

3. Backup Verification

Download backups and verify file counts/sizes:

MBS Retrieve Backup → Code Node (Count Files) → Conditional (Alert if < Expected)

Troubleshooting

Node not appearing after installation

# Check if package is installed
npm list -g | grep mbs-backup

# Check n8n logs
docker logs <n8n-container-name>

# Force restart
docker restart <n8n-container-name>

Connection timeout

  • Verify SFTP credentials are correct
  • Check firewall rules allow outbound port 22
  • Ensure VPN is connected if required

No backup folder found

  • Verify company code is correct (case-sensitive)
  • Check base path exists on SFTP server
  • Confirm MBS has created a backup today

Out of memory during download

For very large backups (>1000 files):

  • Download files in batches using file pattern
  • Process files immediately after download
  • Use streaming for large file uploads to S3

Development

# Clone repository
git clone https://github.com/manateeit/n8n-nodes-mbs-backup.git
cd n8n-nodes-mbs-backup

# Install dependencies
npm install

# Build
npm run build

# Watch mode for development
npm run dev

License

MIT

Support

  • Issues: https://github.com/manateeit/n8n-nodes-mbs-backup/issues
  • n8n Community: https://community.n8n.io

Related Nodes

Credits

Created by Archtop for MBS backup automation.