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:
parent
53dc4549be
commit
2488ca5e38
1 changed files with 25594 additions and 236 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
import {
|
||||
buildWebServerConfig,
|
||||
buildWebServerConfigFromEnv,
|
||||
printServerBanner,
|
||||
webServerConfigToInitialPayload,
|
||||
|
|
@ -192,6 +193,39 @@ describe("buildWebServerConfigFromEnv", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("buildWebServerConfig", () => {
|
||||
it("matches buildWebServerConfigFromEnv when initialMcpConfig is omitted", () => {
|
||||
process.env[API_SERVER_ENV_VARS.AUTH_TOKEN] = "shared";
|
||||
expect(buildWebServerConfig()).toEqual(buildWebServerConfigFromEnv());
|
||||
expect(buildWebServerConfig({ initialMcpConfig: null })).toEqual(
|
||||
buildWebServerConfigFromEnv(),
|
||||
);
|
||||
});
|
||||
|
||||
it("preserves a stdio initialMcpConfig while applying shared env defaults", () => {
|
||||
process.env.CLIENT_PORT = "7000";
|
||||
const initialMcpConfig = {
|
||||
type: "stdio" as const,
|
||||
command: "node",
|
||||
args: ["server.js"],
|
||||
cwd: "/srv",
|
||||
};
|
||||
const cfg = buildWebServerConfig({ initialMcpConfig });
|
||||
expect(cfg.port).toBe(7000);
|
||||
expect(cfg.initialMcpConfig).toEqual(initialMcpConfig);
|
||||
expect(cfg.allowedOrigins).toEqual(["http://localhost:7000"]);
|
||||
});
|
||||
|
||||
it("preserves remote transport initialMcpConfig", () => {
|
||||
const initialMcpConfig = {
|
||||
type: "streamable-http" as const,
|
||||
url: "https://example.com/mcp",
|
||||
};
|
||||
const cfg = buildWebServerConfig({ initialMcpConfig });
|
||||
expect(cfg.initialMcpConfig).toEqual(initialMcpConfig);
|
||||
});
|
||||
});
|
||||
|
||||
describe("webServerConfigToInitialPayload", () => {
|
||||
it("returns only defaultEnvironment when initialMcpConfig is null", () => {
|
||||
const payload = webServerConfigToInitialPayload(baseConfig());
|
||||
|
|
|
|||
Loading…
Reference in a new issue