Skip to main content
Glama
badchars

osint-mcp-server

by badchars

geoip_lookup

Geolocate any IP address to retrieve country, city, ISP, ASN, and detect proxies, hosting, or mobile connections.

Instructions

Geolocate an IP address: country, city, ISP, ASN, proxy/hosting/mobile detection. Uses ip-api.com (free, no API key).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesIP address to geolocate

Implementation Reference

  • Core handler function that performs a single IP geolocation lookup via ip-api.com free API. Accepts an IP string, applies rate limiting, fetches from http://ip-api.com/json/, and returns a GeoIpResult with country, city, ISP, ASN, proxy/hosting/mobile flags.
    export async function geoipLookup(ip: string): Promise<GeoIpResult> {
      await limiter.acquire();
      // ip-api.com free tier requires HTTP (not HTTPS)
      const res = await fetch(`http://ip-api.com/json/${encodeURIComponent(ip)}?fields=status,message,query,country,countryCode,region,regionName,city,zip,lat,lon,timezone,isp,org,as,asname,mobile,proxy,hosting`);
      if (!res.ok) throw new Error(`ip-api.com returned ${res.status}`);
      const data = await res.json();
      if (data.status === "fail") throw new Error(`ip-api.com: ${data.message}`);
      return data;
    }
  • GeoIpResult interface defining the response shape: query, status, country, countryCode, region, city, lat/lon, timezone, ISP, org, ASN, and boolean flags for mobile/proxy/hosting.
    interface GeoIpResult {
      query: string;
      status: string;
      country?: string;
      countryCode?: string;
      region?: string;
      regionName?: string;
      city?: string;
      zip?: string;
      lat?: number;
      lon?: number;
      timezone?: string;
      isp?: string;
      org?: string;
      as?: string;
      asname?: string;
      mobile?: boolean;
      proxy?: boolean;
      hosting?: boolean;
    }
  • Tool definition/registration for 'geoip_lookup'. Defines name, description, Zod schema (ip: string), and execute handler that calls geoipLookup().
    const geoipLookupTool: ToolDef = {
      name: "geoip_lookup",
      description: "Geolocate an IP address: country, city, ISP, ASN, proxy/hosting/mobile detection. Uses ip-api.com (free, no API key).",
      schema: {
        ip: z.string().describe("IP address to geolocate"),
      },
      execute: async (args) => json(await geoipLookup(args.ip as string)),
    };
  • Registration of geoipLookupTool in the exported allTools array that collects all tool definitions for the MCP server.
    // GeoIP (2)
    geoipLookupTool,
    geoipBatchTool,
  • RateLimiter class used by geoipLookup to ensure minimum delay (1400ms = ~45 req/min) between requests to ip-api.com free tier.
    // Queue-based rate limiter — ensures minimum delay between requests
    export class RateLimiter {
      private lastRequest = 0;
      private queue: (() => void)[] = [];
      private processing = false;
    
      constructor(private minDelayMs: number) {}
    
      async acquire(): Promise<void> {
        return new Promise<void>((resolve) => {
          this.queue.push(resolve);
          if (!this.processing) this.processQueue();
        });
      }
    
      private async processQueue(): Promise<void> {
        this.processing = true;
        while (this.queue.length > 0) {
          const now = Date.now();
          const elapsed = now - this.lastRequest;
          if (elapsed < this.minDelayMs) {
            await sleep(this.minDelayMs - elapsed);
          }
          this.lastRequest = Date.now();
          const resolve = this.queue.shift();
          resolve?.();
        }
        this.processing = false;
      }
    }
    
    function sleep(ms: number): Promise<void> {
      return new Promise((r) => setTimeout(r, ms));
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full responsibility. It discloses the data source and that no API key is needed, but omits rate limits, error handling (e.g., invalid IPs), and does not fully describe the return structure (e.g., lacks lat/long, timezone). This is a moderate disclosure for a simple lookup tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences provide the core function and source. The information is front-loaded and there is no redundancy, though the list of output fields could be slightly better structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter and no output schema, the description covers the main purpose and data source. However, it does not fully enumerate all possible return fields (e.g., coordinates, accuracy) and lacks fallback behavior, which is needed since no output schema exists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for the single 'ip' parameter. The description adds no extra semantics beyond the schema's 'IP address to geolocate', so it meets the baseline but does not enhance understanding (e.g., no format or validation hints).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool geolocates an IP address and lists specific data fields (country, city, ISP, ASN, proxy/hosting/mobile). It also identifies the backend service (ip-api.com), distinguishing it from sibling tools like geoip_batch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives such as geolocation via shodan_host or vt_ip. Mentioning it is free and requires no API key implies a low-barrier choice, but does not formally compare or exclude conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/badchars/osint-mcp-server'

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