# LocationIQ MCP

> LocationIQ connects your AI agent to powerful geocoding and mapping tools. It converts addresses to precise coordinates, finds points of interest nearby, calculates travel routes, and determines local timezones. Use its seven distinct APIs—like `search`, `directions`, and `nearby`—to resolve any location data problem directly in your chat session.

## Overview
- **Category:** geocoding-maps
- **Price:** Free
- **Tags:** geocoding, reverse-geocoding, maps, routing, poi-search

## Description

**LocationIQ connects your AI agent to serious mapping power.** It's built with industry-grade geocoding tools, letting your agent run complex location queries right in your chat session. You don't need external API calls; you just connect it via MCP and get the data you need.

**Finding Coordinates from an Address:** If you start with a street address or a place name, you use the `search` tool. This function converts that raw text into precise latitude/longitude coordinates, which is what most mapping services actually require. You can feed it anything—a full mailing address like "123 Main St., New York," or just a general landmark name—and it spits out the exact pair of numbers you need.

**Autocomplete and Address Suggestions:** When you're drafting a prompt, typing an address is messy. Use `autocomplete` to get real-time suggestions for full addresses as you type them into your chat. This keeps your prompts clean and ensures you’re working with fully validated locations from the start.

**Resolving Addresses from Coordinates:** Got coordinates but no idea what street that point belongs to? That's where `reverse` comes in. You feed it raw latitude/longitude, and it converts those numbers back into a usable, human-readable physical street address. It’s perfect for when you only have GPS data and need the mailing details.

**Calculating Routes and Travel Times:** Need to know how far two points are or how long the drive takes? The `directions` tool figures out the optimized path between multiple sets of coordinates. It returns both the total distance and an estimated travel duration, so you can plan logistics without guesswork. You're calculating optimal routes for everything from field visits to delivery schedules.

**Discovering Points of Interest (POIs):** Sometimes you don't know where you want to go; you just know what kind of place you need. Use `nearby` to find specific points of interest around a given coordinate. You can pinpoint places like gas stations, restaurants, parks, or anything else—it gives you a list of relevant spots near your target location.

**Visualizing Locations:** For proof, you gotta see it. The `static_map` tool generates a direct URL for an image map. This lets you visually confirm the exact spot at any zoom level, which is handy when you're dealing with ambiguous addresses or need to show stakeholders exactly where something is located.

**Time and Zone Context:** You might have coordinates, but you gotta know what time it is over there. The `timezone` tool queries the local time and the UTC offset for any given pair of geographic coordinates. This lets your agent handle international scheduling conflicts automatically.

Every single one of these tools—`search`, `autocomplete`, `reverse`, `directions`, `nearby`, `static_map`, and `timezone`—works together to give you a complete location data pipeline. You can check an address, get its coordinates using `search`; use those coordinates in `nearby` to list all the coffee shops within a mile; then take one of those coffee shop's coordinates, run them through `directions` with your office coordinates to calculate the drive time, and finish up by running the whole thing through `static_map` so you can show everyone exactly what it looks like.

## Tools

### autocomplete
Suggests full addresses in real time as you type into the prompt.

### directions
Calculates optimized paths between multiple coordinates, returning distance and travel duration metrics.

### nearby
Finds specific points of interest (like restaurants or gas stations) around a given set of coordinates.

### reverse
Takes raw coordinates and converts them back to the most accurate human-readable street address.

### search
Converts a user-provided address or place name into precise latitude/longitude coordinates (forward geocoding).

### static_map
Generates a direct URL for an image map, allowing you to visually confirm the location at any zoom level.

### timezone
Retrieves the local time and timezone offset for any given point on Earth using coordinates.

## Prompt Examples

**Prompt:** 
```
Find the coordinates for '1600 Pennsylvania Avenue NW, Washington, DC'.
```

**Response:** 
```
I've found the location using the `search` tool. The coordinates for the White House are Latitude 38.8977 and Longitude -77.0365.
```

**Prompt:** 
```
What is the current local time at coordinates 48.8566, 2.3522?
```

**Response:** 
```
Using the `timezone` tool for those coordinates (Paris, France), the current local time is 2:45 PM (CET) with a UTC offset of +1.
```

**Prompt:** 
```
Show me a map of the Eiffel Tower at zoom level 15.
```

**Response:** 
```
I've generated a static map URL for you using the `static_map` tool, centered on the Eiffel Tower (48.8584, 2.2945) at zoom level 15.
```

## Capabilities

### Find Coordinates from an Address
The agent converts a street address or place name into precise latitude/longitude pairs using the `search` tool.

### Determine Address from Coordinates
Using the `reverse` tool, the agent takes coordinates and returns the corresponding full physical address.

### Suggest Addresses in Real Time
The agent runs `autocomplete` to provide instant suggestions for addresses as the user types into a prompt.

