View Server Tools
The four tools of vue-codebase-view-mcp. Unlike the indexer, these have side effects: they start and stop real Vite dev servers inside the server process, so a browser can render the project's actual components.
The server announces only tools — no resources:
{ "tools": { "listChanged": true } }This is deliberate: the index content is already served by vue-codebase-mcp, and duplicating its resources would mean two sources of truth. Descriptions and parameter tables below are copied from a real tools/list; answers are copied from real calls against playground/ui-library (port 5299) and playground/monorepo (port 5298).
At a glance
| Tool | What it does | Required parameter |
|---|---|---|
preview_project | Starts (or reuses) a dev server for a project and returns its URL and mode | — |
preview_component | Deep link to one component's interactive stand, plus its API summary | component |
preview_status | Lists running servers — project, URL, port, uptime, index freshness, no side effects | — |
preview_stop | Stops one project's server or all of them, releasing ports | — |
Lifecycle of a session
The order matters: preview_status answers differently before and after a start. A real sequence:
{ "name": "preview_status", "arguments": {} }No preview servers are running. Call preview_project to start one.{ "name": "preview_project", "arguments": { "project": "ui-library", "port": 5299, "open": false, "mode": "gallery" } }Preview started for **ui-library** — 7 renderable
URL: http://localhost:5299/__vue-view__/
Mode: gallery
Index: built in full mode at 2026-11-20T17:12:45.270Z — 7 components, 2 composables, 0 stores, 0 routes, 3 utils, 10 documents
What to do next:
- Open http://localhost:5299/__vue-view__/ in a browser to see the gallery
- Call preview_component with a component name for an interactive stand
- Call preview_status to list running servers, preview_stop to shut them down{ "name": "preview_stop", "arguments": { "project": "ui-library" } }Stopped 1: ui-librarypreview_project
Starts a live Vite dev server against the target Vue project and returns its URL. The page really renders the project's components in a browser — no screenshots. Four modes: gallery (grid of every component), component (interactive stand with prop controls), api (dense props/emits/slots table) and graph (dependency graph). Reuses an already running server for the same project instead of starting a second one. The index is read from vue-codebase-mcp; run
index --mode fullfirst if component APIs look empty.
| Parameter | Type | Required | Limits | Description |
|---|---|---|---|---|
project | string | no | — | Workspace name from the configuration. Required when the configuration describes more than one project; omit for a single-project repository |
port | integer | no | 1–65535 | TCP port for the dev server. Omit to let Vite pick a free one |
host | string | no | — | Bind address, for example 127.0.0.1 or 0.0.0.0. Defaults to localhost |
open | boolean | no | — | Open the URL in the default browser. Leave false when running headless or over SSH |
mode | string | no | gallery|component|api|graph | Which view to open first: gallery, component, api or graph |
rebuild | boolean | no | — | Rebuild the index before starting (full type resolution). Slower, but picks up API changes |
Calling it again for a running project does not start a second server — it reuses the existing one and switches the mode:
{ "name": "preview_project", "arguments": { "project": "ui-library", "port": 5299, "open": false, "mode": "api" } }Preview for **ui-library** was already running — reusing it (7 renderable)
URL: http://localhost:5299/__vue-view__/
…Note what the answer does not contain: the printed URL has no #/api suffix even though the mode changed. To open a specific view, append the hash route yourself — http://localhost:5299/__vue-view__/#/api — or use preview_component, which prints a ready deep link. All four routes: View server → Modes.
Two numbers in the answer mean different things: 7 renderable is what this project's registry can draw, while the index line below describes the whole index. In playground/monorepo a preview of the ui-kit workspace reports 4 renderable over an index of 6 components, 1 composable, 1 store, 2 routes, 1 util — the index is shared by all workspaces, the live registry belongs to one.
preview_component
Starts (or reuses) the live preview server and returns a deep link straight to one component's interactive stand: live render, editable props, slots, emitted-event log, source and linked documentation. Also returns the component API summary so the caller can see props without opening the browser.
| Parameter | Type | Required | Limits | Description |
|---|---|---|---|---|
component | string | yes | ≥ 1 char | Component name as indexed, for example UiButton or AppHeader. Resolved fuzzily across projects |
project | string | no | — | Workspace name; narrows the lookup when several projects declare the same component name |
port | integer | no | 1–65535 | TCP port for the dev server. Omit to reuse the running one or let Vite pick a free port |
open | boolean | no | — | Open the deep link in the default browser |
{ "name": "preview_component", "arguments": { "component": "UiButton", "port": 5299, "open": false } }Component **UiButton** (ui-library)
Source: src/components/ui-button/ui/UiButton.vue (66 lines)
API resolved by: vue-component-meta
Базовая кнопка дизайн-системы: варианты, размеры, состояние загрузки.
Props (5 props)
- `variant`: Variant = "primary"
- `size`: Size = "m"
- `loading`: boolean = false
- `disabled`: boolean = false
- `type`: "button" | "submit" | "reset" = "button"
Events (1 event)
- `click`: (event: MouseEvent): void
Slots (2 slots)
- `default`
- `icon`
Documentation
- UiButton (`doc:component:ui-library:uibutton`)
Preview for **ui-library** was already running — reusing it (7 renderable)
URL: http://localhost:5299/__vue-view__/
Stand URL: http://localhost:5299/__vue-view__/#/component/UiButton
Index: built in full mode at 2026-11-20T17:12:45.270Z — 7 components, 2 composables, 0 stores, 0 routes, 3 utils, 10 documentsThe answer is two things at once: the API summary (readable without a browser) and the Stand URL — a deep link to the interactive stand. A typo produces suggestions:
[preview.entityNotFound] Component "UiButon" is not in the index. Did you mean: UiButton · component · ui-library, UiBadge · component · ui-library?preview_status
Lists the preview servers currently running in this process: project, URL, port, uptime, index freshness and how many components each one can render. Answers without side effects.
No parameters.
{ "name": "preview_status", "arguments": {} }Running preview servers: 1
- **ui-library** — http://localhost:5299/__vue-view__/ (port 5299, up 0s, opened in gallery)
index from 2026-11-20T17:12:45.270Z (full): 7 components, 2 composables, 0 stores, 0 routes, 3 utils, 10 documents"Running in this process" is literal: the registry belongs to the server instance the client spawned. A dev server started by hand with preview from a terminal is not in it — probe such a server with the CLI (vue-codebase-view-mcp status --port 5299), which reads the HTTP manifest instead of a registry.
preview_stop
Stops running preview servers and releases their ports. Pass a project name to stop only that one, or omit it to stop every server started by this process.
| Parameter | Type | Required | Description |
|---|---|---|---|
project | string | no | Workspace name to stop. Omit to stop all running preview servers |
Stopped 1: ui-libraryThree different outcomes depending on state:
| State | Answer |
|---|---|
| Nothing is running | Nothing to stop — no preview servers are running. (not an error) |
| The project name is not in the configuration | [preview.projectNotFound] with the list of available projects |
| Other projects run, but not this one | [preview.stopNotRunning] naming the ones that do run |
The third case is only reachable with more than one project — real output on playground/monorepo, where ui-kit was running and widget was not:
[preview.stopNotRunning] No running preview for "widget". Running: ui-kitStopping can take up to three seconds when Vite is mid-rebuild of its dependency cache: the port is released immediately and a warning is logged.
Diagnostics and exit codes
Tool answers carry codes: preview.projectNotFound, preview.projectRootMissing, preview.ambiguousProject, preview.entityNotFound, preview.noComponents, preview.portInUse, preview.portDenied, preview.vueMissing, preview.viteConfigMissing, preview.vuePluginInjected, preview.startFailed, preview.notRunning, preview.stopNotRunning, plus the index ones (index.empty, index.stale, index.snapshotMissing, config.noProjects). Real examples:
[preview.projectNotFound] Project "no-such-project" is not in the configuration. Available: ui-library
[preview.portDenied] Port 1 is not available for binding: listen EACCES: permission denied ::1:1 — pass a port above 1024 via `--port` (project "ui-library")
[preview.entityNotFound] Component "UiNoSuchComponent" is not in the indexpreview.vueMissing replaces Vite's bare Failed to resolve dependency: vue. Its text comes from the dictionary, with the project name substituted (<project> below is a placeholder, not a captured run):
[preview.vueMissing] Project "<project>" has no `vue` installed — its components will not compile. Install the dependency: `npm install vue`Argument validation happens in the MCP SDK before the handler, so it produces an English message without a code:
Input validation error: Invalid arguments for tool preview_component: component: Too small: expected string to have >=1 charactersThe preview CLI command has its own exit codes, described in --help:
| Code | Meaning |
|---|---|
0 | the server is running (stopped by Ctrl+C) |
1 | bad arguments or a fatal error |
2 | the project is unknown, its root does not exist, or none was selected in a monorepo |
3 | the index is empty — the server stops instead of serving an empty gallery |
4 | the port is unavailable: in use or requiring privileges |
The same things from a terminal
npx vue-codebase-view-mcp preview --root playground/ui-library --port 5299 --open[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.Probing a running preview from another terminal:
npx vue-codebase-view-mcp status --port 5299url: http://localhost:5299/__vue-view__/
project: ui-library
index: 2026-11-20T17:12:45.270Z (full)
version: 0.1.0
language: enstatus does not read a registry — it fetches /__vue-view__/api/manifest over HTTP, which is why it can describe a server started by somebody else. If nothing answers on that port, it prints No preview servers are running. Call preview_project to start one. instead of failing.
Limitations
- In a monorepo one server serves one workspace: the index (and therefore the API table and the graph) covers every project, but the live registry contains only the served workspace's components.
- stdio transport only — HTTP stays with the indexer (Deployment).
- The index must exist: run
vue-codebase-mcp index --mode fullfirst, otherwise prop controls and the API table will be nearly empty. - A component that cannot render in isolation (needs a router, a store, or props that cannot be guessed) shows an error inside its own card; the rest of the gallery keeps working. Compilation errors of modules outside cards — including the target project's
vite.config— are visible only in the server terminal.
Next
- View Server — the four interface modes, how the page is assembled, HTTP API and manifest
- Indexer tools — the ten tools that answer questions about the code
- Recipes — "show me this component in a browser" and six other tasks