feat: port CLI, TUI, and launcher from v1.5 into v2 (#1452)

Ports the CLI, TUI, and launcher from v1.5 into v2 behind a single
`mcp-inspector` entrypoint (launcher → web/cli/tui). Includes the
`mcp-inspector --web --dev` launcher fix (Vite alias resolution + prod-server
double-start), the root `postinstall` install cascade with simplified CI, and
spec/AGENTS docs (no-workspaces rationale, Development setup).

Closes #1246.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bob Dickinson 2026-06-14 17:27:49 -07:00 • committed by GitHub
commit 2488ca5e38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,7 @@ import react from "@vitejs/plugin-react";
import type { WebServerConfig } from "./web-server-config.js";
import { honoMiddlewarePlugin } from "./vite-hono-plugin.js";
import { getViteBaseConfig } from "./vite-base-config.js";
import { vitestSharedPaths } from "../../../vitest.shared.mts";
import type { WebServerHandle } from "./types.js";
export type { WebServerHandle };
@ -27,13 +28,37 @@ export async function startViteDevServer(
// Canonicalize so Vite's config hash is stable and matches the deps cache.
const root = resolve(join(__dirname, ".."));
const baseConfig = getViteBaseConfig();
// `configFile: false` means this in-process server never loads
// `vite.config.ts`, so it must reproduce that file's `resolve` block and
// `server.fs.allow` here. Without them, App.tsx's `@inspector/core/*`
// imports fail to resolve and the page 500s (#1452 smoke test). The aliases
// and dedupe are factored into `vitest.shared.mts` so both paths stay in
// sync — pass the client dir (`root`) so bare-module pins resolve against
// `clients/web/node_modules`.
const { repoRoot, sharedAliases, sharedDedupe, nodeModulesAliases } =
vitestSharedPaths(root);
const inlineConfig: InlineConfig = {
...baseConfig,
configFile: false,
root,
resolve: {
alias: [
...Object.entries(sharedAliases).map(([find, replacement]) => ({
find,
replacement,
})),
...nodeModulesAliases,
],
dedupe: sharedDedupe,
},
server: {
port: config.port,
host: config.hostname,
// Allow Vite to serve source files from the repo root (core/ lives
// outside clients/web), matching `vite.config.ts`'s `server.fs.allow`.
fs: {
allow: [repoRoot],
},
},
plugins: [react(), honoMiddlewarePlugin(config)],
};