██╗ ██╗██╗██████╗ ██████╗ ██████╗ ██╗ ██╗ █████╗ ██████╗ ██████╗
██║ ██╔╝██║██╔══██╗██╔═══██╗██╔════╝ ██║ ██║██╔══██╗██╔══██╗██╔══██╗
█████╔╝ ██║██████╔╝██║ ██║██║ ███╗██║ ██║███████║██████╔╝██║ ██║
██╔═██╗ ██║██╔══██╗██║ ██║██║ ██║██║ ██║██╔══██║██╔══██╗██║ ██║
██║ ██╗██║██║ ██║╚██████╔╝╚██████╔╝╚██████╔╝██║ ██║██║ ██║██████╔╝
╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝
🛡️ MCP Prevention Server 🛡️
KiroGuard is an MCP (Model Context Protocol) server that acts as a preventive guard before code reaches production. It exposes multiple security, quality, and cost analysis tools over JSON-RPC 2.0.
Built in Go for speed and reliability, KiroGuard runs as a single binary and supports two transport modes:
- stdio: For integration with git hooks, editors, and CLI tools
- HTTP + SSE: For remote connections and web-based workflows
- Regex-based detection of hardcoded secrets (AWS keys, API tokens, PEM headers, DB DSNs, JWTs)
.envguardignoresupport with glob and regex patterns- Automatic migration to AWS Secrets Manager or SSM Parameter Store
- Generates safe replacement snippets without leaking original secrets
- Parses npm (
package.json,package-lock.json) and pip (requirements.txt) manifests - Batch vulnerability lookup via OSV.dev API (free, no API key required)
- Human-readable CVE explanations powered by AWS Bedrock LLM
- AST-based import graph construction using Go's
go/parser - Configurable architecture rules (YAML) with glob pattern matching
- Default layered architecture rules (domain ↛ infrastructure ↛ presentation)
- Read-only operation — never modifies source files
- Pre-deploy pattern detection:
- N+1 query loops
- Unpaginated DynamoDB scans
- Lambdas without memory/timeout configuration
- Monthly cost estimation with documented formulas based on AWS public pricing
- Concrete dollar amounts (e.g., "$73/month at 1000 req/hr")
- AST-based detection of AWS SDK calls in Go source code (ec2, s3, lambda, iam, dynamodb, sqs, sns, etc.)
- IaC wildcard scanning for
Action: "*"andResource: "*"in Terraform, YAML, JSON, TypeScript - Least-privilege IAM policy generation via AWS Bedrock LLM (async, non-blocking)
- Request IDs for correlating async policy generation with scan results
- Files up to 5MB (configurable) with automatic skip of vendor/node_modules/.git
┌─────────────────────────────────────────────────────────────────┐
│ KiroGuard MCP Server │
├─────────────────────────────────────────────────────────────────┤
│ Transport Layer │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ stdio │ │ HTTP + SSE │ │
│ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │
│ └────────┬───────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ JSON-RPC 2.0 Dispatcher │ │
│ └────────────────────────┬─────────────────────────────────┘ │
│ │ │
│ ┌────────────┬───────────┼────────────┬──────────────┐ │
│ ▼ ▼ ▼ ▼ ▼ │
│ ┌────────┐ ┌────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Env- │ │ Vuln │ │ Clean │ │ FinOps │ │ IAM │ │ LLM │ │
│ │ Guard │ │Scanner │ │ Arch │ │ Guardrail│ │ Guard │ │ Backend │ │
│ └────────┘ └────────┘ └──────────┘ └──────────┘ └─────────┘ └─────────┘ │
│ │
│ AWS Services (optional) │
│ ┌──────────────┬───────────────┬─────────────────┐ │
│ │ Bedrock │ Secrets Mgr │ SSM Parameter │ │
│ │ (LLM) │ (migration) │ Store │ │
│ └──────────────┴───────────────┴─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
# Clone the repository
git clone https://github.com/luiferdev/kiroguard.git
cd kiroguard
# Build the binary
go build -o kiroguard .
# Or install globally
go install .# Run with stdio transport (for MCP clients)
go run .# Run with SSE transport on custom port
go run . -transport sse -port 8080# Run with custom config
go run . -config config.yaml -log-format jsonKiroGuard works out of the box with sensible defaults. For customization, create a config.yaml:
transport:
type: stdio # stdio or sse
port: 3000 # HTTP port for SSE
llm:
region: us-east-1 # AWS region for Bedrock
model-id: anthropic.claude-3-sonnet-20240229-v1:0
envguard:
ignore-file: .envguardignore
cleanarch:
rules-file: cleanarch-rules.yaml
finops:
default-rph: 1000 # Default requests per hour
iamguard:
enrich-timeout-ms: 5000 # Per-LLM-call deadline
scan-timeout-ms: 10000 # AST + IaC scan deadline
max-file-size-mb: 5 # Max IaC file size
max-concurrent: 3 # Concurrent LLM calls| Flag | Default | Description |
|---|---|---|
-transport |
stdio |
Transport type: stdio or sse |
-port |
3000 |
HTTP port for SSE transport |
-config |
"" |
Path to YAML configuration file |
-log-format |
text |
Log output format: text or json |
Once running, KiroGuard exposes these tools via JSON-RPC 2.0:
| Tool | Description |
|---|---|
envguard/scan |
Scan code for hardcoded secrets |
vulnscanner/scan |
Check dependencies for known CVEs |
cleanarch/analyze |
Analyze code architecture violations |
finops/analyze |
Estimate cloud cost impact |
iamguard/analyze |
Analyze AWS SDK usage and generate least-privilege IAM policies |
# .git/hooks/pre-commit
#!/bin/bash
go run . -transport stdioConfigure the MCP client to connect to KiroGuard's SSE endpoint.
# Run all tests
go test ./...
# Run tests with verbose output
go test -v ./...
# Run tests with race detection
go test -race ./...
# Tidy dependencies
go mod tidy- Language: Go 1.26.5
- Protocol: JSON-RPC 2.0
- AWS SDK: aws-sdk-go-v2
- Config: YAML (gopkg.in/yaml.v3)
- Logging: Standard library log/slog
MIT License - see LICENSE for details.
Contributions are welcome! Please open an issue or submit a PR.
Built with 🔥 by kronosoft
```