location-history-mcp-server
Enriches detected places with business names and addresses via the Google Places API.
Deploys the server on Google Cloud Run and uses Cloud SQL as the database backend.
Receives real-time GPS location updates from an iOS companion app for personal tracking.
Provides geospatial storage and advanced location queries with PostGIS extension.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@location-history-mcp-serverWhere was I last Tuesday at 3pm?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Location History MCP Server
A comprehensive Model Context Protocol (MCP) server for personal location tracking with intelligent place recognition, automatic clustering, and Google Places integration.
Features
Real-time GPS Tracking: Store location points from iOS app with high accuracy
Intelligent Place Detection: Automatic clustering to identify where you spend time
Place Recognition: Google Places API integration for automatic place naming
Manual Labeling: Name your frequent places (Home, Work, Gym, etc.)
Visit Tracking: Automatic detection of arrival/departure times
Travel Statistics: Distance traveled, average speed, time spent moving
13 MCP Tools: Comprehensive AI-accessible location queries
PostGIS Support: Advanced geospatial queries and radius searches
Related MCP server: Strava MCP Server
Architecture
iOS App → location-history-mcp-server → PostgreSQL (PostGIS)
↓
ChatGPT / Claude
(13 MCP tools)Available MCP Tools
Location Queries
get_current_location- Your most recent GPS positionget_location_history- GPS points for date rangeget_location_at_time- Where were you at [specific time]?search_locations_near- Find visits near coordinates/addressget_travel_stats- Distance, speed, time traveled
Place Management
get_frequent_places- Most visited places (sorted by visit count)list_all_places- All identified places (labeled & unlabeled)label_place- Name a place (e.g., "Home", "Equinox Gym")get_unlabeled_frequent_places- Suggest places to label
Place Queries
get_place_visits- All visits to a specific placeget_time_at_place- Total time spent at a placeenrich_place_with_google- Get business name from Google Places APIprocess_recent_locations- Trigger place detection/clustering
Prerequisites
PostgreSQL Database with PostGIS
Cloud SQL instance or local PostgreSQL
PostGIS extension enabled
Same database as health-data-storage recommended
Google Places API Key (Optional but recommended)
Enable Places API in Google Cloud Console
For automatic place name resolution
Cost: ~$0.005 per API call
iOS Location Tracker App
See:
location-tracker-ios(companion app)
Setup
1. Install Dependencies
npm install2. Configure Environment Variables
Create .env file:
# Database (use your health-data-storage Cloud SQL connection)
DATABASE_URL=postgresql://user:pass@/health_data?host=/cloudsql/PROJECT:REGION:INSTANCE
# Google Places API (optional)
GOOGLE_PLACES_API_KEY=your_api_key_here
# User ID (your email)
DEFAULT_USER_ID=lucashanson132@gmail.com3. Initialize Database
The server automatically creates tables on first run:
location_points- GPS coordinates with timestampsplaces- Identified significant placesplace_visits- Visit records with arrival/departure times
npm run dev4. Deploy to Cloud Run
GOOGLE_CLOUD_PROJECT=your-project-id ./deploy.shiOS App Configuration
Update location-tracker-ios/LocationTracker/APIClient.swift:
private let baseURL = "https://location-history-mcp-server-xxxxx.run.app"Update location-tracker-ios/LocationTracker/Config.swift:
static let userId = "lucashanson132@gmail.com"Usage with ChatGPT
Go to ChatGPT Settings → GPT Connectors
Add server URL:
https://your-server.run.app/sseStart asking questions:
"Where was I last Tuesday at 3pm?"
"How much did I travel this week?"
"How many times did I visit the gym this month?"
"Show me my most frequent places"
"Label place #5 as 'Home'"Usage with Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"location-history": {
"url": "https://your-server.run.app/sse"
}
}
}How Place Detection Works
Upload: iOS app uploads GPS points in batches of 10
Storage: Points stored in
location_pointstableClustering: Background process identifies "stops" (stayed >5 min within 50m)
Place Creation: New place created or matched to existing place
Visit Recording: Arrival/departure times tracked in
place_visitsGoogle Enrichment (optional): Reverse geocode to get business names
Manual Labeling: You name important places
Database Schema
location_points
- id, user_id, latitude, longitude
- accuracy, altitude, speed, course
- timestamp, device_model, device_os
- place_id (FK to places)
- geom (PostGIS geography point)places
- id, user_id, name, category
- center_lat, center_lng, radius
- address, google_place_id, google_place_name
- visit_count, created_at, updated_at
- geom (PostGIS geography point)place_visits
- id, user_id, place_id (FK)
- arrival_time, departure_time, duration_minutesAPI Endpoints
POST /upload- iOS app uploads location batchesGET /health- Health checkGET /sse- MCP SSE transportPOST /message- MCP message handlerGET /tools- List available MCP tools
Example Queries
"Where was I yesterday at 2pm?"
Tool: get_location_at_time
Args: { timestamp: "2025-10-26T14:00:00Z" }
Returns: Lat/lng coordinates"How long did I spend at work this week?"
Tool: get_time_at_place
Args: {
place_name: "Work",
start_date: "2025-10-20T00:00:00Z",
end_date: "2025-10-27T00:00:00Z"
}
Returns: Total hours, visit count, average visit duration"What are my most visited places?"
Tool: get_frequent_places
Returns: Sorted list with visit counts, coordinates, namesPrivacy & Security
Your Data: All location data stays in your Cloud SQL database
No Third-party Storage: MCP server doesn't store data, only queries it
Optional Google API: Use only when you explicitly enrich a place
User Control: You decide which places to label and share with AI
Development
# Local development
npm run dev
# Build TypeScript
npm run build
# Run production
npm startCost Considerations
Cloud Run: Free tier covers typical personal use
Cloud SQL: Shared with health-data-storage, no additional cost
Google Places API: ~$0.005/call, only used for enrichment
Total: Typically $0-3/month for personal use
Troubleshooting
No locations appearing
Check iOS app is uploading: look for "✅ Successfully uploaded" logs
Verify DATABASE_URL in Cloud Run environment variables
Run health check:
curl https://your-server.run.app/health
Places not being detected
Ensure you're staying in one location for 5+ minutes
Manually trigger: use
process_recent_locationstoolCheck clustering settings in
PlacesAnalyzerconstructor
Google Places not working
Verify GOOGLE_PLACES_API_KEY is set in Cloud Run
Enable Places API in Google Cloud Console
Check API quotas and billing
Support
For issues:
Check Cloud Run logs:
gcloud run services logs read location-history-mcp-serverVerify database connectivity
Check iOS app logs
License
MIT License
Built with Model Context Protocol and deployed on Google Cloud Run
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/lucas-1000/location-history-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server