Skip to main content
Glama
bilalgit

ConstructAI

by bilalgit
README.md
# ConstructAI

AI-powered construction project control assistant combining Civil Engineering project controls, Model Context Protocol (MCP), SQLAlchemy, and a local LLM.

## ๐Ÿšง Overview

ConstructAI is an AI assistant designed for construction project control.

It allows users to ask project-control questions in natural language and uses MCP tools to retrieve project data, analyze schedules, identify risks, evaluate delays, and recommend recovery actions.

### Key Capabilities

- Analyze project schedule status
- Identify critical activities
- Find activities by name
- Analyze construction delays
- Determine delay impact on project completion
- Identify delayed activities
- Analyze activity dependencies
- Identify resource bottlenecks
- Analyze project risks
- Generate schedule recovery strategies
- Provide project-control summaries

---

## ๐Ÿ—๏ธ Architecture

![ConstructAI Architecture](architecture.png)

```
User
  โ”‚
  โ–ผ
Natural Language Query
  โ”‚
  โ–ผ
Qwen3 8B (Local via Ollama)
  โ”‚
  โ–ผ
MCP Tool Calling
  โ”‚
  โ–ผ
ConstructAI MCP Server
  โ”‚
  โ”œโ”€โ”€ Schedule & CPM
  โ”œโ”€โ”€ Delay Analysis
  โ”œโ”€โ”€ Risk Analysis
  โ”œโ”€โ”€ Resource Analysis
  โ””โ”€โ”€ Schedule Recovery
  โ”‚
  โ–ผ
SQLAlchemy
  โ”‚
  โ–ผ
Project Database
  โ”‚
  โ–ผ
Engineering Analysis
  โ”‚
  โ–ผ
AI Recommendation
```

---
---

## ๐ŸŽฌ Demo

### AI + MCP Tool Execution

ConstructAI accepts a natural-language construction project-control question and automatically selects the required MCP tools.

![MCP Tool Execution](screenshots/mcp-tool-execution.png)

### Delay Impact & Schedule Recovery

For a delayed activity, ConstructAI identifies the activity, calculates the impact on project completion, identifies affected activities, and recommends recovery actions.

![Delay Analysis and Recovery](screenshots/delay-analysis-recovery.png)

## ๐Ÿค– Technology Stack

- Python
- MCP 2.1.1
- Qwen3 8B
- Ollama
- SQLAlchemy
- SQLite
- Natural-language tool calling

> The LLM runs locally through Ollama, so the current system does not require a paid AI API.

---

## ๐Ÿ”ง MCP Tools

ConstructAI currently provides **11 MCP tools**:

| # | Tool | Purpose |
|---|------|---------|
| 1 | `analyze_delay` | Analyze the impact of an activity delay |
| 2 | `project_status` | Retrieve overall project status |
| 3 | `critical_activities` | Identify critical activities |
| 4 | `activity_details` | Retrieve detailed activity information |
| 5 | `delayed_activities` | Identify delayed activities |
| 6 | `activity_dependencies` | Analyze predecessor and successor relationships |
| 7 | `schedule_recovery` | Generate schedule recovery options |
| 8 | `resource_bottleneck` | Identify resource bottlenecks |
| 9 | `project_risk_analysis` | Analyze project risks |
| 10 | `project_control_summary` | Provide an overall project-control summary |
| 11 | `find_activity_tool` | Find activities by name |

---

## ๐Ÿ“Š Project Control Capabilities

### Schedule Management

ConstructAI can analyze:

- Planned start and finish dates
- Activity durations
- Early and late dates
- Total float
- Critical activities
- Activity dependencies
- Project completion dates

### Delay Analysis

The system can determine:

- Delayed activity
- Delay duration
- Original project finish
- New project finish
- Project completion impact
- Affected downstream activities
- Delay priority
- Recommended corrective action

### Schedule Recovery

ConstructAI can recommend strategies such as:

- Expediting material procurement
- Increasing manpower
- Increasing working hours
- Prioritizing critical activities
- Coordinating successor activities
- Controlled activity overlap

---

## ๐Ÿง  Example AI Workflow

**User Question**

> Electrical Rough-in is delayed by 3 days because of a material shortage. What is the impact on Project 3 and how can we recover the schedule?

**Tool Execution**

```
User Question
     โ”‚
     โ–ผ
find_activity_tool
     โ”‚
     โ–ผ
Find Electrical Rough-in โ†’ Activity ID = 33
     โ”‚
     โ–ผ
analyze_delay
     โ”‚
     โ–ผ
Calculate Delay Impact
     โ”‚
     โ–ผ
schedule_recovery
     โ”‚
     โ–ผ
Generate Recovery Strategy
     โ”‚
     โ–ผ
Engineering Recommendation
```

