Month 4 Capstone1 Code Files
Month 4 Capstone: Production Agentic MCP Server & Infrastructure Copilot
Month 4 Capstone: Production Agentic MCP Server & Infrastructure Copilot
1. Executive Summary
This Month 4 Capstone (capstones/month04_agentic_mcp_server) integrates every first-principles concept from Weeks 13, 14, 15, and 16 into a single cohesive, production-grade Autonomous Agentic MCP Infrastructure Copilot:
Architecture Flow Diagram
Incoming Incident Alert / Prompt->InputRail[1. Policy-as-Code Input Rail (Week 16)
Router[2. Semantic MCP Tool Router Top-K (Week 14)
MCPHost[3. Multi-Server JSON-RPC 2.0 MCP Host + Chaos Fallback (Week 14 & 16)
AST[4. AST-Sandboxed Metric Analyzer (Week 16)
Sup[5. Supervisor + Domain Workers + Generator-Critic Loop (Week 15)
ToolRail[6. Policy-as-Code Tool Rail + SQLite HITL Checkpointer (Week 13 & 16)
OTel[7. OpenTelemetry Span Tracer & SHA-256 Audit Chain (Week 16)
2. End-to-End Capabilities Verified by test_capstone_month04.py
- Root
.envConfiguration Loading: Automatically loads universalLLM_API_KEY,LLM_BASE_URL,LLM_MODELfromD:\Spark\AI_Engineer\.env. - Input Guardrail Enforcement: Blocks prompt injection before any agent hop or MCP tool call executes.
- Semantic Tool Discovery (
Top-K) & Multi-Server MCP Dispatch: Selects the relevant tools acrossobservabilityandk8sMCP servers over JSON-RPC 2.0. - AST-Sandboxed Analytical Calculation: Computes anomaly z-scores inside a zero-import/zero-dunder AST sandbox.
- Supervisor + Generator-Critic Remediation Synthesis: Routes to the winning domain specialist and refines any unsafe command until rollback and canary limits are present.
- Durable SQLite Checkpointing & Human-in-the-Loop (HITL) Approval: Pauses when scaling production replicas above policy thresholds (
REQUIRE_APPROVAL), saves state to SQLite, and resumes cleanly once the Incident Commander approves. - Tamper-Evident OpenTelemetry Audit Trail & Budget Governance: Tracks every span with SHA-256 hash chaining and enforces token/USD caps.