Labsco
Facets-cloud logo

Facets Module

2

from Facets-cloud

Create and manage Terraform modules for cloud-native infrastructure using the Facets.cloud FTF CLI.

🔥🔥✓ VerifiedAccount requiredNeeds API keys

⚠️ DEPRECATED: This repository is no longer actively maintained. Please use Praxis instead. If you need this functionality outside of Praxis, use the Raptor CLI.

Facets Module MCP Server

This MCP (Model Context Protocol) Server for the Facets Module assists in creating and managing Terraform modules for infrastructure as code. It integrates with Facets.cloud's FTF CLI, providing secure and robust tools for module generation, validation, and management to support cloud-native infrastructure workflows.

Key Features

  • Secure File Operations
    Limits all file operations to within the working directory to ensure safety and integrity.

  • Modular MCP Tools
    Offers comprehensive tools for file listing, reading, writing, module generation, validation, and previews. All destructive or irreversible commands require explicit user confirmation and support dry-run previews.

  • Facets Module Generation
    Interactive prompt-driven workflows facilitate generation of Terraform modules with metadata, variable, and input management using FTF CLI.

  • Module Forking
    Fork existing modules from the Facets control plane to create customized variants. Supports discovering available modules, updating metadata, and customizing functionality while preserving the original module structure.

  • Supplementary Instructions Support
    Automatically reads additional project-specific instructions from the mcp_instructions directory at the root level, allowing teams to define custom requirements, constraints, and guidelines that supplement the default module generation behavior.

  • Module Preview and Testing
    Comprehensive deployment workflow supporting module preview, testing in dedicated test projects, and real-time deployment monitoring with status checks and logs. You will need a test project with a running environment and an enabled resource added for the module being tested (to be done manually from the Facets UI).

  • Cloud Environment Integration
    Supports multiple cloud providers and automatically extracts git repository metadata to enrich module previews.

Available MCP Tools

Tool NameDescription
FIRST_STEP_get_instructionsLoads all module writing instructions from the module_instructions directory and supplementary instructions from mcp_instructions. Always call this first.
list_filesLists all files in the specified module directory securely within the working directory.
read_fileReads the content of a file within the working directory.
edit_file_blockApply surgical edits to specific blocks of text in files. Makes precise changes without rewriting entire files. Cannot edit outputs.tf or facets.yaml files.
write_config_filesWrites and validates facets.yaml configuration files with dry-run and diff previews.
write_resource_fileWrites Terraform resource files (main.tf, variables.tf, etc.) safely. Excludes outputs.tf and facets.yaml.
write_outputsWrites the outputs.tf file for a module with output attributes and interfaces in a local block.
write_readme_fileWrites a README.md file for the module directory with AI-generated content.
write_generic_fileWrites files generically with working directory and file type checks. Path: facets_mcp/tools/module_files.py
generate_module_with_user_confirmationGenerates a new Terraform module scaffold with dry-run preview and user confirmation.
validate_moduleValidates a Terraform module directory using FTF CLI standards and checks output types.
push_preview_module_to_facets_cpPreviews a module by pushing a test version to the control plane with git context extracted automatically.
register_output_typeRegisters a new output type in the Facets control plane with interfaces and attributes and providers.
get_output_type_detailsRetrieves details for a specific output type from the Facets control plane.
find_output_types_with_providerFinds all output types that include a specific provider source for module configurations.
get_local_modulesScans and lists all local Terraform modules by searching for facets.yaml recursively, including loading outputs.tf content if present.
search_modules_after_confirmationSearches modules by filtering for a string within facets.yaml files, supports pagination, and returns matched modules with details.
list_test_projectsRetrieves and returns the names of all available test projects for deployment.
test_already_previewed_moduleTests a module that has been previewed by deploying it to a specified test project.
check_deployment_statusChecks the status of a deployment with optional waiting for completion.
get_deployment_logsRetrieves logs for a specific deployment.
list_modules_for_forkLists all available modules from the control plane that can be forked, displaying them in a compact format for easy selection.
fork_existing_moduleForks an existing module by downloading it and updating its metadata (flavor and version). Supports dry-run preview and user confirmation.

Module Forking Use Cases

The MCP server now supports forking existing modules from the Facets control plane. Use the "Fork Existing Module" prompt to access a guided workflow for:

  • Security enhancements: Fork a basic module to add additional security controls or compliance requirements
  • Cloud provider adaptations: Adapt modules for different cloud providers while maintaining core functionality
  • Performance optimizations: Create high-performance variants of existing modules with enhanced configurations
  • Feature customizations: Add organization-specific features or integrations to existing modules
  • Version updates: Modernize older modules with updated provider versions or new Terraform features

The fork workflow maintains the original module structure while allowing you to customize metadata, variables, resources, and outputs to meet your specific requirements.


📘 Additional Guide

For a detailed, real-world walkthrough of building a secure S3 bucket module with AI on the Facets platform, check out
GUIDE.md – Building Facets Modules with AI: A Practical Guide

This guide demonstrates the full conversation flow—requirements, design refinement, implementation review, validation, testing, and iteration—using a developer-focused example tailored for a banking use case.


License

This project is licensed under the MIT License. You are free to use, modify, and distribute it under its terms.