MCP server for autonomous firewall orchestration using natural language to nftables rules. Provides tools for network context gathering, rule validation, conflict detection, safe deployment with rollback, and learning system management.
AFO has 28 tools with significant quality gaps. Tools 1-12 (agents/tools.py, afo_mcp/server.py) have detailed descriptions (100-300 chars) and proper schemas, but tools 13-28 (afo_mcp_server.py) are severely underdescribed (10-50 chars) with minimal context. Many tools lack parameter descriptions entirely. Naming is inconsistent: 'deploy_policy' vs 'deploy_rule', 'confirm_rule_deployment' vs 'confirm_deployment'. No tool annotations (readOnlyHint, destructiveHint) despite clear risk levels. Error handling guidance is absent across all tools. Output schemas are not documented. The server exposes destructive operations (delete_rule, bulk_delete_*) without confirmation patterns.
Apply a configuration preset
Approve an insight for application. Args: insight_id: ID of the insight to approve user: User approving the insight Approves a configuration insight. In manual mode, this will apply the insight immediately. In other modes, it marks the insight as approved for the next learning cycle. Use this after reviewing an insight and deciding it should be applied.
Block traffic from a country
Block a domain
Delete all rules affecting a specific IP
Delete all rules for a specific port
Delete all temporary rules
16 tools (list_rules, delete_rule, list_presets, block_country, unblock_country, block_domain, unblock_domain, bulk_delete_port, bulk_delete_ip, bulk_delete_temporary, get_backend_status, and others) have descriptions under 50 characters with no context on when to use them or what they return. Violates pattern:tool-description baseline of 194 chars average.
Destructive tools (delete_rule, bulk_delete_port, bulk_delete_ip, bulk_delete_temporary) lack confirmation patterns or dry-run support. No error guidance on recovery. Violates pattern:confirmation-request and pattern:recovery-guide.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 48 | <=2025-11-25 | v2 |
Confirm a deployment and disable auto-rollback. Args: rule_id: The rule ID from deploy_policy() Call this after verifying the deployed rules work correctly. This stops the heartbeat timer that would otherwise rollback. Returns: success: Whether confirmation succeeded
Delete a firewall rule by ID
Deploy a firewall rule with safety mechanisms. Args: rule_id: Unique identifier for tracking this rule rule_content: The nftables rule(s) to deploy approved: MUST be True to actually deploy (safety requirement) enable_heartbeat: Start auto-rollback timer (recommended) heartbeat_timeout: Seconds before auto-rollback (default 30) Returns deployment result with: - success: Whether deployment succeeded - status: pending/approved/deployed/failed/rolled_back - backup_path: Location of rollback backup - heartbeat_active: Whether auto-rollback is armed Safety features: 1. Requires explicit approved=True 2. Creates backup before any changes 3. Heartbeat monitor auto-rolls back if not confirmed 4. Use confirm_deployment() to finalize or rollback_deployment() to revert IMPORTANT: After deployment, call confirm_deployment(rule_id) to stop the auto-rollback timer, or let it expire to automatically revert.
Deploy a new firewall rule
Check for conflicts between a proposed rule and active rules. Args: proposed_rule: The nftables rule to check active_ruleset: Current ruleset (fetched automatically if not provided) Returns conflict report with: - has_conflicts: Whether any conflicts found - conflicts: List of {type, existing_rule, explanation} - recommendations: Suggested resolutions Conflict types: - shadow: New rule will never match (shadowed by existing) - redundant: New rule duplicates existing - contradiction: Rules have opposite actions - overlap: Partial overlap in criteria Run this before deploying new rules to catch issues early.
Get the currently active preset configuration
Get the status of the firewall backend
Get learning system performance metrics. Args: days: Number of days to look back Returns: - Patterns detected by type - Insights generated by type - Insights applied count - Learning cycle metrics Use this to monitor the learning system's activity and effectiveness.
Get current network context for firewall rule generation. Returns information about: - Network interfaces (names, IPs, MACs, VLANs, state) - Current nftables ruleset - System hostname Use this before generating firewall rules to understand the network topology.
Get detailed information about a specific learned pattern. Args: pattern_id: ID of the pattern to retrieve Returns: - Full pattern details including context and LLM analysis - Performance metrics (accuracy, feedback breakdown) Use this to investigate a pattern before validating or acting on it.
List configuration insights generated by the learning system. Args: insight_type: Filter by type (rule_suggestion/preset_adjustment/signature_update) min_confidence: Minimum confidence threshold pending_only: Only show unapplied insights limit: Maximum number to return Returns insights with: - id, type, description, recommendation - reasoning, confidence, based_on_patterns - applied status, user_approved, safety_validated Insights are configuration recommendations based on learned patterns. Review and approve insights to apply them to your firewall.
List patterns discovered by the learning system. Args: pattern_type: Filter by type (attack/false_positive/legitimate/anomaly) min_confidence: Minimum confidence threshold (0.0-1.0) limit: Maximum number of patterns to return Returns patterns with: - id, type, signature, confidence - evidence_count, first_seen, last_seen - source_ips, ports, protocols - validated status Use this to review what the system has learned from logs and deployments.
List all available configuration presets
List all active firewall rules
Preview changes that would be made by applying a preset
Reject an insight and provide feedback. Args: insight_id: ID of the insight to reject user: User rejecting the insight reason: Reason for rejection Rejects a configuration insight and stores feedback. The insight will not be applied and the feedback helps improve future recommendations. Use this when an insight is incorrect or undesirable.
Remove the active configuration preset
Manually rollback a deployed rule. Args: rule_id: The rule ID to rollback Restores the system to the state before this rule was deployed.
Unblock traffic from a country
Unblock a domain
Provide feedback on a pattern's accuracy. Args: pattern_id: ID of the pattern to validate is_correct: Whether the pattern is correct user: User providing feedback comment: Optional comment explaining the validation Validates or invalidates a learned pattern. Incorrect patterns are deactivated and their confidence is reduced. Use this to improve the learning system's accuracy over time.
No tool annotations (readOnlyHint, destructiveHint, idempotentHint) present in any tool definition. Risk levels are documented in the spec but not exposed to clients. Violates current MCP spec (2026-07-28) tool annotation requirement.
Output schemas are not documented for any tool. LLMs cannot plan downstream calls or extract required fields. Violates pattern:tool and pattern:response-shaper.
Naming inconsistency: 'deploy_policy' vs 'deploy_rule', 'confirm_rule_deployment' vs 'confirm_deployment', 'rollback_rule' vs 'rollback_deployment'. LLMs conflate similar names. Violates pattern:tool naming convention.