用 goose 的 Neighborhood 扩展在对话中点外卖:远程 Streamable HTTP MCP 扩展的安装配置与实战指南
2026/9/10 12:53:37 网站建设 项目流程

用 goose 的 Neighborhood 扩展在对话中点外卖:远程 Streamable HTTP MCP 扩展的安装配置与实战指南

【免费下载链接】goosean open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM项目地址: https://gitcode.com/GitHub_Trending/goose3/goose

Neighborhood 是 goose 生态中一个基于远程 Streamable HTTP 的 MCP 扩展:你只需在 goose 聊天框中说明位置、饮食偏好与当下安排,goose 就能帮你发现附近餐厅、以交互式卡片和菜单呈现结果、组装购物车并一路引导到收银台完成支付。本文将以官方教程 neighborhood-mcp.md 为主线,完整讲解该扩展的安装方式(桌面端一键安装、CLI 交互配置、配置文件直写三种路径)、底层配置模型,并给出从“找餐厅 → 看菜单 → 加购物车 → 结账”的完整实战演示,帮助你举一反三地掌握任何远程 MCP 扩展的接入方法。读完本文,你将能够在 goose 中通过自然语言完成一次真实的本地餐饮点单闭环,并理解 Streamable HTTP 远程扩展在 goose 内部的配置与加载机制。

Neighborhood 扩展能做什么

Neighborhood 扩展打通了 goose 与本地餐饮点单服务(由 Square 侧提供的 MCP 服务端)之间的通道。其核心能力包括:

  • 发现附近餐厅:按任意位置检索周边可用外卖/自取(takeout)的商家,并可按喜好或场景筛选;
  • 浏览完整菜单:以带分类标签、实物图片、价格和描述的交互式菜单呈现,而非纯文本;
  • 组建购物车:以自然语言添加菜品与饮品,goose 会结合你的饮食偏好给出建议;
  • 引导结账:点击 Check out 按钮跳转至由 Cash App 提供支持的支付页完成付款。

需要特别指出的是,商家当前以美国(US-based)为主,这一点在配置和使用前应先有预期。官方演示默认的端点是:

https://connect.squareup.com/v2/mcp/neighborhood

