@modelcontextprotocol/fastify weekly downloads statistics
By modelcontextprotocol (8 listings) · npm · MCP servers
Fastify adapters for the Model Context Protocol TypeScript server SDK - Fastify middleware
@modelcontextprotocol/fastify has 47,248 recorded weekly downloads on npm, an increase of 162% over the past 30 days, ranking #604 of 2,322 tracked listings.
About @modelcontextprotocol/fastify
@modelcontextprotocol/fastify
Fastify adapters for the MCP TypeScript server SDK.
This package is a thin Fastify integration layer for @modelcontextprotocol/server.
It does not implement MCP itself. Instead, it helps you:
- create a Fastify app with sensible defaults for MCP servers
- add DNS rebinding protection via Host header validation (recommended for localhost servers)
Install
npm install @modelcontextprotocol/server @modelcontextprotocol/fastify fastify
# For MCP Streamable HTTP over Node.js (IncomingMessage/ServerResponse):
npm install @modelcontextprotocol/node
Exports
createMcpFastifyApp(options?)hostHeaderValidation(allowedHostnames)localhostHostValidation()
Usage
Create a Fastify app (localhost DNS rebinding protection by default)
import { createMcpFastifyApp } from '@modelcontextprotocol/fastify';
const app = createMcpFastifyApp(); // default host is 127.0.0.1; protection enabled
Streamable HTTP endpoint (Fastify)
import { createMcpFastifyApp } from '@modelcontextprotocol/fastify';
import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
import { McpServer } from '@modelcontextprotocol/server';
const app = createMcpFastifyApp();
app.post('/mcp', async (request, reply) => {
// Stateless example: create a server and a transport per request (with sessions: one pair per session).
const mcpServer = new McpServer({ name: 'my-server', version: '1.0.0' });
const transport = new NodeStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
await mcpServer.connect(transport);
// Clean up when the client closes the connection (e.g. during SSE streaming).
reply.raw.on('close', () => {
transport.close();
mcpServer.close();
});
await transport.handleRequest(request.raw, reply.raw, request.body);
});
To reject non-POST requests with 405 Method Not Allowed, add routes for GET and DELETE that send a JSON-RPC error response.
Host header validation (DNS rebinding protection)
import { hostHeaderValidation } from '@modelcontextprotocol/fastify';
app.addHook('onRequest', hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']));
Description from the npm listing.
- modelcontextprotocol
- mcp
- fastify
- middleware
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (122)Similar npm MCP servers plugins
All 20 @modelcontextprotocol/fastify alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@modelcontextprotocol/fastify. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.