
Product
PHP and Composer Support Is Now in Beta
Socket’s PHP and Composer support is now in Beta for all customers, with PHP reachability analysis generally available.
@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 server = new McpServer({ name: 'my-server', version: '1.0.0' });
const app = createMcpExpressApp();
app.post('/mcp', async (req, res) => {
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 server = new McpServer({ name: 'my-server', version: '1.0.0' });
const validateHost = localhostHostValidation();
const validateOrigin = localhostOriginValidation();
createServer(async (req, res) => {
if (!validateHost(req, res) || !validateOrigin(req, res)) return;
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 648,137 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 6 open source maintainers collaborating on the project.

Product
Socket’s PHP and Composer support is now in Beta for all customers, with PHP reachability analysis generally available.

Product
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.

Research
/Security News
Three compromised Rust crates pulled in a malicious dependency that downloaded and executed cross-platform malware during Cargo builds.