A production-ready AI agent application featuring an MCP server, Mastra AI agent, and interactive Next.js frontend with real-time synchronization. This project demonstrates two domains: Code Review Assistant (primary) and IoT Device Controller (secondary).
- MCP Server - Custom tools for code review and IoT device management
- Mastra AI Agent - Dynamic prompts and intelligent orchestration
- Next.js Frontend - Modern UI with real-time synchronization
- Live Sync Layer - Server-Sent Events for real-time updates
- Repository Scanning - Analyze codebase structure and file organization
- Diff Review - Security, performance, and quality analysis of code changes
- Lint Checking - Automated code quality and style enforcement
- Interactive UI - Repository explorer, diff viewer, and issue tracking
- Device Status Monitoring - Real-time health and performance tracking
- Device Commands - Remote control and management capabilities
- Fleet Management - Bulk operations and analytics dashboard
- Predictive Maintenance - Smart recommendations and alerts
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Next.js β β Mastra β β MCP Server β
β Frontend βββββΊβ Agent βββββΊβ + Tools β
β (Port 3000) β β (Port 3002) β β (Port 3001) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
β βββββββββββββββββββ β
ββββββββββββββββΊβ Event Bus ββββββββββββββββ
β (SSE/WS) β
βββββββββββββββββββ
- Frontend: Next.js 15 (App Router), React 18, TypeScript
- Styling: Tailwind CSS, shadcn/ui components
- Backend: Node.js, MCP SDK, Mastra Core
- Real-time: Server-Sent Events, Event Bus
- Testing: Jest, Testing Library
- Deployment: Docker, Docker Compose, Nginx
- Node.js 18+
- npm 9+
- Docker (for deployment)
-
Clone the repository
git clone <repository-url> cd nosana-agents-102-challenge
-
Install dependencies
npm install cd mcp-server && npm install && cd .. cd agent && npm install && cd ..
-
Set up environment variables
cp env.example .env.local # Edit .env.local with your configuration -
Start the development servers
# Terminal 1: MCP Server cd mcp-server && npm run dev # Terminal 2: Mastra Agent cd agent && npm run dev # Terminal 3: Next.js Frontend npm run dev
-
Access the application
- Frontend: http://localhost:3000
- MCP Server: http://localhost:3001
- Agent: http://localhost:3002
-
Build and start all services
docker-compose up --build
-
Access the application
- Frontend: http://localhost:3000
- Nginx Proxy: http://localhost:80
-
Repository Scanning
- Navigate to
/code-review - Enter repository path
- Click "Scan Repository"
- View structure analysis and recommendations
- Navigate to
-
Diff Review
- Select "Diff Review" tab
- Paste git diff content
- Choose review focus (security, performance, etc.)
- Get detailed feedback and suggestions
-
Lint Checking
- Select "Lint Check" tab
- Enter file path
- Choose linter type
- Review issues and auto-fix suggestions
-
Device Monitoring
- Navigate to
/iot-devices - View device status dashboard
- Check individual device health
- Monitor fleet analytics
- Navigate to
-
Device Commands
- Select "Device Command" tab
- Choose device and command
- Send custom commands
- Monitor execution results
-
Fleet Management
- Use bulk operations
- Schedule maintenance
- View performance metrics
- Manage device groups
-
Monitor Agent Activity
- Navigate to
/agent - View real-time request processing
- Check system metrics
- Review agent logs
- Navigate to
-
Chat Interface
- Use the chat interface
- Ask questions about code or devices
- Get intelligent responses
- View conversation history
# Unit tests
npm test
# Watch mode
npm run test:watch
# Coverage report
npm run test:coverage
# Type checking
npm run type-check
# Linting
npm run lint- Unit Tests: Component and utility testing
- Integration Tests: API and service testing
- E2E Tests: Full workflow testing
- MCP Tool Tests: Tool functionality testing
- Agent request processing
- Device status updates
- System performance
- Error tracking
- Server-Sent Events for live updates
- Event history and replay
- Custom event subscriptions
- Performance monitoring
-
Prepare for deployment
# Build production images docker-compose -f docker-compose.prod.yml build # Run health checks docker-compose -f docker-compose.prod.yml up --abort-on-container-exit
-
Deploy to Nosana Network
- Configure Nosana API keys
- Set up network endpoints
- Deploy containerized services
- Monitor deployment status
| Variable | Description | Default |
|---|---|---|
NODE_ENV |
Environment mode | production |
PORT |
Application port | 3000 |
MCP_SERVER_URL |
MCP server endpoint | http://localhost:3001 |
ENABLE_SSE |
Enable Server-Sent Events | true |
LOG_LEVEL |
Logging level | info |
nosana-agents-102-challenge/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β βββ code-review/ # Code review pages
β βββ iot-devices/ # IoT device pages
β βββ agent/ # Agent console
β βββ globals.css # Global styles
βββ components/ # React components
β βββ ui/ # shadcn/ui components
βββ lib/ # Shared utilities
β βββ utils.ts # Utility functions
β βββ event-bus.ts # Event system
βββ mcp-server/ # MCP server implementation
β βββ tools/ # Custom MCP tools
β βββ index.ts # Server entry point
βββ agent/ # Mastra agent
β βββ prompts/ # Dynamic prompts
β βββ index.ts # Agent entry point
βββ docker-compose.yml # Container orchestration
βββ Dockerfile # Container configuration
βββ README.md # This file
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Nosana Network for the challenge framework
- MCP SDK for the Model Context Protocol implementation
- Mastra for the AI agent framework
- Next.js and React teams for the excellent frontend tools
- shadcn/ui for the beautiful component library
For questions, issues, or contributions:
- Create an issue in the repository
- Check the documentation
- Review the code examples
- Contact the development team
Built with β€οΈ for the Nosana Agents 102 Challenge