AI-Agent-MCP

Sam89Jha/AI-Agent-MCP

3.2

If you are the rightful owner of AI-Agent-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

NavieTakie Simulation is an AI-driven chat and voice assistant demo that simulates communication between drivers and passengers in a Grab-style system.

NavieTakie Simulation

An AI-driven chat and voice assistant demo simulating a Grab-style driver (DAX) and passenger (PAX) communication system.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   DAX App       β”‚    β”‚   PAX App       β”‚    β”‚  Bedrock Agent  β”‚
β”‚  (Driver UI)    β”‚    β”‚ (Passenger UI)  β”‚    β”‚   (Central AI)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   MCP Server    β”‚
                    β”‚  (API Gateway)  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Lambda Functionsβ”‚
                    β”‚  (Backend APIs) β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   DynamoDB      β”‚
                    β”‚   (Storage)     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Features

  • Voice & Text Chat: Real-time communication between drivers and passengers
  • AI-Powered Assistant: AWS Bedrock Agent for intelligent conversation handling
  • Mobile-First Design: Responsive React applications optimized for mobile devices
  • Serverless Backend: AWS Lambda functions for scalable API endpoints
  • Real-time Updates: WebSocket-like polling for instant message delivery
  • Cost Optimized: Estimated ~$10.47/month for full production deployment

πŸ“ Project Structure

NavieTakieSimulation/
β”œβ”€β”€ terraform/                 # Infrastructure as Code
β”‚   β”œβ”€β”€ main.tf               # Main Terraform configuration
β”‚   β”œβ”€β”€ variables.tf          # Variable definitions
β”‚   β”œβ”€β”€ outputs.tf           # Output values
β”‚   └── user_data.sh         # EC2 initialization script
β”œβ”€β”€ lambda-functions/         # AWS Lambda Functions
β”‚   β”œβ”€β”€ send_message.py      # Send message handler
β”‚   β”œβ”€β”€ make_call.py         # Call initiation handler
β”‚   β”œβ”€β”€ get_message.py       # Message retrieval handler
β”‚   └── requirements.txt     # Python dependencies
β”œβ”€β”€ mcp-server/              # MCP Server (API Gateway)
β”‚   β”œβ”€β”€ app.py              # FastAPI application
β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   β”œβ”€β”€ Dockerfile         # Container configuration
β”‚   └── docker-compose.yml # Local development
β”œβ”€β”€ frontend/               # React Applications
β”‚   β”œβ”€β”€ dax-app/           # Driver Assistant Experience
β”‚   β”‚   β”œβ”€β”€ src/           # React source code
β”‚   β”‚   β”œβ”€β”€ public/        # Static assets
β”‚   β”‚   └── package.json   # Dependencies
β”‚   └── pax-app/           # Passenger Assistant Experience
β”‚       β”œβ”€β”€ src/           # React source code
β”‚       β”œβ”€β”€ public/        # Static assets
β”‚       └── package.json   # Dependencies
β”œβ”€β”€ bedrock-agent/          # AWS Bedrock Agent Configuration
β”‚   β”œβ”€β”€ agent-config.json  # Agent configuration
β”‚   └── agent-deployment.yaml # CloudFormation template
β”œβ”€β”€ staging/               # Local Development & Testing
β”‚   β”œβ”€β”€ docker-compose.yml # Complete staging environment
β”‚   β”œβ”€β”€ test_runner.py     # Comprehensive test suite
β”‚   └── requirements.txt   # Testing dependencies
β”œβ”€β”€ scripts/               # Deployment Scripts
β”‚   └── deploy.sh         # Automated deployment script
└── README.md             # This file

πŸ› οΈ Prerequisites

Before deploying, ensure you have the following installed:

  • AWS CLI (v2.x)
  • Terraform (v1.x)
  • Docker (v20.x)
  • Node.js (v18.x)
  • Python (v3.9+)
  • jq (for JSON parsing)

πŸš€ Quick Start

1. Clone and Setup

git clone <repository-url>
cd NavieTakieSimulation

2. Configure AWS

aws configure
# Enter your AWS Access Key ID, Secret Access Key, and region