**Result**

```
Original Project Finish : 2026-11-06
New Project Finish      : 2026-11-09
Project Impact          : 3 days
Priority                : CRITICAL

Recovery Actions:
1. Expedite material procurement
2. Increase manpower
3. Increase working hours
4. Prioritize critical-path activity
5. Coordinate successor activities
```

---

## ๐Ÿข Demo Project

The project includes a sample construction schedule: **ConstructAI Building Control Demo**

The schedule contains activities covering:

Site Mobilization ยท Excavation ยท PCC ยท Footing Reinforcement ยท Footing Concrete ยท Pedestal Reinforcement ยท Pedestal Concrete ยท Column Reinforcement ยท Column Concrete ยท Slab Reinforcement ยท Slab Concrete ยท Masonry ยท Electrical Rough-in ยท Plumbing Rough-in ยท Plastering ยท Flooring ยท False Ceiling ยท Painting ยท Final MEP Installation ยท Testing & Commissioning ยท Final Inspection & Handover

---

## ๐Ÿงช Testing

The project contains test files for major project-control modules and MCP functionality, including:

- `test_cpm.py`
- `test_delay.py`
- `test_delay_impact.py`
- `test_project_status.py`
- `test_project_risk.py`
- `test_schedule_recovery.py`
- `test_resource_bottleneck.py`
- `test_project_control_summary.py`

---

## ๐Ÿ“ Project Structure

```
ConstructAI/
โ”‚
โ”œโ”€โ”€ ai_client.py
โ”œโ”€โ”€ server.py
โ”‚
โ”œโ”€โ”€ database.py
โ”œโ”€โ”€ models.py
โ”‚
โ”œโ”€โ”€ cpm.py
โ”œโ”€โ”€ schedule.py
โ”œโ”€โ”€ schedule_variance.py
โ”œโ”€โ”€ forecast.py
โ”‚
โ”œโ”€โ”€ activity_details.py
โ”œโ”€โ”€ activity_dependencies.py
โ”œโ”€โ”€ critical_activities.py
โ”œโ”€โ”€ delayed_activities.py
โ”œโ”€โ”€ find_activity.py
โ”‚
โ”œโ”€โ”€ delay_analysis.py
โ”œโ”€โ”€ delay_impact.py
โ”‚
โ”œโ”€โ”€ recovery.py
โ”œโ”€โ”€ recovery_impact.py
โ”œโ”€โ”€ schedule_recovery.py
โ”‚
โ”œโ”€โ”€ resource_bottleneck.py
โ”œโ”€โ”€ project_risk_analysis.py
โ”œโ”€โ”€ project_control.py
โ”œโ”€โ”€ project_control_summary.py
โ”œโ”€โ”€ project_status.py
โ”œโ”€โ”€ recommendations.py
โ”‚
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ .gitignore
```

---

## ๐Ÿš€ Installation

### 1. Clone the repository

```bash
git clone https://github.com/bilalgit/ConstructAI.git
cd ConstructAI
```

### 2. Create a virtual environment

```bash
python -m venv venv
```

Activate it on Windows:

```bash
venv\Scripts\activate
```

### 3. Install dependencies

```bash
pip install -r requirements.txt
```

### 4. Install Ollama

Install Ollama and download the Qwen3 model:

```bash
ollama pull qwen3:8b
```

### 5. Run ConstructAI

Start the MCP server and AI client according to the project configuration.

---

## ๐Ÿ’ฐ Cost

| Item | Value |
|------|-------|
| AI Model | Qwen3 8B |
| Inference | Local |
| API Cost | โ‚น0 |

No paid AI inference API is required for the current setup.

---

## ๐ŸŽฏ Project Objective

The objective of ConstructAI is to explore how Artificial Intelligence and Model Context Protocol can be applied to construction project management and project controls.

The project combines:

- Civil Engineering
- Construction Planning
- Critical Path Method
- Schedule Management
- Delay Analysis
- Risk Management
- Resource Management
- Artificial Intelligence
- MCP Tool Calling
- Local LLMs
- Database-driven project controls

---

## ๐Ÿ”ฎ Future Development

Potential future improvements include:

- Construction cost control
- Quantity tracking
- Earned Value Management
- Resource leveling
- Progress forecasting
- Automated daily progress reports
- AI-generated weekly and monthly reports
- BIM integration
- Primavera P6 integration
- Power BI dashboards
- Construction document intelligence
- Multi-project portfolio monitoring

---

## ๐Ÿ‘จโ€๐Ÿ’ป Author

**Bilal**

Civil Engineering | Construction Project Controls | AI Engineering

---

โญ If you find this project interesting, feel free to explore the repository.

Maintenance

ActivityMaintained
ResponsivenessNo issues