How we built an AI proposal engine using Next.js, Google Gemini, and Model Context Protocol (MCP) - and architected a production AWS deployment that is fast, resilient, and cost-efficient.
1. The Challenge: Why Writing Proposals Stalls Real Work
Creating a professional proposal is often slow and manual. Teams must review client requirements, find the correct rates, calculate costs, write content, format it in branded templates, and organize the final files.
This process can take days, causes calculation and formatting errors, and takes valuable time from senior employees.
To solve this, we developed an AI Proposal Generator using Gemini (other models) and MCP, which automates requirement analysis, rate lookup, calculations, document generation, branding, and file management.
WHAT IS MCP?: The Model Context Protocol (MCP) is an open standard that decouples AI reasoning from tool execution. Instead of locking our AI logic into custom wrappers, MCP allows any LLM agent to securely discover, call, and coordinate back-end tools.
2. What the System Actually Does
The system connects AI chat with automated proposal generation through three main layers:
Next.js Chatbot UI: Users enter client requirements and interact with the AI through a web interface.
Google Gemini API: Understands the requirements, extracts the project scope, and decides which actions are needed.
Custom MCP Server: Performs the actual tasks such as generating DOCX proposals, XLSX cost sheets, timeline charts, and managing files through Google Drive.
**3. The Cloud Architecture: Why I Chose AWS
**I chose AWS to make the AI Proposal Generator fast, reliable, scalable, and cost-effective.
The system has three main goals:
Low latency: I run the Next.js application and MCP server together in Docker so they can communicate quickly.
High availability: I use multiple EC2 instances with a Load Balancer and Auto Scaling Group so the application can continue working even if one instance fails.
Cost control: I use Auto Scaling to increase or decrease resources based on demand, which helps avoid unnecessary costs.
With this AWS architecture, I can keep the application reliable, secure, and easy to manage while supporting future growth.
*4. How the Traffic Flows
*

Edge Tier (Route 53 & CloudFront): Users hit Route 53 DNS and CloudFront CDN, which caches my static Next.js assets at the edge to slash TTFB and reduce compute load.
Ingress & Routing (ALB): An Application Load Balancer terminates SSL/TLS and evenly distributes dynamic traffic across multiple Availability Zones while running active health checks.
Compute Tier (Multi-AZ EC2 ASG): I run my workload on t3.medium EC2 instances across us-east-1a and us-east-1b, ensuring the Auto Scaling Group can self-heal and scale on demand.
The 0ms Docker Network: By co-locating the Next.js UI and FastMCP server in a shared Docker bridge network (ai-network), I achieve 0ms local loopback latency (http://proposal-mcp:8000) for internal tool calls.
External Service Integration: The app streams chat tokens from the Google Gemini 2.5 API via SSE, while the MCP server interacts with the Google Drive API v3 to fetch rate-cards and upload final proposals.
**4. Key Takeaways & What's Next
**Building an AI application is not only about using an AI model. It is also about connecting the AI with the right tools and running them on reliable cloud infrastructure.
**1. Use MCP
**I use MCP to connect the AI with different tools. This makes the system flexible because I can use a different AI model or framework in the future without changing the whole system.
**2. Keep Services Close for Better Speed
**I run the Next.js application and MCP server together in Docker. They can communicate through an internal network, which helps reduce delays when handling large documents and files.
**3. Build for Reliability
**I use AWS services such as Auto Scaling, Load Balancer, multiple Availability Zones, and CloudFront to make the application more reliable and available.
**What's Next?
**The goal is to continue improving the system by making it more scalable, reliable, and automated as the number of users and proposal requests grows.
JOIN THE CONVERSATION: Are you building MCP servers or AI applications on AWS? How are you hosting your AI workloads? Let's discuss in the comments.
Top comments (0)