Guardian MCP Toolkit
Integrates with GitHub Actions for CI/CD pipelines, enabling automated governance audits on push and pull requests.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Guardian MCP Toolkitaudit the current project for architecture violations"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ก๏ธ Guardian โ Headless Governance Platform
Active architecture governance for Clean Architecture, DDD, SOLID, TDD, and Security โ in 8 languages.
Guardian is not a linter. It's a headless active governance platform that detects Architectural Drift (structural erosion) and Semantic Violations (naming that breaks the Ubiquitous Language) in real-time โ providing Auto-Remediation and contextual education directly in your workflow.
The Differentiator: Fusion of local high-speed AST analysis with cloud semantic reasoning via Amazon Bedrock to protect your domain model.
Table of Contents
Related MCP server: CodeBase Optimizer
๐ Quick Start
# Install globally
npm install -g guardian-mcp-toolkit
# Audit any project (auto-detects structure & language)
guardian audit /path/to/your/project
# See what was detected
guardian audit . --format json
# Auto-remediate violations
guardian fix . --apply
# Watch mode โ real-time feedback as you code
guardian watch .First time? Guardian auto-detects your project structure and generates a .guardian.json (Governance Policy) on first run. No configuration needed to start.
๐ง How It Works
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Guardian Governance Platform โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ CLI โโโโโถโ MCP Server โโโโโถโ Amazon Bedrock โ โ
โ โ (TUI) โ โ (12 Agents) โ โ (Claude Sonnet) โ โ
โ โโโโโโฌโโโโโโ โโโโโโโโโฌโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โDashboard โโโโโถโ EventBus โโโโโถโ LSP Server โ โ
โ โ(React/SSE)โ โ (real-time) โ โ (IDE diagnostics)โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโGuardian operates in three layers:
Local AST Analysis โ Sub-second detection of structural violations (layer boundaries, DDD, security patterns)
Semantic Analysis โ Amazon Bedrock (Claude) analyzes naming, SOLID principles, and domain alignment
Real-time Distribution โ EventBus pushes results to CLI, Dashboard, LSP, and SSE simultaneously
๐ MCP Integration (IDE)
Connect Guardian to any MCP-compatible IDE (Kiro, VS Code, Cursor, Claude Desktop):
{
"mcpServers": {
"guardian": {
"command": "guardian",
"args": ["mcp", "serve"]
}
}
}Once connected, your AI assistant can use 20+ Guardian tools. Examples:
"Check if this import violates layer boundaries"
"Scan this directory for exposed secrets"
"Audit this file's SOLID compliance"
"Generate the dependency graph for src/"
๐ป CLI Reference
guardian audit [path]
Run a full governance audit with all enabled agents.
guardian audit . # Audit current directory
guardian audit src/ --format json # JSON output to stdout
guardian audit . --fail-on warning # Fail on warnings too (strict)
guardian audit . --fail-on error # Fail only on errors (default)Exit codes: 0 = passed, 1 = violations found, 2 = input error
guardian fix [path]
Detect and auto-remediate Architectural Drift.
guardian fix . # Show proposed fixes (dry-run)
guardian fix . --apply # Apply fixes automaticallySupported Auto-Remediations:
Drift Type | Remediation |
Layer boundary violation | Generate interface in domain, move impl to infra |
Missing test file | Generate test skeleton (AAA pattern) |
Fat interface (ISP) | Suggest split into cohesive interfaces |
process.env in domain | Extract to infrastructure ConfigService |
Mutable public state (DDD) | Add |
Hardcoded secrets | Replace with env variable reference |
guardian watch [path]
Live Mode โ real-time governance as you code.
guardian watch . # Watch current directory
guardian watch src/ --port 4200 # Custom SSE portDebounces file changes (300ms), runs only relevant agents via Smart Routing, and pushes results to:
Terminal (stderr) โ immediate feedback
SSE Channel โ Dashboard updates
LSP Server โ IDE squiggly lines
Press Ctrl+C for graceful shutdown.
guardian dashboard
Open the web dashboard with Health Score, Radar Chart, and Heatmap.
guardian dashboard # Opens http://localhost:4000
guardian dashboard --port 8080 # Custom portguardian init
Generate a .guardian.json Governance Policy with defaults.
guardian init # Creates .guardian.json in current directoryguardian agent list|enable|disable
Manage which agents are active.
guardian agent list # Table of all agents with status
guardian agent enable ddd-guard # Enable a specific agent
guardian agent disable tdd-strict # Disable an agentguardian hooks install
Install Git hooks for pre-commit and pre-push validation.
guardian hooks install # Creates .git/hooks/pre-commit & pre-pushpre-commit: Audits staged files, blocks commit on errors
pre-push: Audits all changes since last push
guardian mcp serve
Start the MCP Server for IDE integration (stdio transport).
guardian mcp serve # Listens on stdio for MCP protocol๐ค 12 Specialized Agents
Core Agents (Architecture Governance)
Agent | Detects | Severity |
Clean-Guard | Layer boundary violations (domainโinfra imports) | Error |
TDD-Strict | Missing test files, broken Red-Green-Refactor sequence | Error |
DDD-Guard | Mutable public state, direct aggregate internal access, cross-context imports | Error |
Security-Guard | Hardcoded secrets (AWS, GitHub, JWT, DB URLs, PEM keys), env access outside infra | Error |
SOLID-Copilot | God Objects (>200 lines, >10 methods), fat interfaces (>5 methods) | Warning |
Concurrency-Guard | Unhandled promises, event listeners without cleanup, mutable exports, timers without cleanup | Warning |
Semantic-Naming-Guard | Banned words (Manager, Util), empty variables, false booleans, verb inconsistency | Warning |
Language Specialists (Idiomatic Rules)
Agent | Language | Detects |
Go-Idiomatic-Guard | Go | Goroutine leaks, missing context propagation, error wrapping, interface placement |
Py-Async-Guard | Python | Blocking I/O in async, circular imports, missing type hints |
TS-Contract-Guard | TypeScript |
|
Dart-Arch-Guard | Dart/Flutter | Flutter imports in domain, undisposed streams, UI logic leaks |
DotNet-Clean-Guard | C#/.NET | EF in domain, missing CancellationToken, DbContext leaks |
๐ Governance Policy
The .guardian.json file defines your architecture contract. Guardian auto-generates one on first run, or create it manually:
{
"version": "1.0.0",
"executionMode": "local",
"layers": [
{ "name": "domain", "paths": ["src/domain/**"], "allowedDependencies": [] },
{ "name": "application", "paths": ["src/services/**"], "allowedDependencies": ["domain"] },
{ "name": "infrastructure", "paths": ["src/infra/**"], "allowedDependencies": ["domain", "application"] },
{ "name": "presentation", "paths": ["src/api/**"], "allowedDependencies": ["application"] }
],
"testConventions": [
{ "pattern": "**/*.test.ts" },
{ "pattern": "**/*_test.go" }
],
"excludePaths": ["node_modules", "dist", "vendor", ".git"],
"ddd": {
"aggregates": {
"Order": {
"root": "src/domain/order/Order.ts",
"internals": ["src/domain/order/OrderItem.ts", "src/domain/order/OrderStatus.ts"]
}
},
"boundedContexts": {
"orders": ["src/domain/order/**", "src/services/order/**"],
"users": ["src/domain/user/**", "src/services/user/**"]
}
},
"semantic_naming": {
"enabled": true,
"engine": "local",
"banned_words": ["Manager", "Util", "Helper", "Service", "Base", "Common"]
},
"bedrock": {
"enabled": false,
"model_id": "anthropic.claude-3-5-sonnet-20241022-v2:0",
"fallback_model_id": "anthropic.claude-3-haiku-20240307-v1:0"
}
}Layer Rules
The layers array defines your architecture. Each layer declares:
nameโ Layer identifierpathsโ Glob patterns matching files in this layerallowedDependenciesโ Which other layers this layer may import from
Example violation: A file in src/domain/ imports from src/infra/ โ Architectural Drift detected.
๐ Custom Rules DSL
Define project-specific rules in the rules section of your Governance Policy:
{
"rules": [
{
"id": "no-axios-in-domain",
"layer": "domain",
"severity": "error",
"message": "Domain layer cannot depend on HTTP libraries",
"forbidden_imports": ["axios", "node-fetch", "got"]
},
{
"id": "max-method-length",
"severity": "warning",
"message": "Methods should be concise",
"max_lines": 30
},
{
"id": "domain-must-export-interface",
"layer": "domain",
"severity": "warning",
"message": "Domain files should export at least one interface",
"required_patterns": ["export\\s+interface"]
}
]
}Three rule types:
forbidden_importsโ Block specific imports in a layermax_linesโ Enforce method/function length limitsrequired_patternsโ Require regex patterns in files
๐ง Auto-Remediation
Guardian doesn't just detect โ it fixes. Each remediation includes a contextual explanation of why the pattern is Architectural Drift.
$ guardian fix .
Guardian Fix โ 3 fixes available:
[FIX] src/domain/UserService.ts:3
Action: Generate interface in domain layer and move implementation to infrastructure
+ export interface IUserRepository { ... }
- import { PgUserRepo } from "../infrastructure/..."
[FIX] src/domain/Order.ts:5
Action: Add 'readonly' modifier to public property
- public status: string
+ public readonly status: string
[FIX] src/application/Handler.ts
Action: Generate test skeleton: Handler.test.ts
Use --apply to apply fixes automatically.๐ Live Dashboard
guardian dashboardOpens a React SPA at http://localhost:4000 with:
Health Score Gauge โ Animated 0-100 indicator of overall architecture health
Radar Chart โ Compliance percentage per agent (7 axes)
Heatmap โ Module-level visualization of Architectural Drift density
Real-time updates โ Connects via SSE when
guardian watchis active
Click any module in the Heatmap to see detailed violations grouped by agent and severity.
๐๏ธ Live Mode (guardian watch)
The killer feature for demos and daily development:
guardian watch src/File saved โ FileWatcher detects change (chokidar)
Debounce (300ms) โ Groups rapid saves into one analysis
Smart Routing โ Only relevant agents run (domain file? โ Clean-Guard + DDD-Guard)
AST Cache โ Unchanged files skip parsing (LRU, 500 entries)
EventBus โ Results broadcast to CLI, Dashboard, and LSP simultaneously
Output in terminal:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ARCHITECTURAL DRIFT DETECTED โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Agent : [DDD-Guard]
File : src/domain/order/Order.ts:5
Rule : DDD_MUTABLE_PUBLIC_STATE
Reasoning:
Class 'Order' exposes mutable public property 'status'.
This breaks aggregate encapsulation in DDD.
Auto-Remediation:
โฏ Run `guardian fix --target Order.ts`โก GitHub Actions / CI/CD
Using the composite action
name: Guardian Governance Audit
on: [pull_request]
jobs:
audit:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: guardian-mcp/action@v1
with:
path: '.'
fail-on: 'error'
generate-pr-comment: 'true'Action features:
Posts a PR comment with violation table (File, Line, Agent, Severity, Description)
Updates existing comment on re-runs (no spam)
Configurable severity threshold
Works without external MCP server (headless CLI)
Standalone (no action dependency)
- uses: actions/setup-node@v4
with: { node-version: '20' }
- run: npm install -g guardian-mcp-toolkit
- run: guardian audit . --fail-on errorโ๏ธ AWS Cloud Mode
For large codebases, delegate analysis to AWS Lambda:
{ "executionMode": "cloud" }7 Lambda functions (one per core agent)
API Gateway REST endpoint per agent
CDK Stack for one-command deployment:
cd infra && cdk deployFallback: If Lambda fails, analysis runs locally
cd infra
cdk deploy # Deploys all Lambdas + API Gateway๐ Supported Languages
Language | Import Detection | Layer Analysis | Idiomatic Rules | Smart Routing |
TypeScript/JS | โ AST | โ | โ TS-Contract-Guard | โ |
Go | โ Regex | โ | โ Go-Idiomatic-Guard | โ |
Python | โ Regex | โ | โ Py-Async-Guard | โ |
Dart/Flutter | โ Regex | โ | โ Dart-Arch-Guard | โ |
C#/.NET | โ Regex | โ | โ DotNet-Clean-Guard | โ |
Java | โ Regex | โ | โ | โ |
Kotlin | โ Regex | โ | โ | โ |
Rust | โ Regex | โ | โ | โ |
๐๏ธ Architecture
guardian-mcp-toolkit/
โโโ packages/
โ โโโ shared/ # Types, interfaces, EventBus, multi-lang parser
โ โโโ server/ # MCP Server, Smart Router, AST Cache, Custom Rules Engine
โ โโโ clean-guard/ # Clean Architecture agent (3 tools)
โ โโโ tdd-strict/ # TDD agent (3 tools)
โ โโโ ddd-guard/ # DDD agent (3 tools)
โ โโโ security-guard/ # Security agent (2 tools)
โ โโโ solid-copilot/ # SOLID agent + Bedrock integration (2 tools)
โ โโโ concurrency-guard/ # Concurrency agent (1 tool)
โ โโโ semantic-naming-guard/ # Naming agent + Level1/Level2 engines (1 tool)
โ โโโ lang-specialists/ # 5 language-specific agents (5 tools)
โ โโโ cli/ # Terminal UX (9 commands, FileWatcher, fixEngine)
โ โโโ lsp/ # LSP Server (diagnostics + Code Actions)
โ โโโ dashboard/ # Express server + React SPA (Chart.js)
โ โโโ lambda/ # AWS Lambda handlers (7 functions)
โโโ infra/ # CDK Stack (Lambda + API Gateway)
โโโ action/ # GitHub Action (composite)
โโโ scripts/ # Deploy, bundle, and demo scripts
โโโ docs/ # Pitch deck, metrics, demo script
โโโ .guardian.json # Self-governance (Guardian audits itself)๐งช Testing
pnpm test # Run all tests (215+ across 39 files)
pnpm build # Build all packages
pnpm test -- --run # Run without watch modeProperty-Based Testing with fast-check (20+ correctness properties, 100 iterations each)
Unit tests for all agents and tools
Integration tests for CLI, Dashboard, and Lambda handlers
๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/new-agent)Write tests first (TDD โ Guardian enforces this!)
Run
guardian audit .โ ensure zero errorsSubmit a Pull Request
๐ License
MIT โ Edwin Esteban Fonseca
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Esteban-Fonseca-DEV/mcp_toolkit_guardian'
If you have feedback or need assistance with the MCP directory API, please join our Discord server