
Serverless Agentic Builds: Connecting Kiro CLI & MCP Servers to AWS Lambda in 15 Minutes
Agentic AI is booming, but local execution doesn't scale. Here is how to deploy Kiro CLI Model Context Protocol (MCP) servers on AWS Lambda for cost-efficient, serverless execution.
“The magic you are looking for is in the work you are avoiding.
The Agentic Era Needs Real Engineering
As the AWS Student Builder Group Leader at GLA University, my mantra has always been simple: I design, break, and rebuild cloud-native systems — then teach others how to do the same. Right now, everyone is hyping up Agentic AI and the Model Context Protocol (MCP), but most builders are avoiding the hard work of making these agents scale cost-effectively in the real world.
We are seeing a massive shift towards tools like Kiro CLI, an AI-powered command-line assistant designed for software development and operations on AWS. By integrating with MCP—a protocol that allows Kiro to communicate with external servers to access specialized tools and resources—we can completely transform how we interact with our infrastructure.
But running MCP servers locally on your laptop doesn't cut it for enterprise or team-wide GitOps workflows.
Here is how you bridge Kiro CLI with AWS Lambda to create a Serverless Agentic Build in under 15 minutes. No idle EC2 costs. Infinite scalability. Pure execution.
Why Kiro CLI + MCP on AWS Lambda?
If you have been following the agentic space, you know that tools like the Strands Agents SDK—an open-source framework emphasizing a model-driven approach—are changing the game. But to really scale, we need serverless execution.
By hosting your MCP servers on AWS Lambda, you achieve:
- Scale-to-Zero: You only pay when Kiro CLI actually invokes the tool. This perfectly aligns with the mindset of cutting cloud spend without sacrificing performance.
- Centralized Team Tools: Instead of every engineer managing local Python environments, the whole team points their
~/.kiro/settings/mcp.jsonto the same API Gateway endpoint. - IAM Security: Native AWS authentication integration.
The 15-Minute Architecture Build
Here is the blueprint for our serverless autonomous setup.
Step 1: The Serverless MCP Tool (Python) We will build a simple Lambda function using Python, a language I rely on for core problem-solving and MLOps. This tool will securely fetch real-time logs from an EKS node—ideal if you are running Spot-backed EKS node groups to slash compute costs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import json
import boto3
def lambda_handler(event, context):
# Standard MCP Tool Execution Payload
body = json.loads(event.get("body", "{}"))
method = body.get("method")
if method == "tools/call":
# Execute your specific tool logic here
return {
"statusCode": 200,
"body": json.dumps({"result": "Spot Instance logs retrieved successfully.", "status": "secure"})
}
return {"statusCode": 400, "body": "Method not supported"}Step 2: Terraform the Infrastructure To deploy this, we use Terraform to architect the environment. We need an API Gateway (HTTP API) wired to our Lambda function, wrapped in proper IAM least-privilege roles.
1
2
3
4
5
6
7
8
9
10
11
12
13
resource "aws_lambda_function" "mcp_server" {
filename = "mcp_tool.zip"
function_name = "kiro_mcp_eks_tool"
role = aws_iam_role.lambda_exec.arn
handler = "index.lambda_handler"
runtime = "python3.10"
}
resource "aws_apigatewayv2_api" "mcp_api" {
name = "kiro-mcp-gateway"
protocol_type = "HTTP"
}
# (Integration and routing omitted for brevity)Step 3: Wire Kiro CLI Once deployed, grab your API Gateway URL. Open your Kiro CLI configuration at
~/.kiro/settings/mcp.json and add your new serverless tool:1
2
3
4
5
6
7
8
{
"mcpServers": {
"serverless-eks-tool": {
"command": "curl",
"args": ["-X", "POST", "https://your-api-id.execute-api.us-east-1.amazonaws.com/mcp", "-d"]
}
}
}Note: We use curl here as a lightweight bridge for Kiro's stdio expectations to our HTTP API.
You can now ask Kiro CLI to "Investigate my Spot-backed EKS node failure," and it will dynamically invoke your AWS Lambda function, pull the architecture data, and feed it right back into the model's context window.
BONUS - QUICK QUESTION (for genuine builders)
📊 Community Poll: Let's Settle This
What is your go-to compute service for hosting AI Agent APIs and MCP Servers?
A) AWS Lambda (Serverless all the way)
B) Amazon ECS / Fargate (Give me containers)
C) Amazon EC2 (I like managing servers)
D) I just run them locally for now
A) AWS Lambda (Serverless all the way)
B) Amazon ECS / Fargate (Give me containers)
C) Amazon EC2 (I like managing servers)
D) I just run them locally for now
Drop your answer in the comments below! 👇
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article