无服务器函数开发

使用Netlify Functions开发和运行无服务器MCP的基本示例,包括部署的服务器功能链接和自定义URL访问示例。

  • by bridgpal
  • HTML
  • 本地部署
  • 更新于
在 GitHub 查看 bridgpal/mcp-test-2

使用说明

MCP示例Netlify无服务器功能

查看此演示网站: https://mcp-example-serverless.netlify.app/

关于此示例网站

本网站展示了一个使用Netlify Functions开发和运行无服务器MCP的基本示例。它包括指向已部署的无服务器功能的链接,以及使用自定义URL访问该功能的示例。

快速部署自己的版本

通过单击下面的部署到Netlify按钮,部署您自己版本的此示例站点。这将自动:

  • 将此示例的副本从示例仓库克隆到您自己的GitHub帐户
  • 在您的 Netlify帐户,链接到您的新仓库
  • 创建一个自动部署管道,以监视仓库上的更改
  • 构建和部署您的新站点
  • 然后,可以使用此仓库在本地进行迭代 netlify dev

在本地安装并运行示例

您可以克隆整个示例仓库来探索此示例和其他示例,并在本地运行它们。


# 1. Clone the examples repository to your local development environment
git clone git@github.com:netlify/examples

# 2. Move into the project directory for this example
cd examples/mcp/serverless-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