# Geographic Stop Clustering Calculator AI Agent Connect

> Geographic Stop Clustering Calculator MCP groups service points into logical clusters based on their physical location and specific requirements. It handles the math for coordinates, demand, service duration, and time windows to ensure your routes actually work in the real world. You can use it within any MCP-compatible client to turn raw stop data into organized, feasible clusters.

## Overview
- **Category:** logistics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_UtRYLHCfkjR36Tc6B1HlrqRfsIdBELpBP3HZWhEv/ai-agent-connect
- **Tags:** clustering, routing, geospatial, logistics, optimization

## Description

You can use this MCP to turn a messy list of coordinates into organized service groups. Instead of manually grouping stops, you give your AI client the raw data including demand and time windows, and it handles the clustering logic. It uses deterministic algorithms to ensure that each group respects your capacity limits and service durations. 

If you have stops that don't fit into any existing route, the MCP identifies those specific points so you don't lose track of them. You can also check the physical spread of your clusters to see if they are too wide or too compact for your drivers. It's a practical way to validate that your planned routes won't violate time constraints or exceed vehicle capacity before you send them out.

## Tools

### calculate_stop_clusters
This tool runs the primary clustering logic on your set of stops. It groups points based on the parameters you provide.

### get_cluster_spatial_metrics
Use this to analyze how spread out or compact your clusters are. It provides data on geographic density and diameter.

### summarize_unassigned_stops
This tool identifies and reports any stops that couldn't be placed into a cluster. It helps you find gaps in your coverage.

### validate_cluster_feasibility
This tool checks if a specific group of stops actually works. It verifies that the cluster stays within your time and capacity limits.

## Prompt Examples

**Prompt:** 
```
Cluster these stops with a max capacity of 50: [{'id': 'A', 'lat': 40.7, 'lon': -74.0, 'demand': 30}, {'id': 'B', 'lat': 40.8, 'lon': -74.1, 'demand': 30}]
```

**Response:** 
```
The stops cannot be placed in a single cluster because the total demand of 60 exceeds the max capacity of 50. Stop A and Stop B will be in separate clusters or one will be unassigned.
```

**Prompt:** 
```
What is the spatial metric for a cluster containing stops at (0,0) and (0,1)?
```

**Response:** 
```
The diameter of the cluster is 1.0 and the average distance to the centroid is 0.5.
```

**Prompt:** 
```
Summarize the unassigned stops: [{'id': 'C', 'demand': 10}]
```

**Response:** 
```
There is 1 unassigned stop representing a total demand of 10.
```

## Capabilities

### Constraint-Based Grouping
Your agent uses demand and capacity limits to prevent overfilling routes.

### Spatial Analysis
Your agent can calculate the diameter and compactness of service areas.

### Feasibility Checking
The tool verifies that clusters respect time windows and service durations.

### Gap Detection
Your agent identifies unassigned stops that failed to meet clustering criteria.

## Use Cases

### Last-Mile Delivery
Group delivery stops into tight geographic zones to minimize travel time.

### Field Service Routing
Organize technician visits based on time windows and service duration requirements.

### Capacity Planning
Check if a set of service requests can actually fit into your existing fleet capacity.

### Territory Management
Use spatial metrics to ensure service areas are compact and manageable.

## Benefits

- Deterministic algorithms ensure consistent clustering results.
- Capacity constraints prevent assigning more demand than a vehicle can carry.
- Spatial metrics provide a mathematical view of cluster density.
- Unassigned stop reporting highlights service gaps immediately.

## How It Works

You connect the MCP to your AI client and provide your stop data.

1. Connect your preferred client like Claude or Cursor to Vinkius.
2. Provide a list of stops with coordinates, demand, and constraints.
3. Instruct your agent to run the clustering or validation tools.
4. Review the resulting clusters or unassigned stop reports.

## Frequently Asked Questions

**How does this MCP handle vehicle capacity?**
It uses the demand and capacity parameters you provide to ensure no cluster exceeds its limit.

**Can I use this with Claude or Cursor?**
Yes, you can connect this MCP to any MCP-compatible client including Claude, Cursor, and Windsurf.

**What happens if a stop cannot be clustered?**
The tool identifies these points, and you can use the summarize_unassigned_stops tool to get a report on them.

**Does it account for time windows?**
Yes, the tool can validate cluster feasibility against temporal constraints and service durations.

**What kind of data do I need to provide?**
You need to provide coordinates, demand per stop, and any capacity or time constraints you want to enforce.

**What clustering methods are supported?**
The server supports deterministic methods such as K-Means, K-Medoids, and Hierarchical clustering via the `calculate_stop_clusters` tool.

**How does the tool handle capacity limits?**
The `calculate_stop_clusters` tool ensures that the sum of demands in a cluster does not exceed the specified `maxCapacity`. If a cluster exceeds this, it is split or points remain unassigned.

**Can I check if a specific group of stops is valid?**
Yes, you can use the `validate_cluster_feasibility` tool to verify if a set of stops adheres to capacity and temporal constraints.
