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

@ -149,10 +149,18 @@ export function printServerBanner(
return url;
}
export interface BuildWebServerConfigOptions {
initialMcpConfig?: MCPServerConfig | null;
}
/**
* Build WebServerConfig from process.env. Used when running server as standalone (e.g. node dist/server.js).
* Build WebServerConfig from process.env and optional initial MCP server config.
* Used by the launcher runner, Vite dev (`buildWebServerConfigFromEnv`), and prod standalone.
*/
export function buildWebServerConfigFromEnv(): WebServerConfig {
export function buildWebServerConfig(
options: BuildWebServerConfigOptions = {},
): WebServerConfig {
const { initialMcpConfig = null } = options;
const port = parseInt(process.env.CLIENT_PORT ?? "6274", 10);
const hostname = process.env.HOST ?? "localhost";
const baseUrl = `http://${hostname}:${port}`;
@ -163,8 +171,6 @@ export function buildWebServerConfigFromEnv(): WebServerConfig {
(process.env[LEGACY_AUTH_TOKEN_ENV] as string | undefined) ??
"");
const initialMcpConfig: MCPServerConfig | null = null;
const sandboxPort = resolveSandboxPort();
let logger: Logger | undefined;
@ -196,6 +202,13 @@ export function buildWebServerConfigFromEnv(): WebServerConfig {
};
}
/**
* Build WebServerConfig from process.env only. Used by `vite dev` (the Hono dev plugin reads env, not argv).
*/
export function buildWebServerConfigFromEnv(): WebServerConfig {
return buildWebServerConfig({ initialMcpConfig: null });
}
/**
* Three-way resolution for `autoOpen`:
* - explicit `MCP_AUTO_OPEN_ENABLED=true` → always open (overrides VITEST)