This project demonstrates the capabilities of the Spacelift Intent MCP Server by deploying a fully functional browser-based Snake game to AWS S3 static website hosting - entirely through AI-driven infrastructure management.
This snake game was 100% created using AI, including:
- Game logic and implementation
- UI/UX design with Dracula theme color scheme
- AWS infrastructure setup and configuration
- Debugging and bug fixes based on user feedback
- All infrastructure deployed through the Spacelift Intent MCP Server
Spacelift Intent is an MCP (Model Context Protocol) server that provides AI assistants with the ability to manage infrastructure through OpenTofu/Terraform. It handles:
- Resource lifecycle management (create, read, update, delete)
- Dependency tracking between resources
- Policy enforcement and validation
- State management
- Provider schema discovery
Phase 1: Setup Intent Project
- Clone this repository to your local machine:
git clone git@github.com:spacelift-solutions/intent.git- cd into its directory before continuing (if you dont do this, the mcp server wont work correctly with claude code)
- Create a new Spacelift Intent Project in your Spacelift account (note its id for later)
- Create the
block-public-s3-websites.regointent policy to your Spacelift account. - Attach the policy to your Intent Project.
- Setup claude with your Spacelift Intent Server ex.
claude mcp add -t http spacelift https://spacelift-solutions.app.spacelift.io/intent/mcp - Ensure the MCP server is authenticated by starting a new claude code session and running
/mcp.
Phase 2: Start Demo and Demonstrate Blocking
- Start a new Claude Code session
- Request: "Use Spacelift Intent project
{your-intent-project-id}" - Request: "Let's deploy my snake game to Amazon S3"
- Observe: The AI will successfully create the S3 bucket, but policy violations will block:
aws_s3_bucket_website_configuration- Public hosting blockedaws_s3_bucket_public_access_block- Public access blocked (all 4 settings must betrue)aws_s3_bucket_policy- Public bucket policy blocked (Principal: "*" not allowed)
- The deployment will fail with clear policy violation messages
Phase 3: Remove Policy and Deploy Successfully
- Remove the policy from your Intent Project in Spacelift
- Request: "I've removed the policy, lets try deploying it now."
- Observe: All resources create successfully without policy blocking
- The snake game is now publicly accessible
Phase 4: Import Unmanaged Resources and Generate IaC
This phase demonstrates Intent's ability to adopt existing infrastructure and generate IaC code:
-
Create an unmanaged AWS resource outside Intent (e.g., via AWS console or CLI):
aws s3api create-bucket --bucket my-unmanaged-demo-bucket-$(date +%s) --region us-east-1Note the bucket name for the next step.
-
Request: "Import the existing S3 bucket
my-unmanaged-demo-bucket-XXXXXinto Intent" -
Observe: The AI will:
- Use
lifecycle-resources-importto bring the resource under management - Add it to the Intent state
- Show the imported resource configuration
- Use
-
Request: "Generate OpenTofu HCL code, including import blocks, into a file for all resources in this project"
-
Observe: The AI will:
- Retrieve state for all managed resources
- Generate proper HCL configuration with resource blocks
- Include resource dependencies and references
- Output ready-to-use
.tffiles
Phase 5: Cleanup
- Request: "Delete all resources in my Intent project"
- Confirm with:
CONFIRM
- Policy-as-Code: Rego policies provide governance and compliance guardrails
- Clear Violations: Policy messages explain exactly what's blocked and why
- Selective Enforcement: Policies allow private S3 buckets while blocking public ones
- AI Understanding: The AI interprets policy violations and explains them to users
- Flexible Governance: Policies can be attached/removed as needed per environment
Important: The README.md file contains implementation details that make for a less engaging demo. The CLAUDE.md file ensures the AI doesn't read this file unless explicitly requested.