feat: add MCP server for AI agent integration#1052
Draft
james00012 wants to merge 7 commits intomasterfrom
Draft
feat: add MCP server for AI agent integration#1052james00012 wants to merge 7 commits intomasterfrom
james00012 wants to merge 7 commits intomasterfrom
Conversation
…throttle detection
Align GCP nuke path with AWS patterns:
- GetAllResources and NukeAllResources now accept and propagate context.Context
- NukeAllResources and nukeResource return aggregated errors via multierror
- Replace string matching ("QUOTA_EXCEEDED") with structured gRPC/HTTP error checks
(codes.ResourceExhausted, HTTP 429, HTTP 403 with rate-limit reasons)
- Append errors before telemetry to prevent data loss on telemetry failure
… rendering - Wire isServiceDisabledError into GetAllResources to silently skip disabled APIs instead of emitting noisy GeneralError events - Sanitize error strings in printErrorsTable with RemoveNewlines and Truncate to prevent multiline gRPC errors from breaking pterm tables - Fix RemoveNewlines to replace \n with space instead of empty string - Promote genproto/googleapis/rpc to direct dependency (go mod tidy) - Add unit tests for Truncate, RemoveNewlines, and multiline error rendering
…truct - Add gcp.Query struct mirroring aws.Query (ProjectID, ResourceTypes, ExcludeResourceTypes, time filters, timeout) - GetAllResources now takes *Query instead of individual params - Wire --resource-type and --exclude-resource-type CLI flags into Query - SERVICE_DISABLED errors are reported as errors when the resource is explicitly targeted, silently skipped otherwise - Trim test verbosity
…ed pattern Introduce GcpConfig struct, resource registry with global/regional split, region loop in GetAllResources/NukeAllResources, IsNukeable with exclude support, and Query.Validate() with region filtering.
This reverts commit 7a89aaf.
Add an MCP (Model Context Protocol) server that exposes cloud-nuke capabilities to AI agents over stdio. This enables programmatic resource discovery and cleanup through a standardized protocol. Tools: - list_resource_types: enumerate supported resource types (AWS/GCP) - inspect_resources: read-only scan to discover resources - nuke_resources: delete resources with multi-layer safety checks - validate_config: parse and validate inline YAML config Safety model: - dry_run defaults to true; explicit CONFIRM_NUKE string required - --read-only mode disables nuke entirely - --allowed-regions, --allowed-resource-types, --allowed-projects whitelists - --max-resources-per-nuke limit (default 100) - Structured audit logging to stderr for all operations
b1263b5 to
ed8e736
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cloud-nuke mcp-server) that exposes cloud-nuke capabilities to AI agents over stdiolist_resource_types,inspect_resources,nuke_resources,validate_configCONFIRM_NUKEconfirmation string,--read-onlymode, region/resource-type/project allowlists, max-resources-per-nuke limit (default 100)File structure
Usage
MCP client config example
{ "mcpServers": { "cloud-nuke": { "command": "cloud-nuke", "args": ["mcp-server", "--allowed-regions", "us-east-1"] } } }Test plan
go build ./...succeedsgo vet ./...cleango test ./mcp/...— 79 tests passcloud-nuke mcp-serverstarts and responds to JSON-RPC over stdinlist_resource_typesreturns AWS/GCP typesinspect_resourceswith real AWS creds scans resourcesnuke_resourceswithdry_run: truereturns preview