Your AI agent reads the profile and names the slow function
Turn on Buggregator's MCP server, connect your AI agent to it, and send one XHProf profile of the slow request. Then ask «what is slow in the last profile?». The agent calls profiler_summary, profiler_top and profiler_call_graph, and answers with the function that takes the time and the path that leads to it.
Steps
1. Turn MCP on
MCP is off by default. In Docker, use the HTTP transport on port 8001.
services:
buggregator:
image: ghcr.io/buggregator/server:latest
ports:
- 127.0.0.1:8000:8000
- 127.0.0.1:8001:8001 # MCP HTTP port
environment:
MCP_ENABLED: "true"
MCP_TRANSPORT: http
MCP_ADDR: ":8001"2. Connect your agent
In Cursor, add the server to .cursor/mcp.json:
{
"mcpServers": {
"buggregator": {
"url": "http://localhost:8001/mcp"
}
}
}In Claude Code, one command does it:
claude mcp add --transport http buggregator http://localhost:8001/mcp3. Send a profile
Install the XHProf extension and a profiler package. For Laravel, composer require --dev maantje/xhprof-buggregator-laravel, then turn it on in .env:
XHPROF_ENABLED=true
PROFILER_ENDPOINT=http://127.0.0.1:8000/api/profiler/storeLoad the slow page once. Turn profiling off afterwards: it slows every request down.
4. Ask in plain words
The agent picks the tools itself. For example:
"Which function is slowest in the last profile?"
"What uses the most memory in that request?"
"Show the call path to the slowest function"Why it works
events_list with type profiler finds the profile. profiler_summary gives the totals plus the slowest function, the biggest memory user and the most called one. profiler_top ranks functions by CPU, wall time, memory or calls, inclusive or exclusive. profiler_call_graph returns only the significant call paths, so the agent can say why a function is slow, not only which one.
Docs: docs.buggregator.dev/config/mcp.html#profiler
Requires Buggregator v2.6.0+
Related tips
- MCP
Cursor reads the exception you just hit
Connect Cursor to Buggregator over MCP. It reads the stack trace, dumps and profiles your app sent, straight from your local Buggregator.
- MCP
Claude Code reads your app's errors over MCP
Add Buggregator as an MCP server in Claude Code. It lists your Sentry errors, opens stack traces and reads dumps and profiles. No copy-paste.
- Profiler
Find the slow function in a Laravel page
Install XHProf and one Laravel package, point it at Buggregator, and read the flamechart and top functions of every request.
Checked on with Buggregator v2.13.0