Skip to content

Adds Fastify Middleware for v2#1536

Merged
felixweinberger merged 9 commits intomodelcontextprotocol:mainfrom
andyfleming:add-fastify-adapter-middleware
Mar 31, 2026
Merged

Adds Fastify Middleware for v2#1536
felixweinberger merged 9 commits intomodelcontextprotocol:mainfrom
andyfleming:add-fastify-adapter-middleware

Conversation

@andyfleming
Copy link
Copy Markdown
Contributor

@andyfleming andyfleming commented Feb 14, 2026

This adds middleware for Fastify in the same format as the other adapters/middleware (for hono and express).

Motivation and Context

This adds support for fastify as discussed in the SDK V2 Issue.

How Has This Been Tested?

  • Unit tests (equivalent to the other adapters/middleware)
  • Manually tested by consuming this package with MCP server using Fastify.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

One small difference in behavior is that this middleware uses the Fastify logger rather than console.warn like the other middleware.

@andyfleming andyfleming requested a review from a team as a code owner February 14, 2026 20:01
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 14, 2026

🦋 Changeset detected

Latest commit: c28b5c7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/fastify Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 14, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1536

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1536

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1536

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/fastify@1536

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1536

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1536

commit: c28b5c7

@felixweinberger felixweinberger force-pushed the add-fastify-adapter-middleware branch from ed07d7b to c98ea62 Compare March 23, 2026 18:11
@felixweinberger
Copy link
Copy Markdown
Contributor

Rebased on main and added a changeset

@felixweinberger felixweinberger force-pushed the add-fastify-adapter-middleware branch from 8965ce0 to 746674c Compare March 30, 2026 22:10
@KKonstantinov
Copy link
Copy Markdown
Contributor

Nit: has to be added to pkg-pr-new on the pipeline

@felixweinberger
Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants