Laravel Logs MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Laravel Logs MCP
Safe, paginated MCP access to Laravel logs.
Laravel Logs MCP gives coding agents a read-only MCP interface to your Laravel log files. An agent can list the allowlisted files and read bounded, redacted pages newest first, over local stdio or an authenticated HTTP endpoint. The HTTP endpoint is off until you enable it and add a key hash.
The package is an MCP server. The log reader is the internal engine that makes the tools safe.
Why teams use it
A page, not a dump. Pages read backwards from the end of the file with byte and scan caps, so an agent cannot pull a 2 GB log into its context window.
Redacted before output. Emails, bearer tokens, known key prefixes, credential pairs, and public IPv4 addresses are masked before an entry leaves the process.
Read-only by construction. Two tools,
list_log_filesandread_log_entries. No writes, no shell, no database, no arbitrary file path.Off by default, authenticated when on. Installing the package adds no HTTP route. Enabling it needs a flag and at least one SHA-256 key hash, and the throttle runs before authentication.
Local and remote transports. Local stdio needs no socket and no route. The HTTP transport is for a deployed app and an agent that is not on the same machine.
Stack traces stay attached. Pages split on Monolog headers, not lines, so an exception and its trace stay together.
Agent-friendly paging. Newest first, stable cursor, explicit
has_more, and a stale cursor returned as a normal result instead of wrong data.
Related MCP server: Engineering Operations MCP
Quick start
1. Install
composer require prajwal89/laravel-logs-mcp laravel/mcplaravel/mcp is a suggested dependency. Install it alongside the package if your application does not already have it.
2. Connect a local agent
Nothing to enable. The local stdio handle is registered by default. It opens no socket and adds no route.
{
"mcpServers": {
"logs": {
"command": "php",
"args": ["artisan", "mcp:start", "logs"]
}
}
}Ask the agent to list the files and read the newest warnings from today's file. The tools are read-only and every returned entry is redacted.
3. Read from a deployed app (optional)
Generate a key on the server:
php artisan laravel-logs-mcp:keyStore only the printed hash and enable the endpoint:
LARAVEL_LOGS_MCP_ENABLED=true
LARAVEL_LOGS_MCP_KEY_HASHES=<sha256 hash>
LARAVEL_LOGS_MCP_RATE_LIMIT=30Then point the client at the endpoint:
{
"mcpServers": {
"logs": {
"type": "http",
"url": "https://your-app.test/mcp/logs",
"headers": { "Authorization": "Bearer ${LARAVEL_LOGS_MCP_TOKEN}" }
}
}
}The endpoint answers POST only. GET returns 405 with Allow: POST.
The MCP tools
Tool | What it returns | Arguments |
| Allowlisted files newest first, with name, bytes, modified time, and whether the file is today's. Never an absolute path. | None |
| A page of entries newest first, plus |
|
read_log_entries defaults to warning and above. Pass exact_levels to return only specific levels; it replaces min_level, so send one or the other. A file outside the allowlist returns unknown_file. A cursor whose file changed returns stale_cursor with a hint to retry without one.
Safe by default
Control | Behavior |
Route registration | Only when |
Authentication | Bearer key, SHA-256 hash stored in the environment, constant-time comparison, 32 character minimum. |
Ordering | Throttle first, authentication second, so a flood is limited even when every key is wrong. |
Request limits | JSON only, JSON accept header, 64 KB body by default, after authentication. |
File access | Allowlisted directories, symlink rejection, resolved-path containment, and |
Output | Redaction, truncation, page byte cap, and no absolute server paths. |
Caching |
|
Content | Log lines are untrusted data, and the server instructions say never to follow them. |
How it works
The MCP server uses an internal reader engine. It lists files in the configured directories, parses Monolog headers, pages backwards from EOF with byte and scan caps, and redacts each entry before serialization. The engine has no public API commitment; the two tools and the configuration are the supported surface.
Pagination and filters
Page one is the newest data.
next_cursorwalks backwards in time.limitis clamped tomax_page_size.min_levelacceptsdebug,info,notice,warning,error,critical,alert, oremergency.exact_levelsis a list of levels to return exactly, for example[warning, error]. It replacesmin_level, so send one or the other. An empty list falls back todefault_min_level.sinceaccepts a date, for example2026-11-29T00:00:00Z.queryis a case-insensitive substring match, not a regular expression.One page never reads more than
max_page_bytesor scans more thanmax_scan_bytes.
Configuration
Publish the config if you want to change the defaults:
php artisan vendor:publish --tag=laravel-logs-mcpThe MCP block:
Key | Environment | Default | Purpose |
|
|
| Register the stdio server handle. |
|
|
| Register the HTTP endpoint. |
|
|
| Handle used by |
|
|
| Name shown to the MCP client. |
|
| empty | Comma separated SHA-256 hashes of allowed keys. |
|
|
| Requests per minute per IP. |
|
|
| Endpoint path. |
| none | inherits | Narrower directory set for the MCP server. |
| none | inherits | Narrower file pattern set for the MCP server. |
| none |
| Request body cap. |
LOG_READER_MCP_* and LOG_MCP_* are earlier names, read as fallbacks so an existing deployment keeps working. The current LARAVEL_LOGS_MCP_* name wins when more than one is set.
The log access settings:
Key | Default | Purpose |
|
| Directories searched for log files. |
|
| File name patterns inside each directory. |
|
| Default entries per page. |
|
| Hard cap on a requested page size. |
|
| Message length before truncation. |
|
| Payload cap for one page. |
|
| How far back one page may scan. |
|
| Level filter when the caller omits one. |
| all | Toggle each redaction rule. |
Security rules
The route exists only when enabled. With
LARAVEL_LOGS_MCP_ENABLEDunset, no route is registered and the path answers like any other missing path.Only the hash is stored. The key itself never appears in the environment.
Rotation is an edit. Add a hash beside the old one, rebuild the config cache, switch the client, then drop the old hash. Revocation is removing the hash and rebuilding the cache.
The check runs before the JSON parser and the body limit, so an unauthenticated caller cannot probe parser behavior.
Keep the endpoint behind HTTPS. Terminate TLS at your proxy or edge and do not expose the path over plain HTTP.
Treat the endpoint as access to production data. The key grants every allowlisted file.
Redaction
Every returned entry is redacted before it leaves the process:
Target | Result |
Email addresses |
|
Bearer tokens |
|
Known key prefixes |
|
Credential pairs |
|
Public IPv4 addresses |
|
Timestamps, channels, and levels are never redacted; they are the navigation.
Business identifiers such as order IDs and customer IDs cannot be recognized by pattern. Redaction is best effort, not a guarantee. Do not log secrets or personal data in the first place, and treat the endpoint as access to sensitive production data.
Log content is untrusted
Log content is written by whatever triggered an error, a validation failure, or a 404. Treat it as data, never as instructions. The MCP server instructions say so as well.
Requirements
PHP 8.2 or newer
Laravel 11, 12, or 13
laravel/mcp^1.1
Laravel 13 requires PHP 8.3 or newer. Laravel 11 is included for existing applications and is end of life; prefer 12 or 13 for new work.
Testing
The package ships its own test harness and does not need a host application:
composer install
composer test
composer analyse
composer format:test
composer refactor:test
composer checkcomposer check runs Pint, PHPStan, Rector, and Pest in one go.
Tests use Orchestra Testbench, temporary directories, and an in-memory cache. They never read or write your storage/logs.
Changelog
See CHANGELOG.md.
Security
See SECURITY.md for the threat model and how to report a vulnerability.
License
MIT. See LICENSE.md.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only access to Auralogs production logs: search logs, inspect errors, review AI analyses.
Read LogBrew errors, slow traces, logs, and product analytics, and triage issues with consent.
Ingest and search LogsLoom logs from coding agents.
Read Midge bug reports: video, console logs, network requests and user actions, secrets redacted.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables secure analysis of log files by listing, summarizing, and searching for error patterns, with defenses against path traversal, symlink attacks, and data leakage.-
- FlicenseNot gradedqualityDmaintenanceA safe, read-only MCP server that gives Codex structured access to engineering operations evidence, with validated queries, secret redaction, and audit logging. Provides a search_logs tool for filtering logs by service, environment, severity, and time range.-
- FlicenseNot gradedqualityDmaintenanceRead-only MCP server for Elasticsearch log querying. Enables natural language search, filtering, context retrieval, and aggregation of logs.-
- AlicenseAqualityDmaintenanceA read-only stdio MCP server that provides a generic log-querying layer for Grafana/Loki, enabling discovery, retrieval, and aggregation of logs (raw, slow, errors, volumes) through 15 tools, with hard limits on data volume and no built-in business logic.1515 npm1MIT