Skip to content

Error from MCP server: SyntaxError: Unexpected token 'E', "Error: typ"... is not valid JSON #409

@abdulsaminexusaeon

Description

@abdulsaminexusaeon

When i run the app with
cmd = mcp dev server.py

then when i click on connect button i got this issue

Stdio transport: command=C:\Users\User\AppData\Local\Programs\Python\Python310\Scripts\uv.exe, args=run,--with,mcp,mcp,run,server.py
Spawned stdio transport
Connected MCP client to backing server transport
Created web app transport
Created web app transport
Set up MCP proxy
Error from MCP server: SyntaxError: Unexpected token 'E', "Error: typ"... is not valid JSON
at JSON.parse ()
at deserializeMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44)
at ReadBuffer.readMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16)
at StdioClientTransport.processReadBuffer (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:114:50)
at Socket. (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:93:22)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Error from MCP server: SyntaxError: Unexpected token 'E', "Error: typ"... is not valid JSON
at JSON.parse ()
at deserializeMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44)
at ReadBuffer.readMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16)
at StdioClientTransport.processReadBuffer (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:114:50)
at Socket. (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:93:22)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Error from MCP server: SyntaxError: Unexpected token 'E', "Error: typ"... is not valid JSON
at JSON.parse ()
at deserializeMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44)
at ReadBuffer.readMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16)
at StdioClientTransport.processReadBuffer (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:114:50)
at Socket. (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:93:22)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Error from MCP server: SyntaxError: Unexpected token 'E', "Error: typ"... is not valid JSON
at JSON.parse ()
at deserializeMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44)
at ReadBuffer.readMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16)
at StdioClientTransport.processReadBuffer (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:114:50)
at Socket. (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:93:22)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Error from MCP server: SyntaxError: Unexpected token 'E', "Error: typ"... is not valid JSON
at JSON.parse ()
at deserializeMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44)
at ReadBuffer.readMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16)
at StdioClientTransport.processReadBuffer (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:114:50)
at Socket. (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:93:22)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Received message for sessionId ac082c68-292e-4cbd-b85e-42046b434b38
Error in /message route: Error: SSE connection not established
at SSEServerTransport.handlePostMessage (file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js:53:19)
at file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js:129:25
at Layer.handle [as handle_request] (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\router\route.js:149:13)
at Route.dispatch (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\router\route.js:119:3)
at Layer.handle [as handle_request] (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\router\layer.js:95:5)
at C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\router\index.js:284:15
at Function.process_params (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\router\index.js:346:12)
at next (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\router\index.js:280:10)
at cors (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\cors\lib\index.js:188:7)
node:_http_outgoing:699
throw new ERR_HTTP_HEADERS_SENT('set');
^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (node:_http_outgoing:699:11)
at ServerResponse.header (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\response.js:794:10)
at ServerResponse.json (C:\Users\User\AppData\Local\npm-cache_npx\5a9d879542beca3a\node_modules\express\lib\response.js:275:10)
at file:///C:/Users/User/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js:133:25
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
code: 'ERR_HTTP_HEADERS_SENT'
}

Node.js v22.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions