Barracuda-MCP-v2

LanceHardwoodXXX/Barracuda-MCP-v2

3.2

If you are the rightful owner of Barracuda-MCP-v2 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Barracuda CloudGen Firewall MCP Server v2 is a Model Context Protocol server designed to manage Barracuda CloudGen Firewalls through their REST API, supporting both policy-driven and standard rule-based firewalls.

Tools
5
Resources
0
Prompts
0

Barracuda CloudGen Firewall MCP Server v2

MCP Version Python Version Docker

A Model Context Protocol (MCP) server for managing Barracuda CloudGen Firewalls through their REST API. Version 2 supports both policy-driven and standard rule-based firewalls with automatic mode detection.

๐Ÿ†• What's New in v2

  • Automatic Mode Detection: Detects if your firewall is policy-driven or standard rule-based
  • Dual Mode Support: Works with both firewall types seamlessly
  • Enhanced Rule Management: Create, modify, and delete rules on standard firewalls
  • Dynamic Rules Support: List and manage dynamic firewall rules
  • Improved Error Handling: Better feedback for mode-specific limitations
  • Extended API Coverage: Support for more endpoints and operations

๐ŸŽฏ Features

Universal Features (Both Modes)

  • System Monitoring: Real-time health status and system metrics
  • Service Management: List and monitor firewall services
  • Network Objects: View, filter, and manage network objects
  • Service Objects: Browse and manage service definitions
  • Mode Detection: Automatically identify firewall operation mode

Standard Mode Features

  • Rule Management: Create, modify, and delete firewall rules
  • Rule Listing: View all rules with detailed information
  • Dynamic Rules: Manage dynamic firewall rules
  • Rule Search: Find specific rules by name
  • Bidirectional Rules: Configure bidirectional traffic rules

Policy-Driven Mode Features

  • Status Monitoring: System health and event monitoring
  • Object Management: Network and service object configuration
  • Policy Status: Check policy configuration status
  • Limited Rule Access: View-only access to rule information

๐Ÿ“‹ Prerequisites

  • Python 3.11+
  • Docker (optional)
  • Barracuda CloudGen Firewall with REST API enabled
  • API Token for authentication
  • Claude Desktop (for MCP integration)

๐Ÿš€ Quick Start

Option 1: Docker (Recommended)

# Clone the repository
git clone https://github.com/yourusername/barracuda-cgf-mcp-v2.git
cd barracuda-cgf-mcp-v2

# Build the Docker image
docker build -t barracuda-mcp:v2 .

# Run with your firewall credentials
docker run -it --rm \
  -e BARRACUDA_HOST=http://your-firewall:8080 \
  -e BARRACUDA_API_TOKEN=your-token \
  barracuda-mcp:v2

Option 2: Python

# Install dependencies
pip install -r requirements.txt

# Set environment variables
export BARRACUDA_HOST="http://your-firewall:8080"
export BARRACUDA_API_TOKEN="your-api-token"

# Run the server
python barracuda_server_v2.py

๐Ÿ”ง Configuration

Environment Variables

VariableDescriptionExample
BARRACUDA_HOSTFirewall URL with protocol and porthttp://192.168.1.1:8080
BARRACUDA_API_TOKENAPI authentication tokenyour-api-token
LOG_LEVELLogging level (optional)INFO, DEBUG

Claude Desktop Integration

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "barracuda-cgf-v2": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--name", "barracuda-mcp-v2",
        "-e", "BARRACUDA_HOST=http://your-firewall:8080",
        "-e", "BARRACUDA_API_TOKEN=your-token",
        "barracuda-mcp:v2"
      ]
    }
  }
}

๐Ÿ› ๏ธ Available Tools

Universal Tools

ToolDescriptionWorks In
get_system_statusSystem health and statusBoth modes
detect_firewall_modeIdentify firewall operation modeBoth modes
list_servicesList all running servicesBoth modes
list_network_objectsList network objects with filteringBoth modes
list_service_objectsList service objects with filteringBoth modes

Rule Management Tools

ToolDescriptionWorks In
list_firewall_rulesList all firewall rules with detailsStandard mode
get_firewall_ruleGet specific rule configurationStandard mode
create_firewall_ruleCreate new firewall ruleStandard mode
delete_firewall_ruleDelete existing ruleStandard mode
list_dynamic_rulesList dynamic firewall rulesStandard mode

๐Ÿ“ Usage Examples

Detect Firewall Mode

"What type of firewall am I connected to?"
"Detect the firewall mode"

System Status

"Show me the system status"
"Check firewall health"

Rule Management (Standard Mode)

"List all firewall rules"
"Show me the rule named 'BOX-LAN-2-INTERNET'"
"Create a rule to allow HTTP from LAN to Internet"
"Delete the test rule"

Object Management

"List all network objects"
"Show service objects containing 'HTTP'"
"Filter network objects for 'VPN'"

๐Ÿงช Testing Your Firewall Type

Test if Standard Mode (Rule-Based)

curl -X 'GET' \
  'http://your-firewall:8080/rest/config/v1/forwarding-firewall/rules?expand=false&envelope=false' \
  -H 'accept: application/json' \
  -H 'X-API-Token: your-token'

Response for Standard Mode: Returns rule list Response for Policy-Driven: Returns 409 error

๐Ÿ” Firewall Mode Detection

The server automatically detects your firewall mode on startup:

  • Standard Mode: Direct rule manipulation available
  • Policy-Driven Mode: Rules managed through Control Center
  • Unknown Mode: Some features may be limited

๐Ÿ› Troubleshooting

Common Issues

IssueSolution
Connection refusedVerify firewall URL and port
401 UnauthorizedCheck API token validity
409 on rule operationsFirewall is policy-driven
Mode detection failsCheck API permissions

Debug Mode

Enable detailed logging:

export LOG_LEVEL=DEBUG
python barracuda_server_v2.py

๐Ÿ”’ Security

  • API tokens are never logged in production mode
  • Supports both HTTP and HTTPS connections
  • Non-root user in Docker containers
  • Input validation on all operations

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

๐Ÿ“„ License

MIT License - see file

๐Ÿ™ Acknowledgments

๐Ÿ“Š Compatibility

Tested Firewall Versions

  • Barracuda CloudGen Firewall F-Series
  • Barracuda CloudGen Firewall V-Series
  • Firmware versions 8.x and above

Supported Operations by Mode

OperationStandard ModePolicy-Driven Mode
View System Statusโœ…โœ…
List Servicesโœ…โœ…
List Network Objectsโœ…โœ…
List Service Objectsโœ…โœ…
List Firewall Rulesโœ…โŒ
Create Rulesโœ…โŒ
Modify Rulesโœ…โŒ
Delete Rulesโœ…โŒ
Manage Dynamic Rulesโœ…โŒ