Back to MCP directory
publicPublicdnsLocal runtime

mcp-geo

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

article

README

🚀 带页面函数的MCP:地理位置演示项目

本项目展示了如何使用 EdgeOne 页面函数来获取用户的地理位置信息,并通过 MCP(模型上下文协议)将其与大语言模型集成。

🔍 演示

演示动图

🚀 部署

使用 EdgeOne 页面部署

更多模板:EdgeOne 页面

🧩 组件介绍

1. EdgeOne 页面函数:地理位置

项目包含一个 EdgeOne 页面函数,用于获取用户的地理位置信息:

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

2. MCP 服务器集成

MCP 服务器组件为大语言模型提供了访问地理位置数据的接口:

  • 实现了模型上下文协议(MCP)。
  • 公开了一个 get_geolocation 工具,供 AI 模型使用。
  • 使用 EdgeOne 页面函数来获取地理位置数据。
  • 代码位于 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