3. Deploy Everything

chmod +x scripts/deploy.sh
./scripts/deploy.sh

The deployment script will:

  • βœ… Check prerequisites
  • πŸ—οΈ Build frontend applications
  • ☁️ Deploy AWS infrastructure
  • πŸ”§ Deploy Lambda functions
  • πŸ–₯️ Deploy MCP Server to EC2
  • 🌐 Deploy frontend apps to S3
  • πŸ” Run health checks
  • πŸ“Š Display deployment summary

πŸ§ͺ Local Development

Staging Environment

cd staging
docker-compose up -d

This starts:

  • MCP Server on http://localhost:8000
  • DynamoDB Local on http://localhost:8001
  • DAX App on http://localhost:3000
  • PAX App on http://localhost:3001

Individual Components

MCP Server
cd mcp-server
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 8000
Frontend Apps
# DAX App
cd frontend/dax-app
npm install
npm start

# PAX App
cd frontend/pax-app
npm install
npm start

πŸ§ͺ Testing

Run Complete Test Suite

cd staging
python test_runner.py

Individual Tests

# Test MCP Server
curl http://localhost:8000/health

# Test Lambda Functions
aws lambda invoke --function-name send-message --payload '{"booking_code":"TEST","message":"Hello","sender":"driver"}' response.json

# Test Frontend Apps
curl http://localhost:3000
curl http://localhost:3001

🌐 Production URLs

After deployment, your applications will be available at:

  • DAX (Driver): https://dax.sameer-jha.com
  • PAX (Passenger): https://pax.sameer-jha.com
  • MCP Server: https://mcp.sameer-jha.com

πŸ’° Cost Breakdown

ServiceMonthly CostDescription
EC2 (t3.micro)~$8.47MCP Server hosting
Lambda~$0.50API functions
DynamoDB~$1.00Message storage
S3 + CloudFront~$0.50Static hosting
Total~$10.47Full production

πŸ”§ Configuration

Environment Variables

# AWS Configuration
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key

# Application Configuration
REACT_APP_API_URL=http://localhost:8000
DYNAMODB_TABLE=chat-messages

Domain Configuration

Update the domain in scripts/deploy.sh:

DOMAIN="your-domain.com"
DAX_SUBDOMAIN="dax"
PAX_SUBDOMAIN="pax"
MCP_SUBDOMAIN="mcp"

πŸ”’ Security

  • IAM Roles: Least privilege access for all services
  • Security Groups: Restricted network access
  • HTTPS: SSL/TLS encryption for all endpoints
  • CORS: Configured for cross-origin requests
  • Input Validation: All API inputs are validated

πŸ“Š Monitoring

CloudWatch Metrics

  • Lambda function invocations and duration
  • DynamoDB read/write capacity
  • EC2 instance metrics
  • CloudFront distribution metrics

Application Logs

  • Lambda function logs in CloudWatch
  • MCP Server logs in Docker containers
  • Frontend application logs in browser console

🚨 Troubleshooting

Common Issues

  1. EC2 Instance Not Starting

    aws ec2 describe-instances --instance-ids <instance-id>
    
  2. Lambda Function Errors

    aws logs describe-log-groups --log-group-name-prefix /aws/lambda/
    
  3. Frontend Build Failures

    cd frontend/dax-app
    npm install --force
    npm run build
    
  4. MCP Server Connection Issues

    ssh -i key.pem ubuntu@<ec2-ip>
    docker logs mcp-server
    

Health Checks

# Test MCP Server
curl -f http://localhost:8000/health

# Test Lambda Functions
aws lambda invoke --function-name send-message --payload '{"test":"data"}' response.json

# Test Frontend Apps
curl -f http://localhost:3000

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

For support and questions:

  • Create an issue in the repository
  • Check the troubleshooting section
  • Review the logs and metrics

🎯 Roadmap

  • WebSocket support for real-time messaging
  • Push notifications
  • Multi-language support
  • Advanced AI features
  • Analytics dashboard
  • Mobile apps (React Native)

Built with ❀️ using AWS, React, and Python