feat(mcp-server): Align MCP Tools with Kestra Workflow#13
Conversation
…generation - Refactor MCP server to exactly 9 tools matching Kestra pipeline: ingest_repo, ingest_telemetry, propose_architecture, render_graph, generate_iac, validate_iac, create_pr, validate_pr, evaluate - Fix Terraform templates to use proper multi-line HCL format (no semicolons) - Fix create_pr to accept both JSON string and object for files param - Fix Oumi API call to use correct /v1/chat/completions endpoint - Add ingest_repo support for GitHub URLs (auto-clone) - Add mcp.json.example for Cline configuration - Add test-all-tools.mjs for testing all 9 workflow steps - Remove non-functional cline-architect.yml workflow - Update README with 9-step workflow documentation
WalkthroughThis PR replaces a monolithic GitHub Actions workflow (cline-architect.yml) with a modular, 9-step architecture analysis and IaC generation pipeline. The new approach refactors the MCP server tools into discrete, composable steps—from repository ingestion and telemetry collection through architecture proposal, graph rendering, Terraform generation, validation, and PR creation—along with supporting test automation and orchestration enhancements. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client/Orchestrator
participant MCP as MCP Server
participant GitHub as GitHub API
participant Oumi as Oumi Model
participant TF as Terraform
Client->>MCP: ingest_repo(local path or GitHub URL)
MCP->>GitHub: Clone repo (if URL)
MCP-->>Client: Service profiles + metadata
Client->>MCP: ingest_telemetry(services, metrics)
MCP-->>Client: Telemetry summary per service
Client->>MCP: propose_architecture(serviceProfile, telemetry, cloudProvider)
MCP->>Oumi: Query model endpoint
alt Model available
Oumi-->>MCP: Architecture proposal
else Fallback
MCP-->>MCP: Heuristic generation
end
MCP-->>Client: Architecture plan + metadata
Client->>MCP: render_graph(architecturePlan)
MCP-->>Client: React Flow nodes, edges, styling
Client->>MCP: generate_iac(graph, cloudProvider, projectName)
MCP-->>Client: main.tf, variables.tf, metadata
Client->>MCP: validate_iac(iacDir)
MCP->>TF: fmt, init, validate, tflint
TF-->>MCP: Validation results
MCP-->>Client: Per-check results + overall validity
Client->>MCP: create_pr(repository, files, targetFolder, baseBranch, labels)
MCP->>GitHub: Create branch & commit files
MCP->>GitHub: Create PR with labels
GitHub-->>MCP: PR created
MCP-->>Client: PR metadata
Client->>MCP: validate_pr(repository, prNumber)
MCP->>GitHub: Fetch PR status, CI checks, reviews
GitHub-->>MCP: PR status + checks
MCP-->>Client: Merge readiness assessment
Client->>MCP: evaluate(deployResult)
MCP-->>Client: Score, recommendations, feedback
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Areas requiring extra attention:
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
🐰 CodeRabbit Review ReminderThis PR will be automatically reviewed by CodeRabbit. Please ensure:
Maintainer approval is required after addressing CodeRabbit feedback. |
|
Tip For best results, initiate chat on the files or code changes. @github-actions Thanks for the reminder! 👋 Hey there! I'm CodeRabbit, ready to help out with this PR whenever you need me. I see this is a pretty substantial feature addition that aligns your MCP server with the Kestra workflow pipeline - 9 tools covering the full orchestration flow from repo ingestion to deployment evaluation. That's a solid architecture! I'm here and available to:
Just tag me with Looking forward to helping you get this merged! 🚀 |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
infoundry-mcp-server/src/index.ts (1)
419-574: Critical: Step 5 generates Terraform that likely can’t passterraform validate.
Examples:aws_lambda_functionis missing required args (likefilename/s3_*/image_uri) and referencesaws_iam_role.lambdathat doesn’t exist; ALB + RDS typically need more required wiring (SGs/subnets/subnet group), etc. This makes Step 6 “validate_iac” kind of doomed.Actionable direction: either (A) generate a minimal but valid AWS baseline (default VPC + SG + subnet sources + IAM roles) or (B) change
validate_iacto “lint only / best-effort” and document it as such. Right now the tool contract says “Validate Terraform”, so I’d strongly lean (A).infoundry-mcp-server/README.md (1)
26-39: Doc nit: config example doesn’t mention passingGITHUB_TOKENinto the MCP server.
Givencreate_prneeds it, add a short note pointing tomcp.json.example(or showenvin the snippet).Also applies to: 54-60
🧹 Nitpick comments (5)
infoundry-mcp-server/src/index.ts (4)
30-52:validatePath()is a solid start, but it’s too strict for “outputDir” use-cases.
Right now it requires the path to already exist + be a directory, so you can’t reuse it for “create this output dir” scenarios (like Step 5). Consider splitting intovalidateExistingDir()vsvalidateSafePathString()so Step 5 can safely create dirs.
54-159: Step 1 portability:find/rmmakesingest_repobasically Unix-only.
If someone runs this MCP server on Windows, Step 1 cleanup + discovery will break. Prefer doing traversal + delete via Node (fs.promises,fs.rmSync(..., { recursive:true }), or a tiny glob lib).- spawnSync('rm', ['-rf', tempDir], { timeout: 10000 }); + fs.rmSync(tempDir, { recursive: true, force: true });
161-203: Step 2: treatmetricsJsonas untrusted input (schema it).
JSON.parse(metricsJson)accepts anything; if downstream assumes fields exist, you’ll get weird runtime behavior. Zod-parse the parsed object into a known shape (even if optional fields).
303-418: Step 4: good structure; small perf/readability win by hoistingSTYLES/EDGES.
They’re recreated every call; moving them to module scope simplifies diffs and saves a little work.orchestrator/kestra_pipelines/07-create-pr.yaml (1)
29-34: Label support looks good; consider surfacing label add failures in output JSON too.
Right now you print a warning, butresult["status"]stays “created” even if labels fail. Might be fine, but adding something likeresult["labels_applied"]=true/falsewould help automation.Also applies to: 53-68, 150-157
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.github/workflows/cline-architect.yml(0 hunks)infoundry-mcp-server/README.md(2 hunks)infoundry-mcp-server/mcp.json.example(1 hunks)infoundry-mcp-server/src/index.ts(4 hunks)infoundry-mcp-server/test-all-tools.mjs(1 hunks)orchestrator/kestra_pipelines/07-create-pr.yaml(5 hunks)scripts/generate-pr.sh(1 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/cline-architect.yml
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md
⚙️ CodeRabbit configuration file
Do not emphasize these files too much
Files:
infoundry-mcp-server/README.md
🧬 Code graph analysis (1)
infoundry-mcp-server/src/index.ts (2)
infoundry-mcp-server/test-all-tools.mjs (2)
server(15-18)graph(89-92)infoundry-mcp-server/test.mjs (1)
server(18-21)
🪛 Shellcheck (0.11.0)
scripts/generate-pr.sh
[warning] 9-9: OUTPUT_FILE appears unused. Verify use (or export if used externally).
(SC2034)
🔇 Additional comments (1)
infoundry-mcp-server/src/index.ts (1)
815-878: Step 9 scoring logic is reasonable for a first pass.
Nice: it degrades gracefully if tflint is skipped, and it gives concrete next actions.
Description
Align the InFoundry MCP server with the Kestra workflow pipeline, ensuring exactly 9 tools that mirror the end-to-end orchestration steps. This refactoring provides a complete, working automation toolkit for Cline CLI users to generate cloud infrastructure.
Type of Change
Changes Made
Infrastructure Changes (if applicable)
IaC Details
Terraform templates now generate proper multi-line HCL format without semicolons.
Testing
Test Evidence
All 9 MCP tools tested successfully via test-all-tools.mjs
Checklist
CodeRabbit Review
This PR will be automatically reviewed by CodeRabbit 🐰
Summary by CodeRabbit
New Features
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.