
Research
/Security News
TensorLake npm SDK Compromised in ChainDrop Shai-Hulud Credential-Stealing Attack
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.
@modelcontextprotocol/node
Advanced tools
Model Context Protocol implementation for TypeScript - Node.js middleware
@modelcontextprotocol/nodeNode.js adapters for the MCP TypeScript server SDK.
This package is a thin Node.js integration layer for @modelcontextprotocol/server. It provides a Streamable HTTP transport that works with Node’s IncomingMessage / ServerResponse.
For web‑standard runtimes (Cloudflare Workers, Deno, Bun, etc.), use WebStandardStreamableHTTPServerTransport from @modelcontextprotocol/server directly.
npm install @modelcontextprotocol/server @modelcontextprotocol/node
NodeStreamableHTTPServerTransportStreamableHTTPServerTransportOptions (type alias for WebStandardStreamableHTTPServerTransportOptions)toNodeHandler(handler, opts?) — adapt a web-standard { fetch } MCP handler to a Node (req, res, parsedBody?) handlerhostHeaderValidation(allowedHostnames) / localhostHostValidation() — Host header guards for hand-wired node:http serversoriginValidation(allowedOriginHostnames) / localhostOriginValidation() — Origin header guards for hand-wired node:http serversToNodeHandlerOptions, FetchLikeMcpHandler, NodeMcpRequestHandler (types for toNodeHandler)toWebRequest(req, parsedBody?, opts?) — the Node IncomingMessage → web-standard Request conversion toNodeHandler performs internally, exported on its own (for example to feed isLegacyRequest() from a hand-wired (req, res) handler)ToWebRequestOptions (options type for toWebRequest)NodeIncomingMessageLike, NodeServerResponseLike (structural Node request/response shapes)import { createMcpExpressApp } from '@modelcontextprotocol/express';
import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
import { McpServer } from '@modelcontextprotocol/server';
const app = createMcpExpressApp();
app.post('/mcp', async (req, res) => {
// Stateless example: create a server and a transport per request.
const server = new McpServer({ name: 'my-server', version: '1.0.0' });
const transport = new NodeStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
await server.connect(transport);
// If you use Express JSON parsing, pass the pre-parsed body to avoid re-reading the stream.
await transport.handleRequest(req, res, req.body);
});
http serverPlain node:http has no middleware chain, so bind loopback explicitly and
compose the Host/Origin guards in front of the transport — matching the
defaults the framework app factories (createMcpExpressApp,
createMcpHonoApp, createMcpFastifyApp) apply for you. The guards answer
rejected requests with 403 themselves and return false, so the handler
must not touch the request further.
import { createServer } from 'node:http';
import { localhostHostValidation, localhostOriginValidation, NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
import { McpServer } from '@modelcontextprotocol/server';
const validateHost = localhostHostValidation();
const validateOrigin = localhostOriginValidation();
createServer(async (req, res) => {
if (!validateHost(req, res) || !validateOrigin(req, res)) return;
const server = new McpServer({ name: 'my-server', version: '1.0.0' });
const transport = new NodeStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
await server.connect(transport);
await transport.handleRequest(req, res);
}).listen(3000, '127.0.0.1');
FAQs
Model Context Protocol implementation for TypeScript - Node.js middleware
The npm package @modelcontextprotocol/node receives a total of 1,963,303 weekly downloads. As such, @modelcontextprotocol/node popularity was classified as popular.
We found that @modelcontextprotocol/node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.

Research
/Security News
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.

Research
/Security News
Socket found 16 malicious Firefox extensions designed to steal crypto wallet recovery phrases and private keys using cloned Rabby and OKX interfaces.

Product
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.