### Calculate Routes and Travel Times
With the `directions` tool, the agent figures out the best path between multiple coordinates, providing distance and estimated duration.

### Discover Nearby Points of Interest (POIs)
The agent uses the `nearby` tool to locate specific POIs—like parks or cafes—around a given coordinate.

### Generate Map Images
For visualization, the `static_map` tool generates an image URL of any location at specified zoom levels.

### Get Local Timezone Data
The agent queries the `timezone` tool to retrieve the local time and UTC offset for a specific geographic coordinate.

## Use Cases

### Dispatching a Delivery Team
A logistics manager needs to check if three new addresses are deliverable in one trip. They ask their agent, which runs `search` on all three points, and then uses the `directions` tool. The agent returns a single optimized route path with total distance and estimated time, eliminating manual mapping.

### Planning a Multi-City Trip
A travel planner is setting up an itinerary across three different countries. They use the `timezone` tool to confirm local times for each city and then rely on `nearby` to suggest highly-rated restaurants near the main hotel coordinates.

### Debugging GPS Data
A developer gets raw GPS data (coordinates) from a device but needs the street address for logging. They run the `reverse` tool, and it instantly converts the floating-point numbers into '123 Main Street, Anytown.' This solves data context problems fast.

### Building a Search Widget
When building a form, the user types an address. Instead of failing validation, the agent uses `autocomplete` to suggest valid options in real time. The developer then runs `search` on the selected option to get clean coordinates for database storage.

## Benefits

- **Always get the right coordinates:** The `search` tool handles forward geocoding. You never have to manually look up lat/long for a known address again.
- **Validation on the fly:** Use `autocomplete` while drafting prompts or validating forms. It gives instant, real-time suggestions, preventing bad data from entering your workflow.
- **Understand local time zones:** The `timezone` tool eliminates timezone guesswork. You can instantly tell if a meeting scheduled for '2 PM' is actually 9 AM somewhere else.
- **Deep discovery power:** Don't just know where something *is*; find what's nearby using the `nearby` tool—from cafes to emergency services, it lists them all.
- **Visual proof in one step:** Need to show a client where something is? The `static_map` tool generates an image URL immediately. No extra mapping service needed.
- **Perfect for backend logic:** The `reverse` tool lets you build systems that accept coordinates (e.g., GPS data) and automatically figure out the corresponding street address.

## How It Works

The bottom line is: Your AI client executes complex mapping logic by calling specific tools, so you don't have to write the API calls yourself.

1. First, you subscribe to this server and provide your LocationIQ API Key.
2. Next, your AI client sends a request (e.g., 'What's near 40.7128, -74.0060?') specifying the required location function.
3. The agent runs the necessary tool (like `nearby`) and returns the structured data, which you can then use directly in your workflow.

## Frequently Asked Questions

**How do I convert an address to coordinates using the `search` tool?**
You simply tell your agent the full street address. The `search` tool takes that text and returns a structured response containing the precise latitude and longitude for that location.

**Does LocationIQ MCP Server help me find places near coordinates? Use the `nearby` tool.**
Yes, that's exactly what it does. You provide the target coordinates, and the agent uses the `nearby` tool to list points of interest like gas stations or parks.

**What is the difference between using `search` and `autocomplete`?**
`Autocomplete` gives suggestions while you're typing an address. `Search` is what you run after you've finished writing the address; it confirms the coordinates for that full, finalized location.

**Can I get the local time using the `timezone` tool?**
Yes. You pass two coordinates (lat/long) to the `timezone` tool, and it returns the current local time along with the required UTC offset for that specific point on Earth.

**How do I calculate the distance and duration between two points using the `directions` tool?**
The `directions` tool calculates the optimal path details. You provide start and end coordinates, and it returns structured data including total driving distance (in meters) and estimated travel time.

**What kind of address data does the `reverse` tool return for a set of coordinates?**
The `reverse` tool gives you a fully resolved, human-readable address. It doesn't just give one line; it breaks down the location into components like street name, city, state/province, and postal code.

**How do I generate an actual map image using the `static_map` tool?**
You supply the coordinates and a zoom level. The `static_map` tool then generates a direct URL to a static PNG or JPEG image of that specific area, perfect for embedding in reports.

**If I use the `search` tool with an invalid address format, what error message should I expect?**
The API returns a distinct status code and an explicit error message. It tells you whether the problem is bad formatting or if the location simply doesn't exist in the database.

**Can I get the address of a specific coordinate?**
Yes, use the `reverse` tool with the latitude and longitude. The agent will return the full address, including street, city, and country.

**How do I find the best route between two cities?**
Use the `directions` tool by providing the coordinates of your start and end points. It will provide the distance, duration, and turn-by-turn steps.

**Can I search for specific types of places like 'restaurants' near me?**
Absolutely. Use the `nearby` tool with your current coordinates and the tag 'restaurant' to see a list of nearby dining options.