# Fastify MCP Server

A Fastify plugin that implements a Model Context Protocol server over JSON-RPC, letting a Fastify application expose its own tools, resources and prompts, with an in-process client for testing.

This Fastify plugin implements a Model Context Protocol server following the current MCP specification, negotiating down to older revisions for clients that need them, and supports HTTP with Server-Sent Events as well as stdio transports. It adds elicitation, where the server can ask the client for more information in a form or through a URL, icon metadata on tools and resources, and experimental task-augmented tool calls with polling and cancellation.

Optional TypeBox integration gives type-safe schema validation with automatic TypeScript inference, and the plugin can scale horizontally using Redis-backed session management and message broadcasting, with session persistence and reconnection support. It also decorates the Fastify instance with an in-process client that talks to the server through Fastify's own request injection, useful for testing or for driving the server from other code in the same process without opening a network port.

Website: https://github.com/platformatic/mcp
