View Server
vue-codebase-view-mcp opens an indexed Vue 3 project in a browser. It starts a real Vite dev server against the target project — components are rendered by the browser, not screenshotted — under the prefix /__vue-view__. The project's own app (if it has one) keeps working at /.
The four tools that drive it are described separately: View server tools.
The four modes
| Mode | Route | What it shows |
|---|---|---|
| Gallery | #/gallery | A grid of every indexed component, each rendered live (lazily, as cards scroll into view), with filters by text, project and category |
| Component | #/component/<Name> | Interactive stand: live render, prop controls, editable slots, emitted-event log, source and linked documentation, usedBy/imports relations |
| API Table | #/api/<Name?> | Flat sortable table of props/events/slots/exposed across all projects, with filters, grouping and Excel-safe CSV export |
| Graph | #/graph/<Name?> | Dependency graph in pure inline SVG: deterministic ring layout, focus + depth 1–4, “neighbours only”, pan/zoom, keyboard-accessible nodes |
Routing is hash-based and runs without vue-router: the target project may not have it, and the server serves one page. Any mode is reachable three ways — by URL, by a tool call, or by a CLI flag:
http://localhost:5299/__vue-view__/#/gallery
http://localhost:5299/__vue-view__/#/component/UiButton
http://localhost:5299/__vue-view__/#/api/UiButton
http://localhost:5299/__vue-view__/#/graph/UiButtonGallery
npx vue-codebase-view-mcp preview --root playground/ui-library --port 5299 --open{ "name": "preview_project", "arguments": { "project": "ui-library", "port": 5299, "mode": "gallery", "open": false } }The default mode. Every card is the real component compiled by the project's own Vite pipeline; a component that cannot render in isolation shows its error inside its own card and the rest of the gallery keeps working. The tool answer reports how many components are renderable:
Preview started for **ui-library** — 7 renderable
URL: http://localhost:5299/__vue-view__/
Mode: galleryComponent stand
npx vue-codebase-view-mcp preview --root playground/ui-library --component UiButton --open{ "name": "preview_component", "arguments": { "component": "UiButton", "port": 5299, "open": false } }--component implies --mode component, and the tool prints a ready deep link:
Stand URL: http://localhost:5299/__vue-view__/#/component/UiButtonControls are generated from the resolved prop types (checkbox, number, select, text), slots are editable, and every emitted event is logged — which is how you check that @click really fires with a MouseEvent.
API table
{ "name": "preview_project", "arguments": { "project": "ui-library", "port": 5299, "mode": "api" } }then open http://localhost:5299/__vue-view__/#/api. Note that a repeated preview_project on a running server reuses it and switches the mode, but the URL it prints has no #/api suffix — append the hash yourself, or call preview_component for a ready link. The table covers every project in the index, exports to CSV, and is the fastest way to audit naming across a design system.
Graph
{ "name": "preview_project", "arguments": { "project": "ui-library", "port": 5299, "mode": "graph" } }then open http://localhost:5299/__vue-view__/#/graph/UiButton. The same graph is available to the assistant as get_knowledge_graph with format: "json"; the browser draws it from /__vue-view__/api/graph.
How it works
createViewContextwraps the indexer'screateContext: configuration, index snapshot and language come fromvue-codebase-mcp.PreviewManagerruns one Vite dev server per project in-process, reuses a running server, and deduplicates parallel starts.- The server reads the target project's
vite.config(loadConfigFromFile), injects@vitejs/plugin-vuewhen the project does not register it, and extendsserver.fs.allowwith the project root and the package directory. - A virtual module (
virtual:vue-codebase-view-registry) provides lazyimport()loaders for the project's components; a JSON API under/__vue-view__/api/*serves the manifest, entities, graph, docs and sources. - The page is rendered by middleware and loads the interface entry from the package's
src/ui/main.tsthrough/@fs/. The target project's Vite compiles the UI — that is what keeps a single Vue instance shared by the interface and the rendered components (the package shipssrc/uias source, plus the two modules the interface imports from outside it,src/contract.tsandsrc/i18n/template.ts;dist/uiintentionally does not exist). A test walks the import graph ofsrc/ui/main.tsand fails when a module the interface needs is missing fromfiles: inside the repository the fullsrcis always next door, so such a file goes missing only in an installed package — the page then stays on the spinner while Vite answers500 Failed to resolve importfor every module of the interface.
HTTP API and the manifest
Everything the interface draws comes from five JSON endpoints under /__vue-view__/api/:
| Endpoint | Returns |
|---|---|
GET /api/manifest | Project, index summary, capabilities, modes, and the whole localized UI dictionary |
GET /api/entities | Every renderable entity with its resolved API |
GET /api/graph[?id=&depth=] | The relation graph, or only the neighbours of id at depth |
GET /api/doc?id=<docId> | One markdown document |
GET /api/source?id=<id>[§ion=all|script|template|style] | The source of an entity |
A real manifest (playground/ui-library, abridged — the strings object holds the whole localized interface dictionary and is ~3.7 KB on its own):
{
"package": { "name": "vue-codebase-view-mcp", "version": "0.1.0" },
"language": "en",
"project": { "name": "ui-library" },
"index": {
"generatedAt": "2026-11-20T17:12:45.270Z",
"mode": "full",
"counts": { "components": 7, "composables": 2, "stores": 0, "routes": 0, "utils": 3, "docs": 10 },
"stale": 0,
"snapshot": true
},
"capabilities": { "source": true, "internal": false },
"modes": ["gallery", "component", "api", "graph"],
"strings": {
"app": {
"name": "Vue Codebase View",
"tagline": "Live preview of an indexed Vue project",
"loading": "Loading index…",
"loadError": "Could not load the index from the preview server",
"retry": "Retry"
},
"nav": { "…": "…" },
"common": { "…": "…" },
"gallery": { "…": "…" },
"component": { "…": "…" },
"api": { "…": "…" },
"graph": { "…": "…" }
},
"warnings": []
}Points worth knowing:
projectcarries only the name — no absolute path of the host;index.modetells the truth: a server started without a snapshot reports"light"and"snapshot": false, and the CLI prints a warning with the command that fixes it:textNo index snapshot found; built a light index instead. Props resolved from types require `index --mode full`capabilities.sourcemirrorsresources.exposeSourceCode, so the interface hides the source panel instead of showing an empty one;the manifest is validated on the server before it is sent and again in the browser: a malformed one becomes
500 [api.manifestInvalid]rather than a blank page.
Errors are JSON with a localized message and a stable code:
| Status | Code | When |
|---|---|---|
403 | api.sourceForbidden | resources.exposeSourceCode: false |
404 | api.sourceNotFound | no entity with that id |
404 | api.docNotFound | no document with that id |
404 | api.unknownRoute | any other /api/* path |
500 | api.sourceUnreadable | the file is known but cannot be read |
500 | api.manifestInvalid | the manifest failed validation |
500 | api.internalError | an unhandled exception |
Real responses:
GET /__vue-view__/api/source?id=missing → 404
{"error":"Entity \"missing\" is not in the index","code":"api.sourceNotFound"}
GET /__vue-view__/api/nope → 404
{"error":"Unknown API route: nope","code":"api.unknownRoute"}
GET /__vue-view__/api/source?id=component:ui-library:uibutton (exposeSourceCode: false) → 403
{"error":"Source code is disabled in the configuration (resources.exposeSourceCode: false)","code":"api.sourceForbidden"}When a component fails to compile, the error is shown in its own card; failures in modules outside the cards — including the target project's vite.config — appear only in the server terminal. Intercepting Vite's overlay was a deliberate non-goal.
CLI
npx vue-codebase-view-mcp preview --root /path/to/project [--project <name>] [--port <port>]
[--mode gallery|component|api|graph] [--component <Name>]
[--open|--no-open] [--rebuild] [--lang ru|en] [--log-level <level>]
npx vue-codebase-view-mcp status --port 5299
npx vue-codebase-view-mcp serve --root /path/to/project| Command | Purpose |
|---|---|
preview | Start the dev server and print its URL (foreground). Default command |
status | Probe a running preview by port and print its manifest |
serve | Run as an MCP server over stdio |
version / help | Version and help |
Real preview output:
[vue-codebase-mcp] info: Loaded index snapshot from 2026-11-21T17:47:58.839Z: 12 entities, 10 documents
[vue-codebase-view-mcp] info: Starting preview for ui-library (<repo>/playground/ui-library)
[vue-codebase-view-mcp] info: Preview for ui-library is ready at http://localhost:5299/__vue-view__/ in 32 ms
Preview for ui-library is running at http://localhost:5299/__vue-view__/
Press Ctrl+C to stop the server.status reads the HTTP manifest, so it also describes a server started by somebody else:
url: http://localhost:5299/__vue-view__/
project: ui-library
index: 2026-11-20T17:12:45.270Z (full)
version: 0.1.0
language: enExit codes of preview (also printed by --help): 0 running, 1 bad arguments or a fatal error, 2 unknown project, missing root or no project selected in a monorepo, 3 empty index — the server stops instead of serving an empty gallery, 4 port unavailable (in use, or below 1024 without privileges).
What the user sees, and what happens on failure
The four navigation entries, with their own hints from a real manifest:
| Entry | Hint (real string) |
|---|---|
| Gallery | Every indexed component, rendered live |
| Component | Interactive stand for one component |
| API Table | Dense sortable table of props, emits, slots and exposed members |
| Graph | Dependencies between components, composables, stores, routes and docs |
The interface never hangs on an endless spinner: all strings arrive pre-rendered in the manifest, and three failure states are covered.
| State | What the page shows (real strings) |
|---|---|
| The manifest did not arrive or is malformed | Could not load the index from the preview server / The preview server sent a malformed manifest, with a Retry button |
| Rendering failed | The interface could not be rendered, the hint Reload the page. If it happens again, check the preview server log, a Stack trace disclosure and a Reload page button |
| Loading takes longer than usual | Loading is taking longer than usual plus Check that the index is built (index --mode full), that the port is the right one and that the preview server log has no errors |
A component that fails to compile reports it inside its own card, so one broken component does not take the gallery down; failures outside the cards are visible only in the server terminal.
Limitations
- In a monorepo, one server serves one workspace: the API table and the graph show every project (the index is shared), but the live registry contains only the served workspace's components — aliases from a foreign
vite.configdo not resolve on this server. preview_stopcan take up to 3 seconds when Vite is mid-rebuild of its dependency cache; the port is released immediately and a warning is logged.- stdio transport only — HTTP stays with the indexer (Deployment).
- The index must exist: run
vue-codebase-mcp index --mode fullfirst, otherwise the API table and prop controls will be nearly empty. - The server does not refresh the index while it runs: the view server never starts the indexer's file watcher — that one runs in the indexer's own
serve— so after editing components restartpreviewor pass--rebuild.
Security
- The dev server binds
localhostby default and serves sources of the target project and of the package — do not expose it to a network you do not trust (--host 0.0.0.0makes it public). There is no authentication: put an authenticating proxy in front of it, or use an SSH tunnel — Deployment → Preview on a remote host. server.fs.allowis set explicitly; files outside are refused by Vite with 403.- Source exposure follows
resources.exposeSourceCode; the indexer's path guards apply to every API endpoint. - The manifest and the API carry no absolute paths of the host —
projectholds only its name.