inspector
inspector copied to clipboard
ReferenceError: AbortController is not defined
Describe the bug
npx @modelcontextprotocol/inspector does not work
To Reproduce
package.json
{
"name": "mcp-quickstart",
"version": "1.0.0",
"description": "A quick start example of Model Context Protocol",
"type": "module",
"main": "dist/server.js",
"scripts": {
"start": "ts-node --esm src/server.ts",
"build": "tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.9.0",
"@types/node": "^22.14.1",
"ts-node": "^10.9.2",
"typescript": "^5.8.3",
"zod": "^3.24.2"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "esnext",
"moduleResolution": "node",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
server.ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from 'zod';
// Create a new MCP server instance
const server = new McpServer({
name: 'Echo Server',
version: '1.0.0',
});
// Register a simple echo tool
server.tool(
'echo',
{
message: z.string().describe('The message to echo back'),
},
async ({ message }) => {
console.log('Received message:', message);
return {
content: [
{
type: 'text',
text: `Echo: ${message}`,
},
],
};
}
);
const transport = new StdioServerTransport();
await server.connect(transport);
command executed
npx @modelcontextprotocol/inspector node /Users/luisvalgoi/.../mcp-quickstart/dist/server.js
Expected behavior
- To work
Logs
mcp-quickstart npx @modelcontextprotocol/inspector node /Users/luisvalgoi/.../mcp-quickstart/dist/server.js
npx: installed 232 in 10.011s
Starting MCP inspector...
ReferenceError: AbortController is not defined
at main (file:///Users/luisvalgoi/.npm/_npx/31517/lib/node_modules/@modelcontextprotocol/inspector/bin/cli.js:69:17)
at file:///Users/luisvalgoi/.npm/_npx/31517/lib/node_modules/@modelcontextprotocol/inspector/bin/cli.js:115:1
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)
Hi @LuisValgoi could you add what version of Node you're using?
@LuisValgoi I'm going to close this since I believe this is an issue with your node version and not Inspector itself, but feel free to re-open if you're still having this issue and can provide a few more details about your node environment.
I was getting this error using node v14.21.3. Updating it (to v22.11.0) solved the error,