Architecture Guidelines MCP Server - Inject architectural best practices into AI workflows
Project description
ArchGuide MCP Server
A Python-based Model Context Protocol (MCP) server that provides architecture guidelines, design patterns, and best practices directly into AI development workflows. Built with modern Python tooling including FastMCP, Pydantic, and uv.
Features
- Architecture Guidelines: Comprehensive guidelines for various architectural patterns
- Smart Search: Full-text search across all guidelines and patterns using Whoosh
- Context-Aware: Filter guidelines based on tech stack, scale, and domain
- Version Control: Support for multiple versions of guidelines
- Compliance Checking: Validate designs against architectural standards
- Fast & Efficient: In-memory caching and optimized search
- Modern Python: Built with FastMCP, Pydantic, and uv package manager
Installation
Prerequisites
- Python 3.12+
- uv package manager (installation guide)
Install from Source
git clone https://github.com/yourusername/archguide-mcp-python.git
cd archguide-mcp-python
uv sync
Development Setup
# Install with development dependencies
uv sync --dev
# Run tests
uv run python -m pytest
# Run the server
uv run archguide-mcp
Usage with Claude Code
- Add to your Claude Code configuration:
{
"mcpServers": {
"archguide": {
"command": "uv",
"args": ["run", "archguide-mcp"],
"cwd": "/path/to/archguide-mcp-python",
"env": {
"GUIDELINES_PATH": "/path/to/your/guidelines"
}
}
}
}
- Use in your prompts:
Design a microservices architecture for an e-commerce platform. use archguide
Show me the event sourcing pattern with examples. use archguide
Check if this API design follows our REST guidelines. use archguide
What are the best practices for authentication in Python FastAPI apps? use archguide
Available MCP Tools
get-architecture-guideline
Fetch architecture guidelines for a specific topic with optional context filtering.
Parameters:
topic(required): Architecture topic (e.g., "microservices", "api-design", "security")context(optional): Additional filtering contexttech_stack: Technology stack (e.g., ["python", "fastapi"])scale: System scale ("startup", "growth", "enterprise")domain: Business domain (e.g., "e-commerce", "fintech")
version(optional): Specific version of guidelinesinclude_examples(optional): Include code examples (default: true)
search-patterns
Search for architecture patterns, best practices, and solutions.
Parameters:
query(required): Search queryfilters(optional): Search filterscategory: Filter by categorytags: Filter by tagstech_stack: Filter by technology stack
limit(optional): Maximum results (default: 10)
list-categories
List all available architecture guideline categories.
check-compliance
Check if a design or code snippet complies with architecture guidelines.
Parameters:
design(required): Design description or code snippetguidelines(optional): Specific guideline IDs to check against
get-server-stats
Get statistics about the ArchGuide server including guideline counts and categories.
Dynamic Guideline Management Tools ✨
add-guideline
Add a new architecture guideline dynamically during your Claude Code session.
Parameters:
title(required): Title of the guidelinecategory(required): Category (e.g., "microservices", "security", "cloud-native")content(required): Main content in markdown formatsubcategory(optional): Subcategory for organizationtags(optional): List of tags for categorizationpatterns(optional): List of patterns with keys: name, description, when, implementation, consequencesanti_patterns(optional): List of anti-patterns with keys: name, description, why, insteadexamples(optional): List of code examples with keys: title, description, language, codetech_stack(optional): Applicable technology stackapplicability(optional): Contexts where this applies (e.g., ['startup', 'enterprise'])author(optional): Author name (default: "Claude Code User")
Example Usage:
Add a new guideline about API rate limiting patterns for microservices with examples in Python and Go
update-guideline
Update an existing architecture guideline.
Parameters:
guideline_id(required): ID of the guideline to updatetitle(optional): New titlecontent(optional): New contenttags(optional): New tagspatterns(optional): New patterns listanti_patterns(optional): New anti-patterns listexamples(optional): New examples list
delete-guideline
Delete an architecture guideline.
Parameters:
guideline_id(required): ID of the guideline to delete
reload-guidelines
Reload all guidelines from the filesystem to pick up any manual changes made to .md files.
Dynamic Guideline Creation Examples
With the new dynamic management tools, you can create guidelines on-the-fly during your development workflow:
Example 1: Create a Performance Guideline
Add a new guideline titled "Database Query Optimization" in the "performance" category with content about N+1 queries, including patterns for eager loading and anti-patterns for sequential queries
Example 2: Update Existing Guideline
Update the guideline "microservices-data-management" to add a new pattern about distributed transactions using the Saga pattern
Example 3: Create Team-Specific Guidelines
Add a guideline about our team's specific React component patterns with examples showing our custom hooks and state management conventions
Writing Guidelines
Guidelines are written in Markdown with YAML frontmatter:
---
id: unique-guideline-id
title: Guideline Title
category: main-category
subcategory: sub-category
tags: [tag1, tag2, tag3]
version: 1.0.0
author: Your Name
created: 2024-01-01
lastUpdated: 2024-01-02
applicability: [startup, enterprise, cloud-native]
techStack: [python, fastapi, postgresql]
prerequisites: [http-basics, api-design]
relatedGuidelines: [other-guideline-id]
---
# Guideline Content
Your guideline content here...
## Pattern: Pattern Name
### Description
Pattern description.
### When to use
When to use this pattern.
### Implementation
How to implement.
### Consequences
- Positive consequence
- Negative consequence
## Anti-pattern: Anti-pattern Name
### Description
Anti-pattern description.
### Why it's bad
Why this is problematic.
### Instead
What to do instead.
### Example: Code Example
Description of the example.
```python
def example_function():
return "Hello, World!"
## Project Structure
archguide-mcp-python/ ├── src/ │ └── archguide_mcp_python/ │ ├── init.py # Package initialization │ ├── server.py # FastMCP server implementation │ ├── models/ │ │ └── types.py # Pydantic data models │ ├── storage/ │ │ ├── store.py # Main guideline store │ │ ├── filesystem.py # File-based storage │ │ └── search.py # Whoosh search index │ ├── parsers/ │ │ └── content.py # Markdown content parser │ └── utils/ │ ├── cache.py # Caching utilities │ └── formatters.py # Output formatting ├── guidelines/ # Architecture guidelines content │ ├── microservices/ │ ├── cloud-native/ │ ├── security/ │ └── data-patterns/ ├── tests/ # Test suite ├── pyproject.toml # Project configuration └── README.md
## Configuration
### Environment Variables
- `GUIDELINES_PATH`: Path to guidelines directory (default: `./guidelines`)
- `INDEX_DIR`: Path to search index directory (optional)
- `CACHE_TTL`: Cache time-to-live in seconds (default: 300)
### Guidelines Directory Structure
guidelines/ ├── microservices/ │ ├── data-management.md │ └── communication-patterns.md ├── cloud-native/ │ ├── api-design.md │ └── containerization.md ├── security/ │ ├── authentication.md │ └── authorization.md └── data-patterns/ ├── database-design.md └── caching-strategies.md
## Development
### Running Tests
```bash
# Run all tests
uv run python -m pytest
# Run specific test file
uv run python -m pytest tests/test_cache.py -v
# Run with coverage
uv run python -m pytest --cov=archguide_mcp_python
Code Quality
# Format code
uv run black src/ tests/
# Lint code
uv run ruff check src/ tests/
# Type checking
uv run mypy src/
Adding New Guidelines
- Create a new markdown file in the appropriate category directory
- Follow the guideline template with proper frontmatter
- Include patterns, anti-patterns, and examples as needed
- Restart the server to load new guidelines
Sample Guidelines Included
The project includes sample guidelines for:
- Microservices: Data management patterns, event sourcing, database per service
- Cloud-Native APIs: RESTful design, versioning, status codes
- Security: Authentication patterns, JWT, OAuth2, RBAC
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Write guidelines in the appropriate category
- Add tests for new functionality
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with FastMCP for MCP server functionality
- Uses Whoosh for full-text search
- Powered by Pydantic for data validation
- Package management by uv
ArchGuide MCP Server - Making architectural knowledge instantly accessible within AI development workflows.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file archguide_mcp_python-0.4.0-py3-none-any.whl.
File metadata
- Download URL: archguide_mcp_python-0.4.0-py3-none-any.whl
- Upload date:
- Size: 56.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6743e37eb2b4a09e80864b4fb2bf807261a9902cc757a7142fadf6636da13d36
|
|
| MD5 |
d21276ec56cdef95df08c4d3ec3bc3d7
|
|
| BLAKE2b-256 |
231b90f471707a149f3991f5555722185e9c41ed54caf4dc3459ed5d8c956ec0
|