clockwork-mcp

MCP server for Laravel Clockwork - debug Laravel apps with Claude Code.
What it does
This MCP server gives Claude Code access to your Laravel application's Clockwork debugging data, enabling:
- Debugging - Find slow queries, N+1 problems, cache issues, errors
- Performance analysis - Track response times, query counts, memory usage
- Development insight - Understand request flow, see runtime behavior
Installation
Option 1: Claude Code Plugin (Recommended)
/marketplace add github:fridzema/clockwork-mcp
/plugin install clockwork
This installs the MCP server and adds convenience commands:
/clockwork:status - Check storage status
/clockwork:latest - Show latest request summary
/clockwork:slow - Find slow queries
/clockwork:n+1 - Detect N+1 patterns
Option 2: Manual MCP Configuration
Add to your Claude Code MCP settings:
{
"mcpServers": {
"clockwork": {
"command": "npx",
"args": ["-y", "clockwork-mcp"]
}
}
}
Quick Start
1. Install Clockwork in your Laravel app
composer require itsgoingd/clockwork
2. Start debugging
Ask Claude to analyze your requests:
- "Show me the latest request"
- "Find slow queries in the last request"
- "Check for N+1 query problems"
- "Compare this request with the previous one"
Or use the slash commands:
/clockwork:status
/clockwork:latest
/clockwork:slow
/clockwork:n+1
Usage Examples
Debugging a Slow Endpoint
You: "The /api/orders endpoint is slow, can you analyze it?"
Claude will use the MCP tools to:
- Find the latest request to
/api/orders
- Analyze query performance
- Detect N+1 patterns
- Suggest fixes like eager loading or caching
Investigating a 500 Error
You: "I just got a 500 error on the checkout page, what happened?"
Claude will:
- Find the latest failed request
- Show error logs and exception details
- Identify the problematic code path
Optimizing Database Queries
You: "Check if there are N+1 issues on the products page"
Claude will:
- Analyze recent requests to the products route
- Detect repeated query patterns
- Suggest eager loading with
->with('relation')
More Natural Language Examples
Performance:
- "Compare the last two requests to /api/users"
- "Which queries are taking the longest?"
- "Show me the cache hit ratio"
Debugging:
- "What middleware ran on the last request?"
- "Show me all log entries with errors"
- "List the events that were dispatched"
Analysis:
- "Give me a performance summary of the latest request"
- "Show the full request timeline"
- "What views were rendered?"
Exception & Error Analysis:
- "Show me exception patterns from the last hour"
- "What errors have been occurring?"
- "Group recent exceptions by type"
Route Performance:
- "Which routes are slowest? Show p95 response times"
- "Analyze route performance for the past day"
- "Compare response times across endpoints"
Memory Issues:
- "Are there any memory issues?"
- "Detect memory leaks or growth patterns"
- "Which requests are using the most memory?"
Queue Jobs:
- "List failed queue jobs"
- "Show me recent job executions"
- "What jobs are pending?"
Test Execution:
- "List recent test runs"
- "Show failed tests"
- "What tests are being skipped?"
Tools
Request Discovery
| Tool | Description |
|---|
list_requests | List recent requests with filtering |
get_request | Get full request details by ID |
get_latest_request | Get the most recent request |
search_requests | Search by controller, URI, status, duration |
Database Analysis
| Tool | Description |
|---|
get_queries | Get all database queries for a request |
analyze_slow_queries | Find queries above threshold |
detect_n_plus_one | Detect N+1 query patterns |
get_query_stats | Get aggregate query statistics |
Performance
| Tool | Description |
|---|
get_performance_summary | Response time, memory, query overview |
get_timeline | Execution timeline events |
compare_requests | Compare two requests side by side |
Cache & Redis
| Tool | Description |
|---|
get_cache_operations | Cache hits, misses, writes |
get_cache_stats | Hit ratio and totals |
get_redis_commands | Redis commands executed |