You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importexpressfrom"express";import{McpServer,ResourceTemplate,}from"@modelcontextprotocol/sdk/server/mcp.js";import{SSEServerTransport}from"@modelcontextprotocol/sdk/server/sse.js";import{z}from"zod";constserver=newMcpServer({name: "example-server",version: "1.0.0",});server.tool("add",{a: z.number(),b: z.number()},async({ a, b })=>({content: [{type: "text",text: String(a+b)}],}));// Add a dynamic greeting resourceserver.resource("greeting",newResourceTemplate("greeting://{name}",{list: undefined}),async(uri,{ name })=>({contents: [{uri: uri.href,text: `Hello, ${name}!`,},],}));constapp=express();app.get("/sse",async(req,res)=>{consttransport=newSSEServerTransport("/messages",res);awaitserver.connect(transport);});// app.post("/messages", async (req, res) => {// const transport = new SSEServerTransport("/messages", res);// // Note: to support multiple simultaneous connections, these messages will// // need to be routed to a specific matching transport. (This logic isn't// // implemented here, for simplicity.)// await transport.handlePostMessage(req, res);// });app.listen(3000);
npx @modelcontextprotocol/inspector index.js Expected behavior
not working
Logs
$ npx @modelcontextprotocol/inspector index.js
Starting MCP inspector...
Proxy server listening on port 3000
🔍 MCP Inspector is up and running at http://localhost:5173 🚀
New SSE connection
Query parameters: { transportType: 'sse', url: 'http://localhost:3000/sse' }
sse transportType
SSE transport: url=http://localhost:3000/sse, headers=
New SSE connection
Query parameters: {}
undefined transportType
Invalid transport type: undefined
undefined transportType
Error in /sse route: Error: Invalid transport type specified
at createTransport (file:///C:/Users/Administrator/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js:74:15)
at file:///C:/Users/Administrator/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js:82:44
at Layer.handle [as handle_request] (C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\router\route.js:149:13)
at Route.dispatch (C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\router\route.js:119:3)
at Layer.handle [as handle_request] (C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\router\layer.js:95:5)
at C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\router\index.js:284:15
at Function.process_params (C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\router\index.js:346:12)
at next (C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\router\index.js:280:10)
at cors (C:\Users\Administrator\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\cors\lib\index.js:188:7)
Error in /sse route: SseError: SSE error: Non-200 status code (500)
at _eventSource.onerror (file:///C:/Users/Administrator/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:69:31)
at EventSource.failConnection_fn (file:///C:/Users/Administrator/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:234:53)
at file:///C:/Users/Administrator/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:76:74
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
code: 500,
event: {
type: 'error',
message: 'Non-200 status code (500)',
code: 500,
defaultPrevented: false,
cancelable: false,
timeStamp: 8331.5268
}
}
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
npx @modelcontextprotocol/inspector index.js

Expected behavior
not working
Logs
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: