Skip to main content
Glama
clockwork-mcp-remote

clockwork-mcp-remote

by ahmedbally

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:

  1. connect_clockwork with { baseUrl, username?, password? } verifies the API and caches the authenticated session

  2. All other tools accept the same parameters — or reuse an existing connection

  3. 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

CLOCKWORK_BASE_URL

Default application URL (enables the HTTP driver)

CLOCKWORK_AUTH_USERNAME

Default authentication username

CLOCKWORK_AUTH_PASSWORD

Default authentication password

CLOCKWORK_AUTH_TOKEN

Pre-authenticated X-Clockwork-Auth token

CLOCKWORK_STORAGE_DRIVER

Force driver: http, artisan, or file

CLOCKWORK_PROJECT_PATH

Laravel project root (local drivers)

CLOCKWORK_STORAGE_PATH

Direct Clockwork storage path (file driver)

CLOCKWORK_PHP_PATH

Custom PHP binary path (artisan driver)

CLOCKWORK_HTTP_TIMEOUT

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/clockwork

For 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_clockwork

Connect to any Clockwork URL — verifies API + auth, caches the session

Request discovery

Tool

Description

list_requests

List recent requests with filtering (type, status, URI, method, time range)

get_request

Full details of a request by ID

get_latest_request

Most recent request

search_requests

Search by controller, URI, status, or duration

Database

Tool

Description

get_queries

Queries for a request, with optional slow-query filter

analyze_slow_queries

Slow queries grouped by normalized SQL pattern across requests

detect_n_plus_one

N+1 pattern detection across requests

get_query_stats

Aggregate query statistics (counts, durations, type breakdown)

Performance

Tool

Description

get_performance_summary

Response time, memory, queries, cache ratio

get_timeline

Execution timeline events

compare_requests

Side-by-side comparison of two requests

Cache & Redis

Tool

Description

get_cache_operations

Cache hits, misses, writes, deletes

get_cache_stats

Hit ratio and totals

get_redis_commands

Redis commands executed

Application context

Tool

Description

get_logs

Log entries with level filtering

get_events

Dispatched events and listeners

get_views

Rendered views

get_http_requests

Outgoing HTTP requests

get_auth_user

Authenticated user for a request

get_session_data

Session data

get_middleware_chain

Middleware chain

get_route_details

Route details

Traces & execution flow

Tool

Description

get_call_graph

Hierarchical execution tree from timeline events

get_query_stack_trace

Source location for a query

get_log_stack_trace

Source location for a log entry

Multi-request analysis

Tool

Description

analyze_exceptions

Group exceptions by message pattern

analyze_route_performance

Route performance with percentiles (p50/p95/p99)

detect_memory_issues

High memory usage and growth patterns

Commands, queues & tests

Tool

Description

list_commands / get_command

Profiled artisan command executions

list_queue_jobs / get_queue_job

Queue job executions

list_tests / get_test

Test executions

Utility

Tool

Description

get_clockwork_status

Storage status and statistics

explain_request_flow

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      # eslint

Requirements

  • Node.js 18+

  • A Laravel application with itsgoingd/clockwork installed

  • Any MCP client (OpenCode, Claude Code, Cursor, etc.)

License

MIT

Available Tools

39 tools
analyze_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

    B3.2/5.0

    Scored across 39 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count2/5

    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.

    Completeness4/5

    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

    Related MCP Servers