---
id: 18795
lang: en
title: "The Agent Stopped Guessing About Vue Slowdowns: The vue-why-render MCP Server Shows the Causes"
published_at: "2026-12-01 08:25:28"
source_name: "Habr AI"
source_url: "https://habr.com/ru/articles/1111824/?utm_campaign=1111824&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/18795"
categories: ["llm", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# The Agent Stopped Guessing About Vue Slowdowns: The vue-why-render MCP Server Shows the Causes

> **Краткая суть (BLUF):** Ask an AI agent to speed up a Vue app and it will often suggest "wrap it in v-memo" at random. It can read the code, but it cannot see the running page. Version 0.9 of vue-why-render adds an MCP server, a channel through which an agent in Claude Code or Cursor can ask the open page which components re-render and why. In the sandbox, this surfaced ProductCard re-rendering 20 times because of a badge prop that gets rebuilt on every render. For performance work, give the agent measurements rather than guesses.  • Six tools: status, report, component, reset, baseline, diff • baseline and diff show the render count before and after a change • The server listens on localhost:7711, and page data is delivered inside a <page-data> block

Ask an AI agent to speed up a Vue app and it will produce a stock set of tips: "wrap it in v-memo", "replace it with shallowRef", "move it into a computed". Sometimes they hit the mark, more often they don't, and the agent has no way to check. It reads the code but cannot see the running page. Think of a mechanic who repairs a car from a photograph without being able to start the engine. The author of vue-why-render, a library that shows which Vue components re-render and what triggered the re-render, added an MCP server in version 0.9. MCP is the standard way to connect an external tool to an agent. Now an agent in Claude Code or Cursor can ask the page open in the browser what is re-rendering and why, and it gets the same report the developer sees in the panel.

## What the server does

vue-why-render already showed the cause of every render: a prop, a ref, a computed, a store field, or a route. In the previous article, the author used it to find 600 re-renders per minute behind a single number on the frontend of an esports platform. Now the agent gets the same report.

Setup takes three steps. In dev mode you enable the bridge: `app.use(VueWhyRender, { mcp: true })`, or in Nuxt `whyRender: { mcp: true }`. Then you register the server: for Claude Code with the command `claude mcp add vue-why-render -- npx -y vue-why-render-mcp`, and for Cursor by adding an entry to `.cursor/mcp.json`. Once the page is open, the agent has six tools: status (whether the app is connected, the page address, the Vue and package versions), report (components, render counts, causes, hints), component (details for a single component), reset (zero the counters), baseline, and diff.

An example from the repository sandbox: the author typed "Mon" into the filter and clicked "add to cart". The report showed 76 renders across 5 components. LiveClock rendered 35 times because of the clock, App rendered 20 times because of the tick counter, and ProductCard rendered 20 times because of the badge prop. The object passed as badge is new on every render, even though its contents stay the same. The hint says plainly that the object is apparently being built in the parent and should be moved to a constant or a computed. Instead of a vague "there are extra renders somewhere in the list", the agent gets a specific culprit and goes looking for where that object is created in the parent's template.

## The measure, fix, prove loop

The most useful part is not report but the pair baseline and diff. The agent calls baseline: the current report is stored and the counters are reset. Then you, or the agent through a browser tool, repeat the scenario: scrolling, typing, navigating. The agent edits the code, the page updates via HMR, the scenario runs again, and the diff call shows which components now render less often, which causes disappeared, and whether anything new appeared. That gives you a before-and-after number instead of "I optimized it, it should be faster". It reduces the risk of an "optimization" that changes nothing or breaks a neighboring component.

The agent cannot yet reproduce a scenario on its own, for example "scroll the feed 60 frames". That step requires pairing with the agent's browser tool. The author wants to close this gap and asks readers in the comments what was missing for those who have already tried agents on performance tasks.

## Security and a side finding

The report is built from the live page: component names, prop values, the address. Text from there could end up being read by the agent as an instruction, which is a classic prompt injection. For that reason the server wraps everything received from the page in a `<page-data>` block marked as data, not instructions. This lowers the risk but does not guarantee protection, so the bridge is best kept to development only.

The second limitation concerns access. The server listens on localhost:7711 and accepts connections only from pages served from localhost, 127.0.0.1, [::1] and *.localhost. If the app is opened via an address on the local network or through a tunnel, that address has to be added with the `--allow-origin` flag. Without this protection, any browser tab could read the reports and reset the counters.

Along the way the author ran into a regression. CI on pnpm and yarn failed on a router test, while the npm build stayed green: its lock file pinned vue-router 5.4, and the other package managers installed 5.5. In the new version, the page component reads the route through a computed inside RouterView, and when Vue 3.5 triggers a computed it reports neither what changed nor the old and new values. The cause "params.id: /p/1 → /p/42" turned into an unnamed computed. The author worked around the render dependencies, found the outdated computed that depends on currentRoute, and compared its old value with the new one. Because this reads Vue's internals, the workaround is wrapped in a try block and returns "unknown" on any failure rather than crashing the app. The author's own named computeds are still tracked under their names.

The lesson for library authors: run CI not only on npm with a lock file, but also on a fresh install with other package managers. That is what caught the problem before the 0.9 release.

## What else changed

The README grew to 757 lines, so the documentation moved to a separate site built with Astro and Starlight, with search and three languages: Russian, English and Chinese. It includes pages on MCP, render budgets in CI, checks in tests, and the VS Code extension. The main page keeps the live sandbox and a before-and-after timeline based on figures from the BIGPLAY case.

The practical takeaway is simple: if you hand an agent frontend performance tasks, give it a measurement tool. Then it can verify its own changes instead of repeating generic advice.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/articles/1111824/?utm_campaign=1111824&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18795
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
