Purpose
IP2Location.io MCP server is a Model Context Protocol (MCP) server that enables MCP-compatible AI clients to perform IP address geolocation and network intelligence queries using the IP2Location.io API. It is suitable for IP investigation, network troubleshooting, traffic analysis, localization, security analysis, and enriching IP addresses in logs or other datasets.
Key Capabilities
- Comprehensive geolocation data: Retrieve location information such as country, region, city, ZIP/postal code, latitude, longitude, time zone, and more.
- ASN lookup: Identify the Autonomous System Number (ASN) and Autonomous System (AS) associated with an IP address.
- Network intelligence: Retrieve network attributes such as ISP, domain, connection speed, and usage type depending on the plan.
- Proxy and security information: Detect proxy-related information and provide additional VPN, Tor, data center, threat, and fraud information on supported plans.
- IPv4 and IPv6 support: Query IPv4 and IPv6 addresses.
- Batch IP queries: Send multiple IP addresses in one prompt and automatically use the IP2Location.io batch API when available.
- MCP integration: Use IP intelligence directly from MCP-compatible AI applications.
- Asynchronous requests: Use httpx for asynchronous API requests.
The returned fields depend on the IP2Location.io API subscription plan.
Usage
There are two ways to use it:
Cloud-hosted MCP server
It is recommended to connect directly to the hosted IP2Location.io MCP server. Requires:
- An MCP-compatible client, such as Claude Desktop
- An IP2Location.io API key
Local MCP server
Use this when you want to run the MCP server locally. Requires:
- Python 3.13 or later
You can register for a free IP2Location.io API key. The free plan provides up to 50,000 IP geolocation API queries per month. The underlying IP2Location.io REST API also supports limited keyless access, with up to 1,000 queries per day. For this MCP server, it is recommended to configure an API Key.
Using in Claude Desktop
Method 1: Cloud-hosted MCP server
- Make sure Claude Desktop is installed.
- Open the claude_desktop_config.json file.
- Add the configuration, replacing YOUR_API_KEY with your actual IP2Location.io API key.
- Save and restart Claude Desktop, and the MCP server should appear in the Connectors menu.
Method 2: Local MCP server
- Set up the uv package manager.
- Obtain an API key and replace <YOUR API key HERE> in the example.
- Save and restart Claude Desktop, and it should appear in the Connectors menu.
Once connected, use natural language in the Claude Desktop chat to ask questions about IPv4 or IPv6 addresses. For example, query IP 8.8.8.8. The model will automatically generate output based on the results returned by the IP2Location.io MCP server.
Batch Queries
You can use the IP2Location.io batch IP geolocation API to query multiple IP addresses. When the MCP server detects multiple IP addresses, it will send them to the batch API whenever possible. IP addresses can be separated by commas, spaces, or newlines. Batch access requires an eligible paid plan.
Environment Variables
IP2LOCATION_API_KEY: Your IP2Location.io API key.
The free plan currently provides up to 50,000 IP geolocation API queries per month and access to basic IP information. Paid plans provide higher query quotas and additional attributes. Do not commit your API key to a public Git repository.
Tool: get_geolocation
Get the geolocation of a given IP address or a batch of IP addresses. Help users retrieve detailed information such as country, region, city, latitude, longitude, postal code, time zone, ASN, and proxy information. Automatically route multi-IP requests to the batch API. Parameter ip (str): One IPv4 or IPv6 address, or multiple IP addresses (separated by commas, spaces, or newlines). Return value: J containing geolocation dataSON string. When there are multiple IPs, a JSON object is returned, with each key being an IP address mapped to its respective data. Depending on the API plan, the returned information may include: country, region, city, ZIP, latitude, longitude, time zone, ASN, AS, ISP, domain, connection speed, usage type, proxy information, etc. If a single IP request fails or the IP is invalid, the tool returns an error message string. In batch requests, a single failed IP returns an error object mapped to that specific IP, without affecting the entire batch.
Use cases
- Website and application localization
- Regional content selection
- Traffic analysis
- Network troubleshooting
- Security investigation
- Fraud risk analysis
- Login and authentication context
- Server log enrichment
- IP address research
Limitations
- The returned fields depend on the IP2Location.io API plan. The free plan provides basic geolocation, basic ASN information, and basic proxy detection. Higher plans provide additional information such as mobile network information, detailed autonomous system information, detailed proxy information, data center detection, threat information, and additional geolocation attributes.
- IP geolocation is an estimated geographic location and should not be regarded as the precise physical location of a user or device. Accuracy may be affected by mobile networks, corporate networks, carrier-grade NAT, satellite connections, cloud infrastructure, ISP routing, and changes in address allocation. Country-level results are usually more reliable than city- or coordinate-level results.
- This MCP server performs IP address queries and does not itself continuously monitor or track IP addresses.
- The get_geolocation MCP tool expects an IP address as a parameter and is primarily designed to query IP addresses provided in the conversation.
- Batch IP geolocation API access requires an eligible paid plan.
- The free plan requires attribution.
Frequently asked questions (from the materials)
- Free IP geolocation services: IP2Location.com and IP2Location.io provide free access or a free tier. The free plan includes up to 50,000 queries per month and basic information. The REST API supports up to 1,000 requests per day without a key.
- IP2Location LITE: Provides a free IP geolocation database that can be downloaded and integrated into applications, supports local hosting and querying, comes in multiple formats, and supports IPv4 and IPv6.
- The IP geolocation API converts IPv4 or IPv6 addresses into geographic and network information.
- IP addresses can be recorded by applications over time and enrich data, but IP geolocation is not precise tracking of a person or device.
- IP2Location.io can serve as a "my IP address" API: when the REST API omits the ip parameter, it uses the IP address of the incoming request. However, this MCP tool's get_geolocation expects an IP address parameter.
- ASN and IP address lookup: IP2Location.io is suitable for obtaining both ASN information and IP geolocation. RDAP and WHOIS are suitable for registration information. BGP looking glasses are suitable for routing information. IP intelligence APIs are suitable for structured combined datasets.
Plans
- Free plan: basic geolocation, basic ASN information, basic proxy detection. Up to 50,000 IP geolocation API queries per month.
- Paid plans: higher query quotas and additional attributes, such as mobile network information, detailed autonomous system information, detailed proxy information, data center detection, threat information, and additional geolocation attributes. For the latest query limits, fields, and pricing, please refer to the IP2Location.io pricing and API documentation.
License: see the LICENSE.TXT file.