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'

What’s the advantage/disadvantage of using Edge Functions over Serverless Functions?

Mainly having regional support instead of being stuck to a single location and shorter to none cold starts.

We implemented an MCP server with Netlify Edge Functions. Here it is for those who are interested: docs-site/netlify/edge-functions/mcp.js at main · redpanda-data/docs-site · GitHub

And here’s the blog we posted to announce it: Meet the Redpanda Documentation MCP server