Architect MCP
Enforce architectural patterns and coding standards by providing design guidance and validating code against project-specific rules.
Overview
Architect MCP is an open-source Model Context Protocol server from the AI Code Toolkit that helps AI coding agents maintain architectural consistency and follow coding standards. It provides design pattern guidance before coding and validates code changes against project-specific rules after implementation.
While custom instructions struggle to enforce patterns as projects scale, Architect MCP provides programmatic validation and guidance through architect.yaml (design patterns) and RULES.yaml (coding standards), ensuring every code change aligns with your established architecture.
Key Benefits
Proactive Pattern Guidance
Get design pattern guidance BEFORE editing files. Understand applicable patterns, coding rules, and best practices specific to each file type.
Automated Code Review
Validate code changes against project rules after editing. Catch violations, missing patterns, and anti-patterns before they reach production.
Template-Specific Rules
Support for project templates (Next.js, TypeScript libraries, etc.) with specific design patterns and coding standards for each template type.
Optional LLM Analysis
Enable LLM-powered analysis for deeper code insights and qualitative validation beyond pattern matching and rule enforcement.
Available MCP Tools
get-file-design-pattern
Retrieve architectural patterns and coding rules for a specific file BEFORE editing. Returns applicable design patterns, must-do/should-do/must-not-do rules, and code examples.
- • Get design patterns from architect.yaml
- • View coding rules from RULES.yaml
- • See project template information
- • Access code examples and best practices
review-code-change
Validate code changes against project rules AFTER editing. Returns violations, missing patterns, and suggestions with severity ratings (CRITICAL, HIGH, MEDIUM, LOW).
- • Check for must-not-do violations
- • Verify must-do requirements
- • Get should-do suggestions
- • Receive severity-rated feedback
How Architect MCP Works
Pre-Coding: Pattern Discovery
Before editing a file, AI agents use get-file-design-pattern to understand the project template, applicable design patterns from architect.yaml, and coding rules from RULES.yaml.
During Coding: Guided Implementation
The AI agent follows the discovered patterns and rules while implementing changes. Code examples and best practices guide the implementation to ensure consistency.
Post-Coding: Validation
After editing, the agent uses review-code-change to validate the changes against project rules. Any violations, missing patterns, or anti-patterns are flagged with severity ratings.
Iterative Refinement
If violations are found, the agent fixes them and re-validates until all CRITICAL and HIGH severity issues are resolved, ensuring code quality before proceeding.
Common Use Cases
Pre-Edit Pattern Discovery
"Before I edit UserService.ts, what design patterns and coding rules should I follow?"
Post-Edit Code Review
"I just updated the authentication logic. Check if it follows our security patterns and coding standards."
Anti-Pattern Detection
"Review this component for anti-patterns like prop drilling, inline styles, or missing error boundaries."
Template Consistency
"Ensure this Next.js page follows our app router conventions and server component patterns."
Installation & Configuration
Installation
Architect MCP can be run directly using npx without installation, or you can install it globally:
MCP Configuration
Add the following configuration to your AI coding tool's MCP settings (e.g., Claude Code, Cursor, Windsurf):
{
"mcpServers": {
"architect-mcp": {
"command": "npx",
"args": [
"-y",
"@agiflowai/architect-mcp",
"mcp-serve",
"--admin-enable",
"--design-pattern-tool", "claude-code",
"--review-tool", "claude-code"
]
}
}
}Quick Start with AI Code Toolkit
Use the unified AI Code Toolkit CLI to automatically configure Architect MCP:
Architecture Configuration Files
architect.yaml - Design Patterns
Defines design patterns for specific file types in your project. Each pattern includes:
- pattern_name - Unique identifier for the pattern
- includes - Glob patterns matching files this pattern applies to
- design_pattern - Description of the architectural pattern
- description - Detailed guidance with examples
RULES.yaml - Coding Standards
Defines coding rules and standards for validation. Each rule category includes:
- must_not_do - Anti-patterns and violations (CRITICAL severity)
- must_do - Required patterns and practices (HIGH severity if missing)
- should_do - Best practices and recommendations (MEDIUM severity)
Integration with Scaffold MCP
Architect MCP works complementarily with Scaffold MCP to provide a complete development workflow:
Use Scaffold MCP to generate boilerplate code
Use Architect MCP for pattern guidance
Use Architect MCP to review against rules
Both tools reference the same template definitions (architect.yaml and RULES.yaml), ensuring consistency between generated and reviewed code.
Best Practices
🔍 Always Check Before Editing
Use get-file-design-pattern BEFORE editing any file to understand applicable patterns and rules. This prevents violations and ensures consistent implementation.
✅ Validate After Every Change
Use review-code-change AFTER editing to catch violations early. Fix CRITICAL and HIGH severity issues before proceeding to ensure code quality.
📋 Maintain Configuration Files
Keep architect.yaml and RULES.yaml up to date as your architecture evolves. Document new patterns and rules to maintain consistency across the team.
🔄 Combine with Scaffolding
Use Scaffold MCP to generate code, then Architect MCP to validate it. This workflow ensures generated code follows your patterns from the start.