Netlify 扩展
Watch the demo
本教程介绍如何把 Netlify MCP 服务器 添加为 goose 扩展,用来构建、部署和管理 Netlify 站点。
- goose Desktop
- goose CLI
命令
npx -y @netlify/mcp
配置
先确认已经登录 Netlify 账号:
netlify login
添加 Netlify MCP 服务器
运行此命令需要系统已安装 Node.js,因为会用到 npx。
- goose Desktop
- goose CLI
- Launch the installer
- Click
Yesto confirm the installation - Click the button in the top-left to open the sidebar
- Navigate to the chat
- Run the
configurecommand:
goose configure
- Choose to add a
Command-line Extension.
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension
│
◆ What type of extension would you like to add?
│ ○ Built-in Extension
│ ● Command-line Extension (Run a local command or script)
│ ○ Remote Extension (Streamable HTTP)
└
- Give your extension a name.
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◆ What would you like to call this extension?
│ Netlify
└
- Enter the command to run when this extension is used.
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ Netlify
│
◆ What command should be run?
│ npx -y @netlify/mcp
└
- Enter the number of seconds goose should wait for actions to complete before timing out. Default is
300seconds.
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ Netlify
│
◇ What command should be run?
│ npx -y @netlify/mcp
│
◆ Please set the timeout for this tool (in secs):
│ 300
└
- Enter a description for this extension.
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ Netlify
│
◇ What command should be run?
│ npx -y @netlify/mcp
│
◇ Please set the timeout for this tool (in secs):
│ 300
│
◆ Enter a description for this extension:
│ Build, deploy, and manage sites with Netlify's official MCP server
└
- Choose
Nowhen asked to add environment variables.
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ Netlify
│
◇ What command should be run?
│ npx -y @netlify/mcp
│
◇ Please set the timeout for this tool (in secs):
│ 300
│
◇ Enter a description for this extension:
│ Build, deploy, and manage sites with Netlify's official MCP server
│
◆ Would you like to add environment variables?
│ No
│
└ Added Netlify extension
使用示例
这个示例演示如何用 goose 和 Netlify 扩展部署一个 Web 应用。
goose 提示词
能通过我的 GitHub 仓库把应用部署到 Netlify 吗?
goose 输出
Details
工具调用
我来帮你把井字棋应用从 GitHub 仓库部署到 Netlify。先查看你的 Netlify 账号,再配置部署。─── netlify-user-services | netlify ──────────────────────────
selectSchema:
operation: get-user
params:
很好。你已经登录 Netlify,并且连上了 GitHub 账号。接下来我会新建一个 Netlify 站点,并从 GitHub 仓库部署井字棋应用。
─── netlify-project-services | netlify ──────────────────────────
selectSchema:
operation: create-new-project
params:
name: tic-tac-toe-game
换一个项目名再试一次:
─── netlify-project-services | netlify ──────────────────────────
selectSchema:
operation: create-new-project
params:
name: janedoe-tic-tac-toe
完成。我已经创建了名为 "janedoe-tic-tac-toe" 的 Netlify 站点。接下来从 GitHub 仓库部署代码:
─── netlify-deploy-services | netlify ──────────────────────────
selectSchema:
operation: deploy-site
params:
deployDirectory: /Users/janedoe/Development/tic-tac-toe
siteId: 1731e49e-1d0a-49a3-ad95-975b550f324a
我来查看部署状态,并拿到站点的线上地址:
─── netlify-project-services | netlify ──────────────────────────
selectSchema:
operation: get-project
params:
siteId: 1731e49e-1d0a-49a3-ad95-975b550f324a
🎉 成功!井字棋游戏已经部署到 Netlify。
部署详情:
- 线上地址:http://janedoe-tic-tac-toe.netlify.app
- Netlify 项目控制台:https://app.netlify.com/projects/janedoe-tic-tac-toe
- 站点 ID:1731e49e-1d0a-49a3-ad95-975b550f324a
部署了哪些内容:
✅ HTML:游戏主界面
✅ CSS:带动画和响应式布局的现代样式
✅ JavaScript:完整的游戏逻辑和交互
✅ README:项目文档
下一步:
- 访问线上站点:http://janedoe-tic-tac-toe.netlify.app
- 试玩游戏:确认一切符合预期
- 分享给别人:游戏已经在网上可访问
以后如何更新:
代码是从本地目录部署的。如果要改动:
- 更新本地文件
- 把改动推送到 GitHub 仓库
- 然后可以:
- 用同样的命令手动重新部署
- 配置从 GitHub 持续部署(推送后自动部署)
需要我帮你配置从 GitHub 仓库持续部署,让以后的改动自动上线吗?
井字棋游戏已经上线,可以开始玩了。🎮