Back to MCP directory
publicPublicdnsLocal runtime

EdgeOne Geo

通过EdgeOne Pages Functions获取用户地理位置并与大模型集成

article

README

🚀 EdgeOne Pages MCP:地理位置服务

本项目展示了如何借助 EdgeOne Pages 函数获取用户的地理位置信息,并通过 MCP(模型上下文协议)将其与大语言模型集成,为大语言模型应用增添地理位置相关的智能交互能力。

🚀 快速开始

演示

项目的实际运行效果可通过下方的动图查看:

部署

你可以点击下面的按钮,使用 EdgeOne Pages 进行部署: 使用EdgeOne Pages部署

更多模板可查看:EdgeOne Pages

✨ 主要特性

📦 组件介绍

1. EdgeOne Pages 函数:地理位置

项目中包含一个用于获取用户地理位置信息的 EdgeOne Pages 函数,具备以下特点:

  • 使用 EdgeOne 请求上下文访问地理位置数据。
  • 返回 JSON 格式的位置信息。
  • 代码文件位于functions/get_geo.ts

2. MCP 服务器集成

MCP 服务器组件提供了一个接口,供大语言模型访问地理位置数据,具体特性如下:

  • 实现了模型上下文协议(MCP)。
  • 暴露了一个get_geolocation工具,可供 AI 模型使用。
  • 使用 EdgeOne Pages 函数获取地理位置数据。
  • 代码文件位于mcp-server/index.ts

📚 MCP 配置

若要将 MCP 服务器与大语言模型一起使用,请添加以下配置:

{
  "mcpServers": {
    "edgeone-geo-mcp-server": {
      "command": "tsx",
      "args": ["path/to/mcp-server/index.ts"]
    }
  }
}

📚 详细文档

若你想进一步了解相关内容,可参考以下文档:

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client