Labsco
MCP SERVER

Geo Location Demo

by handsomegentlemen

A one-tool EdgeOne Pages template: the edge function reads the caller's location from the request context and hands it back as JSON for a model to use.

Summary
A template to copy, not a service to depend on.

It does one thing, and its real use is as the shortest example of wiring an edge function to an MCP tool — deploy it, see the shape, then swap in whatever your own function returns. The location comes from EdgeOne's request context, so it only means anything when it runs on EdgeOne.

What it is

A small demonstration project that pairs an EdgeOne Pages Function with an MCP server. The function pulls geolocation out of the EdgeOne request context and returns it as JSON; the MCP server wraps that as a tool a model can call.

What you get
  • `get_geolocation` — the single tool the MCP server exposes to a model
  • The Pages Function that produces the data, in functions/get_geo.ts
  • The MCP server that calls it, in mcp-server/index.ts
  • A one-click deploy button for the EdgeOne Pages template
  • A short, complete example of the pattern: edge function as the data source, MCP server as the interface
Requirements

An EdgeOne Pages deployment of the template, since the location data comes from EdgeOne's own request context rather than a geo-IP library. The MCP server itself is a TypeScript file launched with `tsx` — that command and the path to mcp-server/index.ts is what goes into your client config.

Setup effort

Build from source — clone the repository and build it, then point your client at the binary