Skip to main content
Glama
IPGeolocation

IP Geolocation MCP Server

get_my_ip

Retrieve your public IP address to identify your network location and enable geolocation services for AI assistants.

Instructions

Return the public IP address of the machine running this MCP server via /v3/getip. No API key or credits required.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that performs the network request to fetch the IP address.
    export async function getMyIp(): Promise<string> {
      const response = await fetchWithTimeout(`${API_BASE}/v3/getip`);
      if (!response.ok) {
        throw new ApiError(response.status, "Failed to retrieve IP address");
      }
      let data: { ip: string };
      try {
        data = (await response.json()) as { ip: string };
      } catch {
        throw new ApiError(502, "502: Upstream API returned invalid JSON");
      }
      return data.ip;
    }
  • The registration and implementation wrapper for the 'get_my_ip' tool.
    server.registerTool(
      "get_my_ip",
      {
        title: "Get My IP Address",
        annotations: {
          readOnlyHint: true,
        },
        description:
          "Return the public IP address of the machine running this MCP server via /v3/getip. No API key or credits required.",
        inputSchema: {},
      },
      async () => {
        try {
          const ip = await getMyIp();
          return {
            content: [{ type: "text" as const, text: ip }],
          };
        } catch (error) {

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/IPGeolocation/ipgeolocation-io-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server