GnistAI GnistAI
Log in

Getting Started with IP Geolocation

IP address geolocation — country, city, coordinates, ISP, and timezone from any IP.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Utilities

Data source: ip-api.com

Overview

IP Geolocation wraps ip-api.com, handling authentication, pagination, and rate limits for you. This tutorial covers all 3 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-ip-geolocation": {
      "url": "https://context.gnist.ai/mcp/ip-geolocation/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (3)

geolocate_ip

Look up the geographic location of an IP address. Returns country, region, city, coordinates, timezone, ISP, and organization. Args: ip: IPv4 or IPv6 address to look up (e.g. "8.8.8.8", "2001:4860:4860::8888").

ParameterTypeRequiredDescription
ipstringrequired
curl -X POST "https://context.gnist.ai/mcp/ip-geolocation/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "geolocate_ip", "arguments": {"ip": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/ip-geolocation/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'ip': 'example'}, 'name': 'geolocate_ip'}},
)
print(resp.json())

geolocate_ip_batch

Look up geographic locations for multiple IP addresses at once. More efficient than individual lookups when you have several IPs. Maximum 100 IPs per request. Args: ips: Comma-separated IP addresses (e.g. "8.8.8.8,1.1.1.1,208.67.222.222").

ParameterTypeRequiredDescription
ipsstringrequired
curl -X POST "https://context.gnist.ai/mcp/ip-geolocation/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "geolocate_ip_batch", "arguments": {"ips": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/ip-geolocation/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'ips': 'example'}, 'name': 'geolocate_ip_batch'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/ip-geolocation/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/ip-geolocation/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

FAQ

What data does IP Geolocation provide?

IP address geolocation — country, city, coordinates, ISP, and timezone from any IP. It exposes 3 tools: geolocate_ip, geolocate_ip_batch, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the IP Geolocation API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials