EdgeOne Geolocation MCP server

Provides user geolocation data from EdgeOne's edge functions in structured JSON format for location-aware responses
Back to servers
Provider
EdgeOne Pages
Release date
May 03, 2025
Stats
1 star

The EdgeOne MCP Geo Location server integrates EdgeOne Pages Functions with large language models through the Model Context Protocol (MCP). This server allows AI models to access user geolocation information, providing location-aware capabilities to your AI applications.

Installation

To install and set up the MCP Geo Location server, follow these steps:

Prerequisites

  • EdgeOne account
  • Node.js environment
  • TSX package for TypeScript execution

Deployment Options

You can deploy the MCP Geo Location server in two ways:

  1. Quick Deploy: Use the template deployment option: Visit https://edgeone.ai/pages/new?template=mcp-geo to deploy directly from the template.

  2. Manual Setup: Clone the repository and set up the components yourself:

    # Clone the repository
    git clone <repository-url>
    cd mcp-geo-location-demo
    
    # Install dependencies
    npm install
    

Configuration

MCP Server Setup

To connect your large language models with the geolocation capabilities, configure the MCP server:

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

Make sure to replace path/to/mcp-server/index.ts with the actual path to the MCP server file on your system.

Usage

Accessing Geolocation Data

The MCP server exposes a get_geolocation tool that can be used by AI models to retrieve user location information. The geolocation data is provided in JSON format and includes the following information:

  • User's geographical location
  • Country
  • City (when available)
  • Region information
  • IP-based location data

Example Usage with an AI Model

When integrated with a large language model, you can prompt the model to access geolocation information:

Can you tell me my current location based on my IP address?

The model will use the MCP server's get_geolocation tool to retrieve and present this information.

Components Overview

EdgeOne Pages Functions

The geolocation functionality is implemented in the functions/get_geo.ts file. This function:

  • Retrieves the user's location data from the EdgeOne request context
  • Formats the geolocation information into a structured JSON response
  • Makes this data available to the MCP server

MCP Server

The MCP server component in mcp-server/index.ts:

  • Implements the Model Context Protocol specification
  • Creates a bridge between AI models and the geolocation function
  • Enables AI models to dynamically access real-time location data

Troubleshooting

If you encounter issues with geolocation data:

  • Ensure your EdgeOne account has proper permissions
  • Verify that the EdgeOne Pages Functions are correctly deployed
  • Check that the MCP server configuration points to the correct file path
  • Make sure your AI model is properly configured to use MCP tools

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later