Over two and a half years, a whole system grew around Tray: the storefront, the admin, the backend, the bot, and the payment and shipping integrations. It all worked, but I was the only one who held the full picture in my head, and bugs often showed up late — we'd hear about them from a customer or a manager. After I handed the business over, this mattered even more: I'm in another country, and the store has to run without me.
I wanted to tie everything into one system where AI sees the whole business context at once: the data, the code, and the logs. I also liked the idea of autonomous agents that don't wait to be asked and go after problems on their own. The ready-made tools like that aren't available in Europe, so I built my own on top of Claude. I wrote an MCP server — a bridge that lets Claude connect to Tray's infrastructure without my computer being on. It took one day, because I'd been laying the groundwork for something like this for a while.

What the agent can see and do
- Database: reads orders, customers, catalog, and finance through a separate read-only role.
- Code: every repo — storefront, admin, bot, task tracker — any branch and the full commit history.
- Server: process status and app logs.
- Fixes: commits to its own branches and opens a pull request that says what broke, what changed, and how to test it.
- Alerts: messages me on Telegram when something breaks or a PR is ready for review.
Safety
With this kind of access, the main question is what the agent can't break. I built the limits into the infrastructure, not into trust. The database is read-only. Code can only go to claude/* branches, the main branches are protected, and only I merge and deploy. The server only accepts requests from Anthropic's IP range with a secret key, tokens and passwords are stripped from logs, and every call is logged. To me, that's the right balance: the agent does the work, and I make the call. During review I decide whether a fix goes to dev first or, if it's minor, straight to prod.
On call
Every two hours from 8 a.m. to 10 p.m., the agent checks the store on its own: whether any process is down, whether there are new errors in the storefront, admin, or bot logs, whether order alerts and customer emails go out, and whether any payments or shipments are stuck. When it finds a problem, it digs in by itself: the error in the logs, the line in the code, the affected orders — and if the fix is clear, it opens a PR. Then it messages me on Telegram: what happened, whether customers are affected, the PR link, and what it needs from me. Every morning it sends a summary: yesterday's orders and revenue, open PRs, and what needs attention. I just read it, ask the agent for details if I need them — it has already looked into the problem — and merge.

Here's one example. The hourly ApiShip sync overwrote the shipping date with the current time on every run, so the dates in order cards and shipping-time metrics were wrong. The bug had been there for almost a month, and nobody noticed. The agent found it on its own, listed the affected orders and the exact line of code, fixed it, and pointed out that the PR doesn't repair dates that were already wrong — and where to restore them from.
Another case. On the night of October 11, ApiShip, the service the store uses to calculate shipping, stopped responding. As it turned out later, another air attack had caused an outage on Yandex's servers. There were no errors in the logs; requests simply hung. During its morning check, the agent noticed that shipping wasn't being calculated at checkout and that product pages were taking about a minute to load. It found the time of the last successful request, confirmed that the other external services were responding, and sent me a message: what broke, who it affects, and what to do. It attached a PR with timeouts right away: it doesn't fix the partner's outage, but the site stops hanging and the errors show up in the logs. By the start of the workday, I already knew about the problem and had a fix ready.

Results
In the first two days, the agent shipped 11 pull requests across four repos, and I haven't had to reject a single one yet. For example:
- the YooKassa receipt was off by a few kopecks with a discount and more than one item;
- the payment-canceled webhook crashed because of an invalid status;
- store pickup stayed selected after the customer changed their city at checkout;
- the ApiShip sync overwrote shipping and delivery dates;
- the bot's reports counted unpaid website orders.
Besides fixes, the agent built a whole feature: a "Complete your payment" email with a payment link and an edit-order page — from the database migration and the email template in the admin to new pages on the storefront. It even added the Telegram alerts to its own MCP server, also through a PR.
For me, this is the next step after building my own CMS. Writing a system isn't enough — it matters that keeping it running takes almost none of my time. The agent works like a developer under review: it spots the problem and does the work, but I make the call. The same approach works for any product built on its own code.


