Introduction
This section documents the architectural decisions made throughout the development of MCP Server with LangGraph. Each Architecture Decision Record (ADR) captures the context, decision, consequences, and alternatives considered for significant technical choices.What is an ADR? Architecture Decision Records document important architectural decisions along with their context and consequences, providing historical insight for current and future maintainers.
Architecture Decision Records
We maintain 63 ADRs organized into seven categories:New in v2.8: 10 new ADRs (ADRs 31-39) document our enterprise authentication architecture with Keycloak, service principals, API keys, identity federation, and SCIM provisioning. See Keycloak JWT Architecture Overview for details.
Core Architecture (ADRs 1-5)
These foundational decisions shape the entire system:ADR-0001: Multi-Provider LLM
LiteLLM for unified access to 100+ LLM providers
ADR-0002: OpenFGA Authorization
Fine-grained relationship-based access control
ADR-0003: Dual Observability
OpenTelemetry + LangSmith for complete visibility
ADR-0004: MCP StreamableHTTP
Production-ready HTTP transport protocol
ADR-0005: Pydantic AI Integration
Type-safe agent responses and routing
Authentication & Sessions (ADRs 6-7)
Security and session management patterns:ADR-0006: Session Storage
Pluggable session backends (InMemory, Redis)
ADR-0007: Auth Providers
Flexible authentication (InMemory, Keycloak)
Infrastructure & Deployment (ADRs 8-9, 13, 20-21, 27-28, 30)
Infrastructure, deployment, and operational decisions:ADR-0008: Infisical Secrets
Centralized secrets management
ADR-0009: Feature Flags
Gradual rollout and experimentation
ADR-0013: Multi-Deployment
Support for Docker, K8s, Cloud Run, LangGraph Platform
ADR-0020: Dual Transport
STDIO + StreamableHTTP for flexibility
ADR-0021: CI/CD Pipeline
Automated testing and deployment
ADR-0027: Rate Limiting
API protection and traffic control
ADR-0028: Caching Strategy
Multi-layer performance optimization
ADR-0030: Resilience Patterns
Circuit breakers and retry policies
Development & Quality (ADRs 10, 14-19, 22-26, 29)
Code quality, testing, and development practices:ADR-0010: Functional API
LangGraph functional over object-oriented
ADR-0014: Type Safety
Strict typing with Pydantic
ADR-0015: Checkpointing
Stateful conversation persistence
ADR-0016: Property Testing
Hypothesis for edge case discovery
ADR-0017: Error Handling
Consistent error patterns
ADR-0018: Versioning
Semantic versioning strategy
ADR-0019: Async-First
Async by default for scalability
ADR-0022: Distributed Checkpointing
Redis-backed conversation state
ADR-0023: Anthropic Tool Design
Best practices for tool implementations
ADR-0024: Agentic Loop
Gather-Action-Verify-Repeat cycle
ADR-0025: Anthropic Enhancements
Advanced best practices implementation
ADR-0026: Lazy Observability
On-demand telemetry initialization
ADR-0029: Custom Exceptions
Domain-specific error handling
Compliance & Templates (ADRs 11-12)
Compliance frameworks and project templating:ADR-0011: Cookiecutter Template
Reusable project template
ADR-0012: Compliance Framework
Built-in GDPR, SOC 2, HIPAA support
ADR Index
Quick reference table of all architectural decisions:| # | Title | Category | Status | Date |
|---|---|---|---|---|
| 0001 | Multi-Provider LLM Support via LiteLLM | Core | Accepted | 2025-10-11 |
| 0002 | Fine-Grained Authorization with OpenFGA | Core | Accepted | 2025-10-11 |
| 0003 | Dual Observability: OpenTelemetry + LangSmith | Core | Accepted | 2025-10-11 |
| 0004 | MCP StreamableHTTP Transport Protocol | Core | Accepted | 2025-10-11 |
| 0005 | Type-Safe Agent Responses with Pydantic AI | Core | Accepted | 2025-10-11 |
| 0006 | Pluggable Session Storage Architecture | Auth | Accepted | 2025-10-13 |
| 0007 | Pluggable Authentication Provider Pattern | Auth | Accepted | 2025-10-13 |
| 0008 | Infisical for Secrets Management | Infrastructure | Accepted | 2025-10-13 |
| 0009 | Feature Flag System for Gradual Rollouts | Infrastructure | Accepted | 2025-10-13 |
| 0010 | LangGraph Functional API over Object-Oriented | Development | Accepted | 2025-10-13 |
| 0011 | Cookiecutter Template for Project Generation | Compliance | Accepted | 2025-10-13 |
| 0012 | Built-In Compliance Framework (GDPR, SOC 2, HIPAA) | Compliance | Accepted | 2025-10-13 |
| 0013 | Multi-Deployment Target Strategy | Infrastructure | Accepted | 2025-10-13 |
| 0014 | Pydantic Type Safety Strategy | Development | Accepted | 2025-10-13 |
| 0015 | Memory Checkpointing for Stateful Agents | Development | Accepted | 2025-10-13 |
| 0016 | Property-Based Testing with Hypothesis | Development | Accepted | 2025-10-13 |
| 0017 | Error Handling Strategy | Development | Accepted | 2025-10-13 |
| 0018 | Semantic Versioning Strategy | Development | Accepted | 2025-10-13 |
| 0019 | Async-First Architecture | Development | Accepted | 2025-10-13 |
| 0020 | Dual MCP Transport Protocol (STDIO + StreamableHTTP) | Infrastructure | Accepted | 2025-10-13 |
| 0021 | CI/CD Pipeline Strategy | Infrastructure | Accepted | 2025-10-13 |
| 0022 | Distributed Conversation Checkpointing with Redis | Development | Accepted | 2025-10-15 |
| 0023 | Anthropic Tool Design Best Practices | Development | Accepted | 2025-10-17 |
| 0024 | Agentic Loop Implementation (Gather-Action-Verify-Repeat) | Development | Accepted | 2025-10-17 |
| 0025 | Anthropic Best Practices - Advanced Enhancements | Development | Accepted | 2025-10-17 |
| 0026 | Lazy Observability Initialization | Development | Accepted | 2025-10-17 |
| 0027 | Rate Limiting Strategy for API Protection | Infrastructure | Accepted | 2025-10-20 |
| 0028 | Multi-Layer Caching Strategy | Infrastructure | Accepted | 2025-10-20 |
| 0029 | Custom Exception Hierarchy | Development | Accepted | 2025-10-20 |
| 0030 | Resilience Patterns for Production Systems | Infrastructure | Accepted | 2025-10-20 |
| 0031 | Keycloak as Authoritative Identity Provider | Auth | Accepted | 2025-10-23 |
| 0032 | JWT Standardization for Multi-Component Auth | Auth | Accepted | 2025-10-23 |
| 0033 | Service Principal Design for Machine-to-Machine Auth | Auth | Accepted | 2025-10-23 |
| 0034 | API Key to JWT Exchange Pattern | Auth | Accepted | 2025-10-23 |
| 0035 | Kong Gateway for JWT Validation | Auth | Accepted | 2025-10-23 |
| 0036 | Hybrid Session Model (Stateless JWT + Stateful Redis) | Auth | Accepted | 2025-10-23 |
| 0037 | Identity Federation with External IDPs | Auth | Accepted | 2025-10-23 |
| 0038 | SCIM 2.0 Implementation for User Provisioning | Auth | Accepted | 2025-10-23 |
| 0039 | OpenFGA Permission Inheritance Model | Auth | Accepted | 2025-10-23 |
| 0040 | GCP GKE Autopilot Deployment Strategy | Infrastructure | Accepted | 2025-10-25 |
| 0041 | PostgreSQL for GDPR-Compliant Storage | Infrastructure | Accepted | 2025-10-30 |
| 0042 | Dependency Injection Configuration Fixes | Infrastructure | Accepted | 2025-01-28 |
| 0043 | Cost Monitoring Dashboard for LLM Usage | Infrastructure | Accepted | 2025-11-02 |
| 0044 | Test Infrastructure Quick Wins (Phase 1) | Development | Accepted | 2025-11-06 |
| 0045 | Test Infrastructure Phase 2 - Real Infrastructure Foundation | Development | Accepted | 2025-11-06 |
| 0046 | Deployment Configuration TDD Infrastructure | Infrastructure | Accepted | 2025-11-06 |
| 0047 | Visual Workflow Builder (Future) | Development | Proposed | 2025-11-02 |
| 0048 | PostgreSQL Storage Integration Tests | Development | Accepted | 2025-11-06 |
| 0052 | Pytest-xdist Isolation Strategy with Worker-Scoped Resources | Development | Accepted | 2025-01-11 |
| 0049 | Pytest Fixture Consolidation and Organization | Development | Accepted | 2025-11-08 |
| 0050 | Dependency Singleton Pattern Justification | Core | Accepted | 2025-11-08 |
| 0051 | Memorystore Redis ExternalName Service with Cloud DNS | Infrastructure | Accepted | 2025-11-10 |
| 0053 | CI/CD Failure Prevention Framework | Infrastructure | Accepted | 2025-11-12 |
| 0054 | Pod Failure Prevention Framework | Infrastructure | Accepted | 2025-11-12 |
| 0055 | Diagram Visualization Standards | Development | Accepted | 2025-11-15 |
| 0056 | AsyncMock Configuration Prevention Mechanisms | Development | Accepted | 2025-11-15 |
| 0060 | Database Architecture and Naming Convention | Infrastructure | Accepted | 2025-11-18 |
| 0061 | FastAPI as Web Framework | Core | Accepted | 2025-11-18 |
| 0062 | uv for Package Management | Development | Accepted | 2025-11-18 |
| 0063 | Mintlify as Documentation Platform | Development | Accepted | 2025-11-20 |
| 0064 | Pre-commit Hooks Strategy | Development | Accepted | 2025-11-22 |
| 0065 | Ruff for Code Quality | Development | Accepted | 2025-11-25 |
| 0066 | Helm Chart Security Risk Acceptance | Security | Accepted | 2025-11-28 |
Design Principles
Based on our ADRs, these principles guide our architecture:Flexibility Over Lock-In
Flexibility Over Lock-In
Use pluggable abstractions (LiteLLM, session storage, auth providers) to avoid vendor lock-in and enable easy switching between providers.
Production-Ready Defaults
Production-Ready Defaults
Every feature is designed for production use: proper error handling, observability, security, and scalability built-in.
Type Safety First
Type Safety First
Leverage Python’s type system with Pydantic for runtime validation and static analysis with mypy strict mode.
Async by Default
Async by Default
All I/O operations are async for better scalability and resource utilization in production deployments.
Observable Systems
Observable Systems
Dual observability (OpenTelemetry + LangSmith) ensures complete visibility into both infrastructure and LLM behavior.
Security & Compliance
Security & Compliance
Enterprise-grade security (JWT, OpenFGA, Infisical) and built-in compliance frameworks (GDPR, SOC 2, HIPAA).
Developer Experience
Developer Experience
Well-documented decisions, comprehensive testing, clear error messages, and developer-friendly tooling.
Progressive Enhancement
Progressive Enhancement
Feature flags enable gradual rollouts and A/B testing without deployments.
System Architecture
When to Create an ADR
Create a new ADR when making decisions about:- Technology Choices: Selecting frameworks, libraries, or services
- Architectural Patterns: Adopting new patterns or changing existing ones
- Cross-Cutting Concerns: Security, observability, error handling
- Integration Strategies: How components interact with each other
- Deployment Approaches: Infrastructure and deployment methodologies
- Quality Practices: Testing strategies, code quality standards
ADR Template
When creating a new ADR, use this structure:Related Documentation
Development Guide
Set up your development environment
Testing Guide
Comprehensive testing strategy
Deployment Guide
Deploy to various platforms
Security Guide
Security best practices
Questions about our architecture? Open a discussion on GitHub or review individual ADRs for detailed rationale.