Skip to content

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 ​

ModeRouteWhat it shows
Gallery#/galleryA 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:

text
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/UiButton
bash
npx vue-codebase-view-mcp preview --root playground/ui-library --port 5299 --open
json
{ "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:

text
Preview started for **ui-library** — 7 renderable
URL: http://localhost:5299/__vue-view__/
Mode: gallery

Component stand ​

bash
npx vue-codebase-view-mcp preview --root playground/ui-library --component UiButton --open
json
{ "name": "preview_component", "arguments": { "component": "UiButton", "port": 5299, "open": false } }

--component implies --mode component, and the tool prints a ready deep link:

text
Stand URL: http://localhost:5299/__vue-view__/#/component/UiButton

Controls 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 ​

json
{ "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 ​

json
{ "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 ​

  1. createViewContext wraps the indexer's createContext: configuration, index snapshot and language come from vue-codebase-mcp.
  2. PreviewManager runs one Vite dev server per project in-process, reuses a running server, and deduplicates parallel starts.
  3. The server reads the target project's vite.config (loadConfigFromFile), injects @vitejs/plugin-vue when the project does not register it, and extends server.fs.allow with the project root and the package directory.
  4. A virtual module (virtual:vue-codebase-view-registry) provides lazy import() loaders for the project's components; a JSON API under /__vue-view__/api/* serves the manifest, entities, graph, docs and sources.
  5. The page is rendered by middleware and loads the interface entry from the package's src/ui/main.ts through /@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 ships src/ui as source, plus the two modules the interface imports from outside it, src/contract.ts and src/i18n/template.ts; dist/ui intentionally does not exist). A test walks the import graph of src/ui/main.ts and fails when a module the interface needs is missing from files: inside the repository the full src is always next door, so such a file goes missing only in an installed package — the page then stays on the spinner while Vite answers 500 Failed to resolve import for every module of the interface.

HTTP API and the manifest ​

Everything the interface draws comes from five JSON endpoints under /__vue-view__/api/:

EndpointReturns
GET /api/manifestProject, index summary, capabilities, modes, and the whole localized UI dictionary
GET /api/entitiesEvery 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>[&section=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):

json
{
  "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:

  • project carries only the name — no absolute path of the host;

  • index.mode tells 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:

    text
    No index snapshot found; built a light index instead. Props resolved from types require `index --mode full`
  • capabilities.source mirrors resources.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:

StatusCodeWhen
403api.sourceForbiddenresources.exposeSourceCode: false
404api.sourceNotFoundno entity with that id
404api.docNotFoundno document with that id
404api.unknownRouteany other /api/* path
500api.sourceUnreadablethe file is known but cannot be read
500api.manifestInvalidthe manifest failed validation
500api.internalErroran unhandled exception

Real responses:

text
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 ​

bash
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
CommandPurpose
previewStart the dev server and print its URL (foreground). Default command
statusProbe a running preview by port and print its manifest
serveRun as an MCP server over stdio
version / helpVersion and help

Real preview output:

text
[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:

text
url:      http://localhost:5299/__vue-view__/
project:  ui-library
index:    2026-11-20T17:12:45.270Z (full)
version:  0.1.0
language: en

Exit 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:

EntryHint (real string)
GalleryEvery indexed component, rendered live
ComponentInteractive stand for one component
API TableDense sortable table of props, emits, slots and exposed members
GraphDependencies 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.

StateWhat the page shows (real strings)
The manifest did not arrive or is malformedCould not load the index from the preview server / The preview server sent a malformed manifest, with a Retry button
Rendering failedThe 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 usualLoading 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.config do not resolve on this server.
  • preview_stop can 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 full first, 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 restart preview or pass --rebuild.

Security ​

  • The dev server binds localhost by 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.0 makes 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.allow is 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 — project holds only its name.

MIT Licensed