# phpray [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/stephen1137/phpray  
**GitHub Stars:** 0  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/phpray

## Description
Ask an agent why a PHP site is slow: every request with its SQL, HTTP calls, errors and N+1.

## Tools
Capabilities this server exposes over MCP:

- **phpray_sites** — List the PHP sites this token can see, with requests, p95 latency and error rate. Start here: every other tool needs a site_id from this list.
- **phpray_overview** — Headline numbers for one site over a time window: requests, errors, p50/p95/p99 latency, database share and N+1 count. Use this before digging into anything else.
- **phpray_slow_pages** — The slowest URLs on a site, with request counts and p95, from the request timeseries. Answers "which page is slow".
- **phpray_slow_queries** — SQL fingerprints ordered by time spent, with call counts and the caller when known. Literals are already masked. Answers "which query is slow".
- **phpray_components** — Time attributed to each plugin, theme or vendor package on profiled requests. Answers "which plugin is slowing the site down". Empty when function profiling is off.
- **phpray_errors** — Requests that failed on a site: PHP errors and warnings with file and line where PHP raised one, plus 5xx responses that carry no PHP error. Pass an id to phpray_trace to see what one of them did.
- **phpray_traces** — Recent requests for a site. Filter with min_ms and status to find the bad ones, then pass an id to phpray_trace.
- **phpray_trace** — One request in full: wall time split into PHP, database and outbound HTTP, every query, every external call, errors, and the component breakdown when the request was profiled.
- **phpray_compare** — Two time ranges for one site side by side. Use it to check whether a deployment, a plugin update or a configuration change made things better or worse.
- **phpray_alerts** — Alerts currently firing across every site this token can see, worst overrun first.

## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "phpray": {
    "url": "https://phpray.dev/mcp"
  }
}
```

## Documentation

## What the phpray MCP server does

The phpray MCP server connects an MCP-compatible agent to PHPRay performance data. PHPRay records PHP request timing, CPU and memory use, SQL activity, outbound HTTP calls, errors, and N+1 patterns. The MCP interface lets an agent query that data to investigate which pages are slow, which SQL fingerprints consume time, which components contribute to a request, and when performance changed.

The server supports two data sources. Cloud mode reads sites available to a PHPRay console token. Local mode reads the collector on the same machine and does not require an account. A public HTTP endpoint provides read-only demo data from a recorded WooCommerce site, so the workflow can be tested without installing PHPRay or supplying credentials.

## How it works

The phpray MCP server is available as a streamable HTTP endpoint or as a local binary using stdio. For HTTP access, an agent connects to `https://phpray.dev/mcp`; authenticated requests include a console token in an Authorization header. The local binary can be installed for Linux or macOS on amd64 or arm64 and started by the MCP client.

Most operations are read-only. The available tools cover site listings, aggregate overviews, slow pages, slow SQL, component breakdowns, errors, trace searches, complete individual traces, before-and-after comparisons, and alerts. An additional `phpray_profile_url` tool enables per-function profiling for a URL prefix. That operation changes profiling state and is not exposed by the unauthenticated public demo.

## Setup and configuration

For the hosted demo, add the HTTP endpoint to an MCP client. The demo needs no token but only exposes ten read-only tools. To inspect your own cloud sites, provide the console token when configuring the HTTP connection.

For local use, download the platform-specific `phpray-mcp` binary, make it executable, and register it with the client as a stdio server. Running it without a token selects the collector on the local machine. Supplying `PHPRAY_TOKEN` scopes cloud access to the sites allowed by that console token.

The MCP server is useful only when PHPRay data is available at the selected source. Installing the MCP binary alone does not create request traces; a local deployment needs the PHPRay collector and PHP tracing setup on the machine being inspected.

## Tools and capabilities

The phpray MCP server supports investigation workflows such as:

- Listing monitored sites and reviewing aggregate performance.
- Finding slow pages and expensive SQL fingerprints.
- Examining plugin or component timing for sampled detailed requests.
- Reviewing errors and full request traces.
- Comparing performance before and after a change.
- Reading configured alerts.
- Enabling function-level profiling for a URL prefix when authenticated or running locally.

PHPRay records every request, while detailed per-function profiling is sampled by default. That distinction matters when an agent explains a single failing request versus a broader component-level pattern.

## Limitations and notes

The unauthenticated HTTP demo uses fixed, read-only demo data and does not expose the profiling-state tool. Cloud results depend on the sites permitted by the supplied console token. Local mode is limited to the collector accessible from the machine where the binary runs.

The project states that its repository code is Apache-2.0 licensed. The hosted PHPRay Cloud console is a separate paid, closed-code service; the local extension, collector, CLI, dashboard, panel plugins, and MCP binary are described as open source in the repository material.

_Full upstream README: https://allmcps.com/mcp/phpray/readme_

