Use with agents
Connect The New Debug Bar to your coding agent
Let Codex, Claude Code, Cursor, VS Code, or another local MCP client read the exact profile saved for each Laravel request.
-
Laravel app
Capture the local request you want the agent to investigate. -
Local MCP server
The coding client starts this app’s Artisan command and reads its saved profiles. -
Agent workflow
Use exact evidence to make a focused change and verify the same behavior.
Before you start
- Install The New Debug Bar in your Laravel app.
-
Make sure the app is in an allowed environment, which defaults to
local, and The New Debug Bar is enabled. It followsAPP_DEBUGunlessNEWDEBUGBAR_ENABLEDoverrides it. -
For manual setup, find the full path to the app's
artisanfile.
The examples use /absolute/path/to/your-app/artisan. Replace it with your real path.
The command must boot the same Laravel app and read the same profile storage as the process handling your requests. If the app runs in Sail, Docker, or another host, follow the local environment guide.
Codex
The optional plugin for The New Debug Bar is the simplest setup. It adds product guidance and starts the MCP server from the Laravel app you have open.
codex plugin marketplace add newdebugbar/newdebugbar
codex plugin add newdebugbar@newdebugbar
Open the Laravel app's root folder in Codex and start a new task. You do not need to publish The New Debug Bar config file.
If your Codex version does not provide the plugin commands, use the manual MCP setup below.
For manual setup, add a server that points to this app and then check it:
codex mcp add my-app-debug-bar -- php /absolute/path/to/your-app/artisan mcp:start newdebugbar
codex mcp list
Claude Code
Run this command from your project. Local scope keeps the server private to you and this app.
claude mcp add --scope local --transport stdio newdebugbar -- php /absolute/path/to/your-app/artisan mcp:start newdebugbar
Check it with claude mcp list.
Cursor
Create .cursor/mcp.json in your project:
{
"mcpServers": {
"newdebugbar": {
"command": "php",
"args": [
"/absolute/path/to/your-app/artisan",
"mcp:start",
"newdebugbar"
]
}
}
}
Save the file and restart Cursor. Check the server in Customize → MCPs.
VS Code
Create .vscode/mcp.json in your project:
{
"servers": {
"newdebugbar": {
"type": "stdio",
"command": "php",
"args": [
"/absolute/path/to/your-app/artisan",
"mcp:start",
"newdebugbar"
]
}
}
}
Run MCP: List Servers from the Command Palette to start the server or inspect its output.
Other MCP clients
Add a local stdio server with this command and these arguments. Your client may store this setting in a different file.
{
"command": "php",
"args": [
"/absolute/path/to/your-app/artisan",
"mcp:start",
"newdebugbar"
]
}
Check the connection
Your coding tool should show these five read-only tools:
-
list-debug-profiles -
get-debug-profile-inspector -
get-debug-profile-data -
inspect-debug-queries -
get-debug-findings
Make a request to your Laravel app, using a browser or an HTTP client. For a page you just visited, ask:
Debug one request with an agent
-
Identify the exact profile
Give the agent theX-NewDebugBar-Profileresponse-header value when possible. Otherwise, have it match method, path, status, request type, and recorded time from the recent list. -
Read findings first
Ask what happened, what deserves attention, why it matters, and which retained evidence supports that lead. -
Open one focused inspector
Use the symptom to choose Queries, Exceptions, Timeline, HTTP client, Livewire, Queue, or another small inspector instead of dumping the full profile. -
Follow deeper paths only when needed
Useget-debug-profile-datawith/inspectorsand returned JSON Pointer paths to reach retained evidence omitted from a concise response.
Profile an API without a browser
The New Debug Bar captures requests inside Laravel. The local MCP server reads those saved profiles, so it works with JSON APIs even when there is no page or visible toolbar. Install and enable the package in the app as usual; the API does not need a separate collector.
-
Send the API request
Use curl, Postman, a test, or your agent’s HTTP tools. Use the endpoint’s usual authentication and, where required, session cookies and CSRF token. -
Keep the response profile ID
ReadX-NewDebugBar-Profilefrom that response. The JSON body keeps its normal format, including validation and error responses. -
Inspect that profile through MCP
Start withget-debug-findings, then use a focused inspector orget-debug-profile-datafor the evidence you need. MCP reads the result; it does not call the endpoint.
curl -i -H 'Accept: application/json' http://your-app.test/api/trips
Replace the URL with an existing local endpoint. To have an agent compare requests, use a prompt such as:
Profile GET http://your-app.test/api/trips using an HTTP client and The New Debug Bar MCP server.
Keep the exact X-NewDebugBar-Profile ID from each response.
Compare repeated requests with the same inputs and authentication, separating cold and warm caches.
Report status, server duration, query count and time, and peak memory.
Inspect findings and the relevant queries, cache activity, or outgoing HTTP calls to explain the expensive work.
A browser is useful for reproducing a real click, fetch, or Livewire interaction. Each resulting HTTP request has its own profile. Fetching the initial HTML with curl does not run its JavaScript or trigger later updates. The request picker lets you inspect calls made by the page.
Troubleshooting
The server is missing
APP_DEBUG by default; an explicit NEWDEBUGBAR_ENABLED=true enables it even when debug mode is off, and NEWDEBUGBAR_ENABLED=false disables it.
The command cannot find PHP
php with the full path to your PHP program.
The wrong Laravel app opens
artisan file.
No profiles appear
The client only runs online
Continue from connection to a verified fix
Use Debug with an agent for a complete repeated-query investigation, including the code change and the check afterward. Use the MCP tool reference for exact inputs, paths, cursors, defaults, and errors.
For host PHP, Sail, Docker, and worker context, use Local environments. For startup errors or missing tools, use MCP troubleshooting.
Client documentation
The commands above start the same local stdio server. Client configuration and management details are documented by OpenAI, Claude Code, Cursor, and VS Code.