MCP server example for edge functions?

Hello!

I saw this great article you published for deploying MCP servers on Netlify: Building MCPs with Netlify | Netlify Developers. This article covers serverless functions, but I was wondering if it is possible to build one that is deployed on edge functions instead. If so, could you please provide boilerplate for that as well?

Thanks!
-Frank

You can try replacing the NPM module imports to imports from esm.sh and see if it works. For example:

import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"

would be:

import { StreamableHTTPServerTransport } from 'https://esm.sh/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js'