Corporate-proxy users could not connect to any remote MCP server from v2. Two independent defects, both reported in #2067. 1. The web and TUI bundles inlined undici. It was declared in the root and `clients/cli` manifests but named in no client's tsup `external` list, and tsup auto-externalizes only what the *nearest* manifest declares — so esbuild inlined 1.05MB of it into `clients/{web,tui}/build/`. undici is CommonJS, so the emitted chunk's `require("assert")` hit esbuild's ESM `__require` shim and threw `Dynamic require of "assert" is not supported`. The rejected `import()` surfaced as "the `undici` package is not available", telling users to install a package that was already present — and could not have helped, because the specifier had been rewritten to a relative chunk at build time. 2. `withProxyDispatcher` injected a *userland* undici `EnvHttpProxyAgent` into Node's *built-in* fetch. That couples two different copies of undici at the dispatcher handler interface, which is not stable across majors: Node 22 embeds undici 6, Node 24 embeds 7, Node 26 embeds 8. A userland undici 8 agent handed a built-in undici 7 handler is rejected with `fetch failed: invalid onRequestStart method`, and the request never leaves the process. So fixing the bundling alone would only have converted the web/TUI failure into the CLI's. Both halves of the pair now come from userland undici — its `fetch` and its `EnvHttpProxyAgent` — which keeps the handler inside one copy and works unchanged from the Node 22.19 engine floor through Node 26. Deleting the wrapper in favor of Node's native `NODE_USE_ENV_PROXY` was not an option: measured, it is unsupported on 22.19 (the floor) and only lands mid-22.x. Because undici's `Response` is a different class from `globalThis.Response`, the proxied fetch re-wraps each response as a genuine global `Response`, streaming preserved. Without that, `res instanceof Response` is false for callers that test it — including the SDK's OAuth error formatter, which would degrade every message to `Raw body: [object Response]`. The proxy now sits at the bottom of the fetch stack (`environment.fetch` for the Node clients, and the `createTransportNode` default for the web backend, its one caller that supplies no `fetchFn`) rather than wrapping the transport's fetch. Proxying means *substituting* the fetch, not decorating one, so wrapping a supplied `fetchFn` would discard it; installing it underneath lets InspectorClient's own wrappers compose over it. A side effect worth having: OAuth discovery and token requests go through `environment.fetch` too, and were never proxied before. Guarding it: - `undici` is added to all three tsup `external` lists and removed from `clients/cli/package.json`, so it is root-declared only, per the placement rule in AGENTS.md. The two installs had already drifted (root 8.5.0 vs cli 8.9.0). - New `npm run verify:bundle-externals` fails if any package a client declares external was inlined into that client's bundle anyway. It reads the *built output*, not the config — those two disagreed for four releases — and derives what to check from each client's own `external` array, so a newly externalized package is covered without editing the guard. Verified against the real pre-fix artifact, which it flags. - The proxy tests now drive a real forwarding proxy rather than a mock. That matters: defect 2 was a runtime interface mismatch, which no mock can catch because no mock ever dispatches. AGENTS.md's must-not-bundle rule (added by #2082) is extended with why undici slipped past it, and notes the `node -e` trap — probing the bundled chunk with `node -e` falsely succeeds, because it exposes a global `require` that satisfies esbuild's guard. Closes #2067 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H Signed-off-by: cliffhall <cliff@futurescale.com>
118 lines
5.8 KiB
JSON
118 lines
5.8 KiB
JSON
{
|
|
"name": "@modelcontextprotocol/inspector",
|
|
"version": "2.3.0",
|
|
"description": "The Model Context Protocol Inspector",
|
|
"keywords": [
|
|
"MCP",
|
|
"inspector"
|
|
],
|
|
"homepage": "https://github.com/modelcontextprotocol/inspector#readme",
|
|
"bugs": {
|
|
"url": "https://github.com/modelcontextprotocol/inspector/issues"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/modelcontextprotocol/inspector.git"
|
|
},
|
|
"license": "MIT",
|
|
"author": "The MCP Maintainers and Community",
|
|
"type": "module",
|
|
"bin": {
|
|
"mcp-inspector": "./clients/launcher/build/index.js"
|
|
},
|
|
"files": [
|
|
"clients/launcher/build",
|
|
"clients/web/build",
|
|
"clients/web/dist",
|
|
"clients/web/static",
|
|
"clients/cli/build",
|
|
"clients/tui/build",
|
|
"scripts/install-clients.mjs"
|
|
],
|
|
"scripts": {
|
|
"web": "node clients/launcher/build/index.js --web",
|
|
"build:web:runner": "cd clients/web && npm run build:runner",
|
|
"web:dev": "npm run build:web:runner && node clients/launcher/build/index.js --web --dev",
|
|
"build": "npm run build:web && npm run build:cli && npm run build:tui && npm run build:launcher",
|
|
"build:cli": "cd clients/cli && npm run build",
|
|
"build:tui": "cd clients/tui && npm run build",
|
|
"build:web": "cd clients/web && npm run build",
|
|
"build:launcher": "cd clients/launcher && npm run build",
|
|
"ci": "npm run validate && npm run coverage && npm run verify:build-gate && npm run verify:bundle-externals && npm run smoke && npm run ci:storybook",
|
|
"ci:storybook": "cd clients/web && npx playwright install chromium && npm run test:storybook",
|
|
"verify:build-gate": "node scripts/verify-build-gate.mjs",
|
|
"verify:bundle-externals": "node scripts/verify-bundle-externals.mjs",
|
|
"verify:typecheck-coverage": "node scripts/verify-typecheck-coverage.mjs",
|
|
"test:scripts": "node --test \"scripts/**/*.test.mjs\"",
|
|
"validate": "npm run verify:format-coverage && npm run verify:typecheck-coverage && npm run verify:dep-lockstep && npm run test:scripts && npm run validate:core && npm run validate:web && npm run validate:cli && npm run validate:tui && npm run validate:launcher",
|
|
"verify:format-coverage": "node scripts/verify-format-coverage.mjs",
|
|
"verify:dep-lockstep": "node scripts/verify-dep-lockstep.mjs",
|
|
"validate:core": "npm run format:check:core && npm run format:check:scripts && npm run format:check:shared && npm run lint:core && npm run lint:shared",
|
|
"lint:core": "eslint \"core/**/*.{ts,tsx}\" --max-warnings 0",
|
|
"lint:shared": "eslint \"test-servers/src/**/*.{ts,tsx,mts,cts}\" vitest.shared.mts eslint.config.js --max-warnings 0",
|
|
"format:core": "prettier --write \"core/**/*.{ts,tsx}\"",
|
|
"format:check:core": "prettier --check \"core/**/*.{ts,tsx}\"",
|
|
"format:scripts": "prettier --write \"scripts/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}\"",
|
|
"format:check:scripts": "prettier --check \"scripts/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}\"",
|
|
"format:shared": "prettier --write \"test-servers/src/**/*.{ts,tsx,mts,cts}\" vitest.shared.mts eslint.config.js",
|
|
"format:check:shared": "prettier --check \"test-servers/src/**/*.{ts,tsx,mts,cts}\" vitest.shared.mts eslint.config.js",
|
|
"format": "npm run format:core && npm run format:scripts && npm run format:shared && cd clients/web && npm run format && cd ../cli && npm run format && cd ../tui && npm run format && cd ../launcher && npm run format",
|
|
"validate:cli": "cd clients/cli && npm run validate",
|
|
"validate:tui": "cd clients/tui && npm run validate",
|
|
"validate:web": "cd clients/web && npm run validate",
|
|
"validate:launcher": "cd clients/launcher && npm run validate",
|
|
"coverage": "npm run coverage:web && npm run coverage:cli && npm run coverage:tui && npm run coverage:launcher",
|
|
"coverage:cli": "cd clients/cli && npm run test:coverage",
|
|
"coverage:tui": "cd clients/tui && npm run test:coverage",
|
|
"coverage:web": "cd clients/web && npm run test:coverage",
|
|
"coverage:launcher": "cd clients/launcher && npm run test:coverage",
|
|
"smoke": "npm run smoke:launcher && npm run smoke:cli && npm run smoke:tui && npm run smoke:web && npm run smoke:web:browser && npm run smoke:web:app && npm run smoke:web:elicit",
|
|
"smoke:cli": "node scripts/smoke-cli.mjs",
|
|
"smoke:tui": "node scripts/smoke-tui.mjs",
|
|
"smoke:web": "node scripts/smoke-web.mjs",
|
|
"smoke:web:browser": "cd clients/web && npx playwright install chromium && node ../../scripts/smoke-web-browser.mjs",
|
|
"smoke:web:app": "cd clients/web && npx playwright install chromium && node ../../scripts/smoke-web-app.mjs",
|
|
"smoke:web:elicit": "cd clients/web && npx playwright install chromium && node ../../scripts/smoke-web-elicitation.mjs",
|
|
"smoke:launcher": "node scripts/smoke-launcher.mjs",
|
|
"pack:verify": "node scripts/pack-and-verify.mjs",
|
|
"prepack": "npm run build",
|
|
"postinstall": "node scripts/install-clients.mjs"
|
|
},
|
|
"dependencies": {
|
|
"@hono/node-server": "^2.0.12",
|
|
"@modelcontextprotocol/client": "2.0.0",
|
|
"@modelcontextprotocol/core": "2.0.0",
|
|
"@modelcontextprotocol/ext-apps": "^1.7.4",
|
|
"@modelcontextprotocol/server": "2.0.0",
|
|
"@modelcontextprotocol/server-legacy": "2.0.0",
|
|
"@napi-rs/keyring": "^1.3.0",
|
|
"@vitejs/plugin-react": "^6.0.0",
|
|
"ajv": "^8.17.1",
|
|
"atomically": "^2.1.1",
|
|
"chokidar": "^4.0.3",
|
|
"commander": "^13.1.0",
|
|
"hono": "^4.12.18",
|
|
"ink": "^6.0.0",
|
|
"open": "^10.2.0",
|
|
"pino": "^9.14.0",
|
|
"proper-lockfile": "^4.1.2",
|
|
"react": "^19.0.0",
|
|
"undici": "^8.5.0",
|
|
"vite": "^8.1.5",
|
|
"yaml": "^2.9.0",
|
|
"zod": "^4.4.3"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.19.0"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^10.0.1",
|
|
"@types/proper-lockfile": "^4.1.4",
|
|
"eslint": "^10.8.0",
|
|
"express": "^5.2.1",
|
|
"globals": "^17.7.0",
|
|
"prettier": "3.8.4",
|
|
"typescript": "~5.9.3",
|
|
"typescript-eslint": "^8.65.0"
|
|
}
|
|
}
|