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

  1. Root .env Configuration Loading: Automatically loads universal LLM_API_KEY, LLM_BASE_URL, LLM_MODEL from D:\Spark\AI_Engineer\.env.
  2. Input Guardrail Enforcement: Blocks prompt injection before any agent hop or MCP tool call executes.
  3. Semantic Tool Discovery (Top-K) & Multi-Server MCP Dispatch: Selects the relevant tools across observability and k8s MCP servers over JSON-RPC 2.0.
  4. AST-Sandboxed Analytical Calculation: Computes anomaly z-scores inside a zero-import/zero-dunder AST sandbox.
  5. Supervisor + Generator-Critic Remediation Synthesis: Routes to the winning domain specialist and refines any unsafe command until rollback and canary limits are present.
  6. 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.
  7. Tamper-Evident OpenTelemetry Audit Trail & Budget Governance: Tracks every span with SHA-256 hash chaining and enforces token/USD caps.
Month 4 Capstone: Production Agentic MCP Server & Infrastructure Copilot | Month 4 AI Engineering Capstone · DataArena