MCP
Timber integrates with Craft’s Model Context Protocol (MCP) server so an AI client can read your logs. For example, you can ask a connected client what has failed in the queue log since yesterday, and it can find the errors, read their stack traces and summarise them for you.
This integration requires Craft 5.12 or later. Timber still works on earlier supported Craft versions, but its MCP tools aren’t available there.
Connecting a Client
Follow Craft’s MCP setup instructions (opens new window) to connect a client through the authenticated HTTP server or the local mcp/serve command. Timber registers its tools automatically, so there’s no separate Timber server to install or enable. These tools aren’t exposed through Craft’s public MCP server.
Timber’s tools are read-only and only available to admins. An HTTP connection must be authorised with admin access, and a connection authorised for read-only or read and write access won’t see them. With mcp/serve, pass an admin account to the --user option. Clients can’t download, delete or clear logs, or change Timber’s settings.
The includedLogFiles and excludedLogFiles settings apply to clients as they do in the Logs utility, so an excluded log is hidden from them too. If the Logs utility is turned off with Craft’s disabledUtilities setting, Timber’s tools refuse to read logs.
Masked Values
Log entries can hold passwords, API keys, tokens and session cookies. Before an entry reaches the client, Timber replaces values like these with bullets (•). A value is masked when it’s stored under a name Craft treats as sensitive, such as one containing key, password, secret or token (Craft’s sensitiveKeywords), or under a request credential such as an Authorization header, a cookie or a session ID. Timber looks for these names in JSON, PHP array dumps, print_r() output, headers and name=value pairs such as query strings.
Timber also masks passwords in URLs, so mysql://craft:secret@db reaches the client as mysql://craft:••••••@db. The values of sensitive environment variables, the database password and Craft’s security key are masked wherever they appear in a message, including inside stack traces, as long as they’re at least six characters long. Shorter values would match ordinary words, so they’re only masked where a sensitive name appears beside them.
Masking works by recognising patterns in text, so it can’t catch everything. A secret logged without a recognisable name beside it, such as a token in the middle of a sentence, is still shown. Treat a connected client like any other person you’d give access to your logs. Searches only match the masked text, which means a client can’t search for a secret to confirm it appears in a log.
Reading Logs
| Tool | Purpose |
|---|---|
timber_logs_list | Lists the log files you can read, grouped by source, with each file’s ID, size, last-modified time and whether it’s compressed. Files are listed newest first. |
timber_logs_search | Searches and reads entries from one log file, or from a source’s most recently modified files. |
A source is the name Timber groups a log’s files under, such as web, console, queue or phperrors. It’s the same stem the permissions use, so the web source covers web-2026-11-30.log and web.log.1.gz as well as web.log. Files are named by their path within storage/logs, or by their file name when a plugin or module adds a log from somewhere else.
Pass either a file or a source to timber_logs_search. The file can be its name or its ID from timber_logs_list. With a source, Timber searches its 10 most recently modified files together. These are the other arguments:
| Argument | Description |
|---|---|
query | Text to find in entry messages, ignoring case. |
levels | Levels to include, such as error and warning, ignoring case. |
categories | Categories to include, such as application, ignoring case. End a category with * to match everything that starts with it, such as craft\*. |
from | The earliest entry time to include, such as 2026-11-30, 2026-11-30T14:00:00 or -24 hours. Times without an offset use Craft’s system time zone. |
to | The latest entry time to include. A date on its own includes the whole day. |
order | newest (the default) or oldest, for which entries come first. |
limit | How many entries to return, from 1 to 100. Defaults to 25. |
offset | How many matching entries to skip, such as the nextOffset from a previous search. |
messageLength | How many characters of each message to return, from 100 to 20,000. Defaults to 2,000. |
For example, these arguments find errors in the queue log from the last day:
{
"source": "queue",
"levels": ["error"],
"from": "-24 hours"
}Each entry in the result includes its file, date and time, level, category, channel and message. Messages are returned as plain text, as they were logged. The result also counts the entries at each level and in each category that match the file, date and text filters, ignoring the levels and categories filters, so the client can see what else is in the log. Up to 50 categories are counted, with the most common first. A date filter only matches entries with a date Timber can read, and with a source, a file last modified before from is skipped without reading it.
How Results Are Limited
A search returns at most limit entries, and stops early once the messages add up to about 100,000 characters, so a single response stays a manageable size for the client. When more entries match than were returned, truncated is true and nextOffset gives the offset for the next page. total is the number of matching entries in the files that were searched. A message longer than messageLength is cut short and marked with messageTruncated.
Timber reads large files the same way as the Logs utility. For a file bigger than the maxLogReadBytes setting, it only reads the newest part. The result’s files list shows each file that was searched, marking one that was only partly read as partial and one Timber couldn’t open as not readable. When a source has more than 10 files in range, the older ones are listed in filesNotSearched. Search those by name with file, or narrow the search with from.