从地址结构可以看出,它与同仓库中收录的 Cash App 扩展(端点为https://connect.squareup.com/v2/mcp/cash-app)以及面向商家侧的 Square MCP 扩展 同属 Square 的 MCP 服务家族,只是服务的用户角色不同:Neighborhood 面向普通消费者找店点单,Cash App 侧重本地餐饮下单与结账链路,而 Square MCP 面向卖家账户的 API 操作。

快速安装

官方文档提供了桌面端与 CLI 两条安装捷径,二者本质都是添加一个streamable_http类型的远程扩展。

goose Desktop:一键安装(Deeplink)

在 goose Desktop 中,可通过 goose 的深链(deeplink)协议一键唤起安装器,其 URL 格式遵循goose://extension?...。Neighborhood 的完整安装链接(URL 编码后)如下:

goose://extension?type=streamable_http&url=https%3A%2F%2Fconnect.squareup.com%2Fv2%2Fmcp%2Fneighborhood&id=neighborhood&name=Neighborhood&description=Discover%20nearby%20restaurants%2C%20browse%20menus%2C%20and%20place%20takeout%20orders%20through%20natural%20conversation.

该链接对应的参数模型可以在 using-extensions.md 的 Deeplinks 一节中找到依据:type=streamable_http声明协议类型,url指向远程 Streamable HTTP 服务器地址,其余idnamedescription分别定义扩展的唯一标识、显示名与功能描述,所有参数必须做 URL 编码。桌面端点击链接后确认安装,随后在顶部左侧打开面板(侧边栏),进入聊天即可使用。

goose CLI:使用 goose configure

CLI 用户通过交互式命令goose configure添加,选择Remote Extension (Streamable HTTP)类型并填入端点 URL:

https://connect.squareup.com/v2/mcp/neighborhood

配置详解:三种添加方式的完整步骤

方式一:goose Desktop 手动添加

参考 using-extensions.md 中添加自定义扩展的流程:

  1. 点击界面左上角的侧边栏按钮,打开侧边栏;
  2. 点击侧边栏中的Extensions
  3. 在 Extensions 下点击Add custom extension
  4. 在弹窗中填写扩展信息:
    • Type:Remote Extension (Streamable HTTP)(文档组件中的type="http"在底层会映射为streamable_http,见 GooseDesktopInstaller.tsx);
    • ID:neighborhood
    • Name:Neighborhood
    • Description:Discover nearby restaurants, browse menus, and place takeout orders through natural conversation.
    • URL:https://connect.squareup.com/v2/mcp/neighborhood
    • Timeout: goose 等待该扩展工具调用完成的最长秒数(默认建议 300);
  5. 点击Add完成添加。

安装后在当前聊天会话中通过聊天窗底部/侧栏的扩展开关确认 Neighborhood 处于启用状态(中途启停只影响当前会话,不改变默认配置)。

方式二:goose CLI 交互式配置

CLI 端完整的交互流程(与 CLIExtensionInstructions.tsx 渲染的步骤一致)如下:

  1. 运行配置命令:
goose configure
  1. What would you like to configure?中选择Add Extension
  2. 在扩展类型中选择Remote Extension (Streamable HTTP)(提示语为 “Connect to a remote extension via MCP Streamable HTTP”);
  3. 为扩展命名,例如Neighborhood
  4. 输入 Streamable HTTP 端点 URI:
https://connect.squareup.com/v2/mcp/neighborhood
  1. 设置该工具的超时时间(秒),默认300
  2. 为该扩展输入一段描述;
  3. 当被询问是否添加自定义请求头(custom headers)时选择No(该扩展无需鉴权头,OAuth 授权在需要时由 goose 处理)。

完整交互示例:

┌ goose-configure │ ◇ What would you like to configure? │ Add Extension │ ◇ What type of extension would you like to add? │ Remote Extension (Streamable HTTP) │ ◇ What would you like to call this extension? │ Neighborhood │ ◇ What is the Streamable HTTP endpoint URI? │ https://connect.squareup.com/v2/mcp/neighborhood │ ◇ Please set the timeout for this tool (in secs): │ 300 │ ◇ Enter a description for this extension: │ Discover nearby restaurants, browse menus, and place takeout orders through natural conversation. │ ◆ Would you like to add custom headers? │ No │ └ Added Neighborhood extension

方式三:直接编辑配置文件

对于需要将配置纳入版本管理或批量部署的高级用户,可以直写 goose 配置文件(macOS/Linux 位于~/.config/goose/config.yaml)。参考 config-files.md 中对streamable_http类型条目的写法,Neighborhood 的配置条目如下:

extensions: neighborhood: type: streamable_http name: Neighborhood description: "Discover nearby restaurants, browse menus, and place takeout orders through natural conversation." enabled: true uri: "https://connect.squareup.com/v2/mcp/neighborhood" headers: {} env_keys: [] envs: {} timeout: 300

官方文档同时提示:goose 支持的扩展类型为builtinplatformstdiostreamable_httpSSE 已不再支持,旧 SSE 配置应迁移到streamable_http(见 config-files.md)。

进阶:通过会话启动参数临时启用

如果不希望把扩展写进默认配置,仅在某一次会话中使用,可以直接以启动参数加载(详见 using-extensions.md 中 “Remote Extensions over Streamable HTTP” 一节):

goose session --with-streamable-http-extension "https://connect.squareup.com/v2/mcp/neighborhood"

这种方式不会安装扩展,只对当前会话生效。

原理:Streamable HTTP 远程扩展在 goose 中的配置模型

深入源码可以看到 goose 将扩展统一建模为ExtensionConfig枚举。其中面向远程 HTTP 服务的变体即StreamableHttp,定义位于 extension.rs,其字段与上面配置文件的键一一对应:

  • name:扩展标识名;
  • description:扩展功能描述;
  • uri:远程 Streamable HTTP 端点地址(Neighborhood 即https://connect.squareup.com/v2/mcp/neighborhood);
  • envs/env_keys:扩展运行所需的环境变量或其密钥引用;
  • headers:随请求发送的自定义 HTTP 头;
  • timeout:工具调用超时(秒),源码注释明确说明新配置应包含该字段;
  • socket:可选的 Unix domain socket 路径,用于 HTTP-over-UDS 传输(默认不启用);
  • client_id/client_secret_key/scopes:为需要 OAuth 的远程服务预留的预注册客户端配置,支持在授权服务器不支持 Client ID Metadata Documents 或 Dynamic Client Registration 时使用。

配置加载侧,extensions.rs 负责把 YAML 中extensions映射解析为ExtensionEntryenabled标志 + 展开后的ExtensionConfig),并定义默认超时为DEFAULT_EXTENSION_TIMEOUT: u64 = 300(第 10 行)。因此命令行交互中默认填写的 300 秒即源于此常量。

对 Neighborhood 而言,其服务端由 Square 以 MCP Streamable HTTP 规范托管,goose 通过uri建立连接、完成握手后,将服务端暴露的 MCP 工具注册到当前会话,Agent 即可在推理过程中调用这些工具来检索餐厅、读取菜单与维护购物车。配套博客 order-lunch-with-goose 中描述,goose 实际调用的是 Neighborhood MCP 服务端的get-restaurants-nearby这类工具,返回结构化的餐厅 JSON 数据,再经由交互式 MCP App 渲染成可视化卡片。

实战:从找餐厅到完成结账

本小节完整复现官方教程中的三步走流程。演示使用 Anthropic Claude 4 Opus 作为 LLM(见原文示例标注),你可以换成任何 goose 支持的模型。

Step 1:找到适合你的餐厅

找午饭时,把位置、饮食限制与接下来的安排一并告诉 goose——这正是 Neighborhood “最能发挥威力”的场景:goose 不只是罗列餐厅,而是基于你的处境做推理式推荐。

Prompt:

Use the neighborhood extension for this. I'm looking to get lunch today. I'm at 375 W Broadway in New York. I'm playing tennis later tonight. Could you suggest some options so I can play well?

goose 输出示例:

Let me find some restaurants near you! Here are some restaurants near 375 W Broadway in SoHo! For pre-game fuel, I'd recommend these options: Best picks for a light, gluten-free meal: Ba'al Falafel (71 Sullivan St) - Mediterranean food with falafel, hummus, and fresh veggies — great carbs and protein Kale & Things - Perfect for a healthy, nutrient-dense meal with greens and lean proteins for sustained energy without feeling heavy Tips for eating before playing sport: - Eat 2-3 hours before playing to allow digestion - Focus on complex carbs + lean protein (avoid heavy, fatty foods) - Stay hydrated - consider grabbing a drink from Steam & Sip or Drip Drop Café Would you like me to pull up the menu for any of these restaurants?

goose 会利用 Neighborhood 扩展的交互式 UI 把结果渲染为聊天窗口内的餐厅卡片(每张卡片展示店名、分类与地址,并带View menu按钮):

可以看到推荐并非机械罗列:因为用户提到稍后要打网球,goose 特意推荐高碳水、蛋白质充足又不油腻的选项,还附上了“赛前 2-3 小时进食”的专业建议。

Step 2:浏览带图片的交互式菜单

接下来让 goose 打开某家餐厅的菜单。得益于 MCP App 的富 UI 渲染,菜单会以带分类标签、实物照片、价格和描述的形式直接内嵌在聊天中。

Prompt:

I'd like to view the Ba'al Falafel menu.

菜单覆盖 Sandwiches、Salads、Combo platters、Soups、Pastries、Sides、Drinks 等多个分类,可直接在聊天内逐项浏览;看到中意的菜品,直接告诉 goose 加入购物车即可。

Step 3:加入购物车并结账

将想点的菜品告诉 goose,goose 会把它加入购物车,并同样以交互式 MCP App 渲染订单汇总。

Prompt:

Add a Beets Apple Salad, Lentil Soup, and a Ginger Lemonade to my cart.

购物车就绪后,点击Check out按钮即跳转到由 Cash App 提供支持的支付页面,完成付款后便只待前往取餐。需要注意:支付这一步发生在 goose 之外,这既是出于安全考虑,也是整套流程中唯一需要离开聊天框的环节。

更多提示思路:把 Neighborhood 与其他扩展组合

Neighborhood 真正的价值在于和日程、健康数据等其他扩展联动,把“吃饭”编织进你一整天的上下文。官方文档给出的组合示例包括:

  • 配合日历安排用餐“Check my calendar for today and find somewhere I can grab a quick pickup lunch before my 1pm meeting. I'm near Union Square.”(查看今日日程,在 1 点会议前就近找一家可快速自取的午餐。)
  • 记录饮食摄入“Order me a chicken bowl from that place on Sullivan St, and log the macros to my food diary.”(下单的同时把营养数据记入饮食日记。)
  • 为多人聚会做规划“I'm meeting 3 friends near Bryant Park tonight. Find somewhere with good vegetarian options that's not too loud.”(结合人数与素食需求,寻找环境安静的餐厅。)

这些组合的基础设施前提是 goose 的扩展体系基于 MCP(Model Context Protocol)构建(参见 using-extensions.md),多个扩展的工具可被同一会话内的 Agent 自由编排调用。

使用注意事项

  • 地域限制:当前商家以美国为基地(Sellers are currently US-based),其他地区体验可能受限;
  • 付款环节:结账在 Cash App 托管的支付页完成,需在 goose 之外操作,这也是涉及资金的安全边界;
  • 启用状态:动态/中途启用的扩展仅对当前会话有效;若希望长期使用,请将其写入默认配置或保持其处于启用状态;
  • 类型选择:添加时务必选择 Remote Extension(Streamable HTTP)而非 Command-line Extension,两者配置模型完全不同。

延伸阅读

  • 想要同类“对话式下单”的更强组合,可继续阅读 Cash App 扩展文档(端点为https://connect.squareup.com/v2/mcp/cash-app)以及面向商家的 Square MCP 扩展文档;
  • 理解 goose 扩展整体机制与深链协议,见 扩展使用指南;
  • 配置文件全字段说明见 config-files.md;
  • 一篇完整的实操体验记录见博客 order-lunch-with-goose;
  • 若想了解源码层面扩展配置模型的更多细节,可阅读 extension.rs 与 config/extensions.rs。

【免费下载链接】goosean open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM项目地址: https://gitcode.com/GitHub_Trending/goose3/goose

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询