PHPackages                             skylence/laravel-optimize-mcp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. skylence/laravel-optimize-mcp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

skylence/laravel-optimize-mcp
=============================

Laravel Optimize MCP provides optimization tools and utilities for AI-assisted development

1.0.2(4mo ago)071MITPHPPHP ^8.1

Since Nov 2Pushed 4mo agoCompare

[ Source](https://github.com/skylence-be/laravel-optimize-mcp)[ Packagist](https://packagist.org/packages/skylence/laravel-optimize-mcp)[ Docs](https://github.com/laravel/optimize-mcp)[ RSS](/packages/skylence-laravel-optimize-mcp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (27)Used By (0)

Laravel Optimize MCP
====================

[](#laravel-optimize-mcp)

Optimize your Laravel project with AI assistance through the Model Context Protocol (MCP).

Installation
------------

[](#installation)

Install via Composer:

```
composer require skylence/laravel-optimize-mcp
```

Run the installation command and follow the prompts:

```
php artisan optimize-mcp:install
```

The installer will:

- Automatically detect and configure your code editor (Cursor, Claude Code, VS Code, or PhpStorm)
- Ask if you want HTTP access for staging/production servers
- Generate a secure token and configuration instructions for remote access

Usage
-----

[](#usage)

Once installed, ask your AI assistant to optimize your Laravel project:

**"Analyze my Laravel project and help me optimize it"**

Your AI will use the installed MCP tools to:

- Analyze your configuration for performance and security issues
- Review your project structure and development workflow
- Recommend useful packages and improvements
- Provide actionable recommendations with code snippets

Remote Access for Staging/Production
------------------------------------

[](#remote-access-for-stagingproduction)

Want to analyze your staging or production environment? The installer can configure this for you automatically, or you can set it up manually by adding these to your `.env` file:

```
# Enable secure HTTP access
OPTIMIZE_MCP_AUTH_ENABLED=true

# Generate token: php artisan tinker --execute="echo bin2hex(random_bytes(32))"
OPTIMIZE_MCP_API_TOKEN=your-secure-token-here
```

Then ask your AI to connect to your remote server:

**"Connect to my production Laravel server at  and analyze the .env configuration"**

This allows you to check production environment variables, cache/session drivers, and security settings without SSH access.

Database Monitoring &amp; Alerts
--------------------------------

[](#database-monitoring--alerts)

Set up automatic database size monitoring with growth tracking and email alerts:

### Enable Monitoring

[](#enable-monitoring)

1. Add to your `.env`:

```
OPTIMIZE_MCP_DB_MONITORING=true
OPTIMIZE_MCP_DB_NOTIFICATION_EMAILS=dev@example.com,ops@example.com
OPTIMIZE_MCP_DB_WARNING_THRESHOLD=80
OPTIMIZE_MCP_DB_CRITICAL_THRESHOLD=90
```

2. Run migrations:

```
php artisan migrate
```

3. Schedule the monitoring command:

**Laravel 11+ / 12** (in `bootstrap/app.php`):

```
->withSchedule(function (Schedule $schedule): void {
    $schedule->command('optimize-mcp:monitor-database')
        ->daily()
        ->onOneServer()
        ->when(fn () => config('app.schedule_enabled', true));
})
```

**Laravel 10 and earlier** (in `app/Console/Kernel.php`):

```
protected function schedule(Schedule $schedule)
{
    // Run database monitoring daily (or hourly, weekly, etc.)
    $schedule->command('optimize-mcp:monitor-database')->daily();
}
```

**Make schedules configurable** (recommended):

Add to `config/app.php`:

```
'schedule_enabled' => (bool) env('APP_SCHEDULE_ENABLED', true),
```

Add to `.env`:

```
APP_SCHEDULE_ENABLED=true  # Set to false to disable all scheduled tasks
```

This allows you to easily enable/disable schedules per environment (local, staging, production).

### Available Commands

[](#available-commands)

```
# Check database size manually
php artisan optimize-mcp:database-size

# Run monitoring (logs size, calculates growth, sends alerts)
php artisan optimize-mcp:monitor-database

# Clean up old logs (keeps 90 days by default)
php artisan optimize-mcp:prune-database-logs
```

### Features

[](#features)

- **Automatic Tracking**: Logs database size, growth rate, and disk usage
- **Growth Prediction**: Estimates when your database will be full based on growth trends
- **Smart Alerts**: Email notifications at warning (80%) and critical (90%) thresholds
- **Historical Data**: Track size over time to identify growth patterns
- **Cross-Database**: Supports MySQL, PostgreSQL, and SQLite

What's Included
---------------

[](#whats-included)

- **Configuration Analyzer**: Checks your Laravel config for performance and security
- **Database Size Inspector**: Monitor database size, growth trends, and disk usage
- **Database Monitoring &amp; Alerts**: Automatic size tracking with email notifications
- **Log File Inspector**: Check log sizes and rotation configuration (HTTP MCP only)
- **Nginx Config Inspector**: Analyze nginx for security and performance (HTTP MCP only)
- **Nginx Config Generator**: Generate production-ready nginx configs (HTTP MCP only)
- **Project Structure Analyzer**: Reviews your composer scripts, CI/CD, testing setup, and more
- **Package Advisor**: Recommends useful packages for your project

LLM Guidelines for AI Assistants
--------------------------------

[](#llm-guidelines-for-ai-assistants)

Want your AI assistant to know how to use these MCP tools? Add the Laravel Optimize MCP guidelines to your project's LLM instruction files:

```
# From the root of your Laravel project
php vendor/skylence/laravel-optimize-mcp/bin/append-guidelines.php CLAUDE.md

# Or for other LLM instruction files
php vendor/skylence/laravel-optimize-mcp/bin/append-guidelines.php .cursorrules
php vendor/skylence/laravel-optimize-mcp/bin/append-guidelines.php .copilot-instructions.md
```

This appends comprehensive guidelines about:

- How to use each MCP tool
- When to use HTTP MCP vs stdio/PHP MCP tools
- Best practices for security and performance
- Configuration examples and common solutions

The script will:

- ✅ Append guidelines to existing files without overwriting
- ✅ Skip if guidelines are already present
- ✅ Create the file with guidelines if it doesn't exist

Advanced Configuration
----------------------

[](#advanced-configuration)

For remote access, HTTP endpoints, and custom tool configuration, see the [full documentation](https://github.com/skylence/laravel-optimize-mcp).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance75

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Recently: every ~15 days

Total

26

Last Release

136d ago

Major Versions

v0.13.2 → v1.0.02025-11-03

v0.13.3 → 1.0.12025-11-03

PHP version history (2 changes)v0.1.0PHP ^8.2

v0.8.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ad0eeb3e0f0183e243d7edf649313243750f8048918eb00c9c041c5dc379149?d=identicon)[skylence](/maintainers/skylence)

---

Top Contributors

[![jonasvanderhaegen-xve](https://avatars.githubusercontent.com/u/216873699?v=4)](https://github.com/jonasvanderhaegen-xve "jonasvanderhaegen-xve (44 commits)")

---

Tags

laravelmcpaioptimization

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/skylence-laravel-optimize-mcp/health.svg)

```
[![Health](https://phpackages.com/badges/skylence-laravel-optimize-mcp/health.svg)](https://phpackages.com/packages/skylence-laravel-optimize-mcp)
```

###  Alternatives

[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.5k10.6M274](/packages/laravel-boost)[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[laravel/ai

The official AI SDK for Laravel.

732506.3k60](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

74310.9M66](/packages/laravel-mcp)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
