clockwork-mcp-remote
Provides tools for debugging Laravel applications via Clockwork, including request inspection, query analysis, N+1 detection, slow query monitoring, exception analysis, timeline and performance summaries, cache/Redis operations, and route performance statistics.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@clockwork-mcp-remote Connect to https://staging.my-app.com and find slow queries in the last hour"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
clockwork-mcp-remote
MCP server that plugs AI coding assistants into Laravel Clockwork — remotely. Query performance, N+1 detection, slow query analysis, exceptions, and full request debugging for any Laravel application, anywhere — localhost, staging, or production.
There are other Clockwork MCP servers, but they require the Laravel project to live on your machine — PHP installed, filesystem access, running alongside the app. clockwork-mcp-remote has no such requirement: it speaks the Clockwork HTTP API directly, so you can debug a deployed application from your editor without SSH, shared folders, or a local checkout.
You: "Connect to https://staging.my-app.com and find slow queries in the last hour"How it works
The server consumes the Clockwork HTTP API (/__clockwork) exposed by the itsgoingd/clockwork Laravel package. Every tool accepts optional connection parameters, so one server instance can inspect any number of applications dynamically:
connect_clockworkwith{ baseUrl, username?, password? }verifies the API and caches the authenticated sessionAll other tools accept the same parameters — or reuse an existing connection
Credentials are cached per URL, so switching apps is instant
It also works locally: when run inside a Laravel project it can auto-detect the app and read Clockwork storage directly (artisan or file storage), no HTTP required. Remote debugging is simply the default story.
Related MCP server: Symfony Debug MCP Server
Installation
OpenCode
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"clockwork": {
"type": "local",
"command": ["npx", "-y", "clockwork-mcp-remote"]
}
}
}Claude Code
{
"mcpServers": {
"clockwork": {
"command": "npx",
"args": ["-y", "clockwork-mcp-remote"]
}
}
}From source
{
"mcp": {
"clockwork": {
"type": "local",
"command": ["node", "/path/to/clockwork-mcp-remote/dist/index.js"]
}
}
}No environment variables are required — connections are made per tool call. For a fixed default connection, set them via environment:
Variable | Description |
| Default application URL (enables the HTTP driver) |
| Default authentication username |
| Default authentication password |
| Pre-authenticated |
| Force driver: |
| Laravel project root (local drivers) |
| Direct Clockwork storage path (file driver) |
| Custom PHP binary path (artisan driver) |
| HTTP request timeout in ms (default 30000) |
Precedence: per-call connection parameters → environment variables → local auto-detection.
Laravel setup
The target application needs Clockwork installed and its API reachable:
composer require itsgoingd/clockworkFor remote hosts, the API must be explicitly enabled since Clockwork only serves non-local requests when configured. In config/clockwork.php:
'enable' => env('CLOCKWORK_ENABLE', true),
'authentication' => env('CLOCKWORK_AUTHENTICATION', true),
'authentication_password' => env('CLOCKWORK_AUTH_PASSWORD'),Then pass the same password to the MCP tools. Local hosts (same origin or localhost) work with no configuration at all.
Tools
Connection
Tool | Description |
| Connect to any Clockwork URL — verifies API + auth, caches the session |
Request discovery
Tool | Description |
| List recent requests with filtering (type, status, URI, method, time range) |
| Full details of a request by ID |
| Most recent request |
| Search by controller, URI, status, or duration |
Database
Tool | Description |
| Queries for a request, with optional slow-query filter |
| Slow queries grouped by normalized SQL pattern across requests |
| N+1 pattern detection across requests |
| Aggregate query statistics (counts, durations, type breakdown) |
Performance
Tool | Description |
| Response time, memory, queries, cache ratio |
| Execution timeline events |
| Side-by-side comparison of two requests |
Cache & Redis
Tool | Description |
| Cache hits, misses, writes, deletes |
| Hit ratio and totals |
| Redis commands executed |
Application context
Tool | Description |
| Log entries with level filtering |
| Dispatched events and listeners |
| Rendered views |
| Outgoing HTTP requests |
| Authenticated user for a request |
| Session data |
| Middleware chain |
| Route details |
Traces & execution flow
Tool | Description |
| Hierarchical execution tree from timeline events |
| Source location for a query |
| Source location for a log entry |
Multi-request analysis
Tool | Description |
| Group exceptions by message pattern |
| Route performance with percentiles (p50/p95/p99) |
| High memory usage and growth patterns |
Commands, queues & tests
Tool | Description |
| Profiled artisan command executions |
| Queue job executions |
| Test executions |
Utility
Tool | Description |
| Storage status and statistics |
| High-level summary of what happened in a request |
Example sessions
Debug a slow endpoint:
You: "https://staging.my-app.com is slow on /api/orders — connect and analyze it"
→ connect_clockwork { baseUrl: "https://staging.my-app.com", password: "..." }
→ search_requests { uri: "/api/orders", baseUrl: ... }
→ get_queries { requestId: "...", baseUrl: ... }
→ detect_n_plus_one { count: 5, baseUrl: ... }
"The /api/orders endpoint runs 34 queries per request — the Product::find()
loop at OrderController.php:87 triggers an N+1. Use Product::whereIn() or
eager loading with ->with('products')."Investigate a 500 error:
You: "Got a 500 on checkout on staging, what happened?"
→ get_latest_request { baseUrl: ..., }
→ get_logs { requestId: "...", level: "error" }
→ analyze_exceptions { since: "1h" }Compare environments or apps:
You: "Compare response times of /api/products on staging and production"
→ search_requests { uri: "/api/products", baseUrl: "https://staging..." }
→ search_requests { uri: "/api/products", baseUrl: "https://prod..." }
→ compare_requests { ... }Development
git clone https://github.com/ahmedbally/clockwork-mcp
cd clockwork-mcp
npm install
npm run build # build to dist/
npm test # run test suite
npm run typecheck # verify types
npm run lint # eslintRequirements
Node.js 18+
A Laravel application with itsgoingd/clockwork installed
Any MCP client (OpenCode, Claude Code, Cursor, etc.)
License
MIT
Available Tools
39 toolsanalyze_exceptionsB
Analyze exceptions across requests, grouping by message pattern
Inputs: all, uri, count, limit, +7 more.
analyze_route_performanceC
Analyze route performance with percentile statistics
Inputs: all, uri, count, since, +7 more.
analyze_slow_queriesC
Find slow database queries above threshold
Inputs: all, uri, count, limit, +7 more.
compare_requestsC
Compare two requests side by side
Inputs: requestId1 (required), requestId2 (required), token, baseUrl, +2 more.
connect_clockworkA
Connect to a Clockwork application (any URL with optional password). Verifies the API is reachable and authentication works, then caches the connection for subsequent calls. All other tools also accept the same baseUrl/username/password/token parameters directly.
Inputs: token, baseUrl, password, username.
detect_memory_issuesB
Detect high memory usage and growth patterns
Inputs: all, uri, count, since, +7 more.
detect_n_plus_oneB
Detect N+1 query patterns in a request
Inputs: all, uri, count, since, +6 more.
explain_request_flowC
Get high-level summary of what happened in a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_auth_userC
Get authenticated user for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_cache_operationsC
Get cache operations for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_cache_statsC
Get cache statistics (hit ratio, totals)
Inputs: to, from, token, baseUrl, +3 more.
get_call_graphC
Build hierarchical execution tree from timeline events
Inputs: requestId (required), token, baseUrl, password, +2 more.
get_clockwork_statusC
Check Clockwork storage status and statistics
Inputs: token, baseUrl, password, username.
get_commandC
Get full details of an Artisan command execution
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_eventsC
Get dispatched events for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_http_requestsA
Get outgoing HTTP requests made during a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_latest_requestC
Get the most recent Clockwork request
Inputs: token, baseUrl, password, username.
get_logsC
Get log entries for a request
Inputs: requestId (required), level, token, baseUrl, +2 more.
get_log_stack_traceC
Get source location for a log entry
Inputs: logIndex (required), requestId (required), token, baseUrl, +2 more.
get_middleware_chainC
Get middleware chain for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_performance_summaryC
Get performance overview for a request
Inputs: to, from, token, baseUrl, +3 more.
get_queriesC
Get database queries for a request
Inputs: requestId (required), slow, token, baseUrl, +3 more.
get_query_stack_traceC
Get source location for a database query
Inputs: requestId (required), queryIndex (required), token, baseUrl, +2 more.
get_query_statsC
Get aggregate query statistics for a request
Inputs: to, from, token, baseUrl, +3 more.
get_queue_jobB
Get full details of a queue job
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_redis_commandsC
Get Redis commands for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_requestA
Get full details of a specific request by ID
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_route_detailsC
Get route details for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_session_dataC
Get session data for a request
Inputs: requestId (required), keys, token, baseUrl, +2 more.
get_testB
Get full details of a test execution
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_timelineC
Get timeline events for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_viewsC
Get rendered views for a request
Inputs: requestId (required), token, baseUrl, password, +1 more.
get_xdebug_hotspotsA
Get Xdebug hotspots for a request (stub - not available in Clockwork)
Inputs: requestId (required), limit.
get_xdebug_profileA
Get Xdebug profiling data for a request (stub - not available in Clockwork)
Inputs: requestId (required).
list_commandsB
List profiled Artisan command executions
Inputs: to, from, name, limit, +5 more.
list_queue_jobsC
List queue jobs with optional filtering
Inputs: to, job, from, limit, +7 more.
list_requestsC
List recent Clockwork requests with optional filtering
Inputs: to, uri, from, type, +8 more.
list_testsC
List test executions with optional filtering
Inputs: to, from, name, limit, +6 more.
search_requestsB
Search requests by controller, URI, status, or duration
Inputs: uri, limit, token, offset, +7 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 39 tools
Most tools target a distinct Clockwork data type (queries, cache, logs, views, middleware, etc.), so an agent can generally select the right one. A few high-level analysis tools like get_performance_summary, get_timeline, explain_request_flow, and get_call_graph have overlapping purposes and could cause misselection. The two Xdebug stub tools are also nearly identical in availability, but their names make the intended difference clear.
Tool names follow a very consistent verb_noun pattern, mostly built on get_, list_, search_, analyze_, detect_, compare_, and explain_. All names are snake_case and predictable. connect_clockwork is the only outlier, but it represents a distinct setup action and does not break the overall pattern.
39 tools is excessive for an MCP server surface and exceeds the 25-tool threshold where coherence degrades. Many getters for individual request components could be grouped or parameterized (e.g., a single get_request_data tool). Each tool is individually narrow, so the set feels more like an API dump than a curated toolset.
The server covers almost every Clockwork domain: requests, queries, cache, Redis, logs, events, views, HTTP calls, queue jobs, tests, commands, auth, session, middleware, route, exceptions, and performance. The only real gaps are the two Xdebug stub tools that are explicitly unavailable, creating minor dead ends. Overall this is a near-complete read-only profiling surface.
Related MCP Connectors
Error tracking for Laravel and PHP apps. Let your agent fetch errors, stack traces and context.
Application monitoring: exceptions, slow requests, jobs, queries, logs and uptime monitors.
External security monitoring for Laravel apps: list domains, trigger scans, read issues and fixes.
Analytics and debugging for your MCP server — explore usage and sessions, then root-cause errors.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Claude Code MCP server that connects to Laravel Clockwork to provide insights into application performance, database queries, errors, and request flow.3823 npm4MIT
- FlicenseNot gradedqualityCmaintenanceEnables debugging Symfony applications by inspecting profiler data through a standalone MCP server.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to introspect a Laravel application's routes, models, controllers, migrations, and more through the Model Context Protocol, running locally via php artisan commands and filesystem scanning.6 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server that exposes Symfony profiler runtime data (requests, queries, logs) to AI agents like Claude Code for debugging and optimization.MIT