logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mcp-location-context-publisher

Facilitates the real-time injection of granular user geographical context into downstream Artificial Intelligence constructs by leveraging EdgeOne's serverless compute capabilities in conjunction with the Model Context Protocol specification.

Author

mcp-location-context-publisher logo

edgego

MIT License

Quick Info

GitHub GitHub Stars 1
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

geolocationapisedgegouser geolocationgeolocation datarequests edgego

Contextual Geopositioning via MCP and EdgeOne Functions

This repository illustrates the methodology for acquiring precise end-user location telemetry via an EdgeOne Pages Function and subsequently channeling this intelligence into sophisticated Generative Models using the Model Context Protocol (MCP).

Illustrative Demonstration

f180b5ae_0e9c_40a8_a76a_b8f2a5e6108f

Deployment Shortcut

Deploy with EdgeOne Pages

Explore More Blueprints: EdgeOne Pages Ecosystem

Core Architectural Elements

1. EdgeOne Pages Handler: Location Retrieval

The deployed serverless component is tasked with isolating and extracting visitor location attributes:

  • Accesses geolocation datasets intrinsic to the EdgeOne request environment.
  • Outputs the derived spatial information structured as a standardized JSON payload.
  • Source file location: functions/get_geo.ts

2. MCP Service Endpoint

This backend module serves as the gateway for AI inference engines to query contextual awareness data:

  • Adheres strictly to the defined Model Context Protocol (MCP) interface standards.
  • Registers and provides an exposed tooling endpoint named get_geolocation accessible by the AI agent.
  • Orchestrates data retrieval by invoking the aforementioned EdgeOne Pages Function.
  • Source file location: mcp-server/index.ts

MCP Integration Configuration

To successfully bind this geopositioning service to your consuming Language Model architecture, integrate the following configuration block into your setup manifest:

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

Further Documentation

WIKIPEDIA: XMLHttpRequest (XHR) constitutes a specialized JavaScript programming interface, encapsulated within an object, whose methods facilitate the transmission of HyperText Transfer Protocol queries originating from a web browser environment targeting a remote web server. These methods grant browser-resident applications the capability to dispatch server requests subsequent to initial page rendering completion, subsequently receiving information in return. XMLHttpRequest is fundamentally integral to the principles of Ajax application development. Before the advent of Ajax, the predominant means for server interaction involved hyperlink navigation and HTML form submissions, actions that typically necessitated the complete replacement of the currently displayed page content.

== Genesis == The underlying concept that gave rise to XMLHttpRequest was first formulated in the year 2000 by the engineering team responsible for Microsoft Outlook development. This concept was subsequently actualized within the Internet Explorer 5 browser release (1999). Notwithstanding this early implementation, the initial invocation syntax did not utilize the standardized XMLHttpRequest identifier. Instead, developers employed the object instantiation identifiers ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of the release of Internet Explorer 7 (2006), all contemporary browsers adopted universal support for the canonical XMLHttpRequest identifier. The XMLHttpRequest identifier has since solidified its position as the universally accepted convention across all major browser engines, including Mozilla's Gecko rendering framework (initiated in 2002), Apple's Safari version 1.2 (2004), and Opera version 8.0 (2005).

=== Standardization Process === The World Wide Web Consortium (W3C) formally published a Working Draft specification detailing the structure of the XMLHttpRequest object on April 5, 2006. Subsequently, on February 25, 2008, the W3C issued the Level 2 Working Draft specification. The Level 2 revision introduced crucial enhancements such as mechanisms for monitoring data transfer event progression, enabling requests across different domains (cross-site requests), and improved handling for raw byte streams. By the close of 2011, the feature set defined in the Level 2 specification was formally subsumed back into the primary, original specification document. Toward the end of 2012, the responsibility for stewardship and ongoing maintenance of this specification was transferred to the WHATWG, which maintains the document as a living standard utilizing the Web IDL notation.

== Operational Flow == In standard implementation, enacting a communication sequence using XMLHttpRequest typically involves a sequence of distinct programming actions.

First, instantiate an XMLHttpRequest object via a constructor call: Next, invoke the "open" method to define the request modality (e.g., GET, POST), designate the target resource Uniform Resource Identifier (URI), and specify whether the operation should be synchronous or asynchronous: For configurations employing asynchronous operation, establish an event listener callback function designated to receive notifications upon changes in the request's lifecycle state: Commence the actual data transmission by executing the "send" method, optionally passing payload data: Process the state transitions within the designated event listener. Upon successful receipt of response data from the server, this information is typically archived within the "responseText" object property by default. When the object completes its processing cycle, its state transitions to value 4, indicating the "done" status. Beyond these fundamental steps, XMLHttpRequest offers numerous configuration levers to govern request transmission parameters and response treatment. Arbitrary header fields may be appended to the outgoing request to convey specific server handling instructions, and data payloads can be transmitted to the server by embedding them within the argument provided to the "send" call. The received response data stream can be transparently deserialized from JSON format into a directly operational JavaScript object structure, or alternatively, processed incrementally as data segments arrive rather than awaiting the full transfer completion. Furthermore, the active request can be terminated prematurely or be configured to automatically fail if the transaction exceeds a predetermined time threshold.

== Inter-Domain Communications ==

During the nascent stages of the World Wide Web's evolution, it was identified that the mechanism could potentially be leveraged to facilitate exploitations or breaches of security boundaries, leading to the implementation of cross-origin restrictions, a topic that formed a key constraint in the early development phase...

See Also

`