Back to MCP directory
publicPublicdnsLocal runtime

EdgeOne Geolocation

该项目展示了如何利用EdgeOne Pages Functions获取用户地理位置信息,并通过MCP协议与大型语言模型集成。

article

README

🚀 边缘 MCP 与 Pages 函数:地理定位演示

本项目展示了借助 EdgeOne Pages Functions 获取用户地理位置信息,并通过 MCP(模型上下文协议)将其与大型语言模型集成的方法,为相关应用开发提供了实用的示例。

🚀 快速开始

演示

地理位置 Demo

部署

你可以通过以下按钮快速部署项目: 使用 EdgeOne Pages 部署

更多模板可参考:EdgeOne Pages

✨ 主要特性

组件

1. EdgeOne Pages Functions:地理位置

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

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

2. MCP 服务器集成

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

  • 实现了 Model Context Protocol(MCP)。
  • 暴露了一个名为 get_geolocation 的工具,供 AI 模型使用。
  • 使用 EdgeOne Pages Function 获取地理位置数据。
  • 代码位于 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