mcpField
M
MCP example Netlify Express

MCP example Netlify Express

Local
github.com/lutfi-haslabCloud & Infra0Updated 77w ago

About MCP example Netlify Express

MCP example Netlify Express is a demo site for building and running a basic serverless MCP server with Netlify Functions. It is intended for developers exploring Express routing, deployment, and local iteration with Netlify.

Key features

  1. 01Serverless MCP example using Netlify Functions
  2. 02Express route mapping example
  3. 03Custom URL access to deployed function
  4. 04Deploy-to-Netlify project setup
  5. 05Local development with Netlify CLI

Use cases

  1. 01Explore a minimal serverless MCP setup
  2. 02Test Express route redirects for /mcp
  3. 03Deploy a starter project to Netlify

MCP support

The example deploys an MCP serverless function and demonstrates routing requests through the /mcp path using Netlify redirects.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"netlify": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/inspector"
]
}
}
}
Run commandnpx -y @modelcontextprotocol/inspector

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@modelcontextprotocol/inspector

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Netlify Examples

MCP example Netlify Express

View this demo site: https://mcp-example-express.netlify.app/

Netlify Status

About this example site

This site shows a very a basic example of developing and running serverless MCP using Netlify Functions. It includes links to a deployed serverless function and an example of accessing the function using a customized URL.

Importantly, because of how Express handles mapping routes, ensure you set the netlify.toml redirects to the correct path. In this example we have the following to ensure /mcp catches all of the requests to this server:

[[redirects]]
  force = true
  from = "/mcp"
  status = 200
  to = "/.netlify/functions/express-mcp-server"

Speedily deploy your own version

Deploy your own version of this example site, by clicking the Deploy to Netlify Button below. This will automatically:

  • Clone a copy of this example from the examples repo to your own GitHub account
  • Create a new project in your Netlify account, linked to your new repo
  • Create an automated deployment pipeline to watch for changes on your repo
  • Build and deploy your new site
  • This repo can then be used to iterate on locally using netlify dev

Deploy to Netlify

Install and run the examples locally

You can clone this entire examples repo to explore this and other examples, and to run them locally.


# 1. Clone the examples repository to your local development environment
git clone [email protected]:netlify/examples

# 2. Move into the project directory for this example
cd examples/mcp/express-mcp

# 3. Install the Netlify CLI to let you locally serve your site using Netlify's features
npm i -g netlify-cli

# 4. Serve your site using Netlify Dev to get local serverless functions
netlify dev

# 5. While the site is running locally, open a separate terminal tab to run the MCP inspector or client you desire
npx @modelcontextprotocol/inspector npx mcp-remote@next http://localhost:8888/mcp

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.