Labsco
david-pivonka logo

google-maps-mcp-server

β˜… 2

from david-pivonka

STDIO-based MCP server for Google Maps Platform APIs

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedPaid serviceNeeds API keys

Google Maps MCP Server

npm version License: MIT

A Model Context Protocol (MCP) server that provides comprehensive access to Google Maps Platform APIs. This server enables LLMs to perform geocoding, places search, routing, and other geospatial operations through a standardized interface.

Features

  • πŸ—ΊοΈ Comprehensive Google Maps Integration - Access to Places, Routes, Geocoding, and utility APIs
  • πŸ” Advanced Places Search - Text search, nearby search, autocomplete, and detailed place information
  • πŸ›£οΈ Smart Routing - Route computation with real-time traffic, tolls, and alternative routes
  • πŸ“ Precise Geocoding - Forward and reverse geocoding with international support
  • 🌐 Geolocation Services - IP-based and WiFi/cellular location estimation
  • πŸ“Š Rich Resources - Built-in documentation and examples accessible via MCP resources
  • πŸ”’ Security First - Input validation, rate limiting, and secure API key handling

Available Tools

Geocoding

  • geocode_search - Convert addresses to coordinates
  • geocode_reverse - Convert coordinates to addresses

Places

  • places_search_text - Search places with natural language
  • places_nearby - Find places within a radius
  • places_autocomplete - Get place suggestions
  • places_details - Get detailed place information
  • places_photos - Get place photo URLs

Routing

  • routes_compute - Calculate optimal routes
  • routes_matrix - Compute distance matrices

Utilities

  • elevation_get - Get elevation data
  • timezone_get - Get timezone information
  • geolocation_estimate - Estimate location from WiFi/cell data
  • roads_nearest - Find nearest roads

Special Tools

  • nearby_find - Find nearby cities, towns, or POIs
  • ip_geolocate - Geolocate using IP address

Resources

The server provides built-in MCP resources with documentation and examples:

  • google-maps://docs/api-overview - API overview and capabilities
  • google-maps://docs/place-types - Complete place types reference
  • google-maps://docs/travel-modes - Available travel modes
  • google-maps://docs/field-masks - Places API field optimization
  • google-maps://examples/common-queries - Example queries and patterns

Access these through your MCP client's resource interface.

Development

Building from Source

git clone <repository-url>
cd google-maps-mcp-server
npm install
npm run build

Testing

npm test

Using MCP Inspector

npm run build

GOOGLE_MAPS_API_KEY="your-api-key-here" npx @modelcontextprotocol/inspector ./dist/index.js

Error Handling

The server returns structured errors with helpful context:

{
  "error": {
    "code": "QUOTA_EXCEEDED",
    "message": "API quota exceeded",
    "context": {
      "endpoint": "/places/textsearch",
      "status": 429
    }
  }
}

Common error codes:

  • INVALID_REQUEST - Invalid input parameters
  • API_KEY_INVALID - Invalid or missing API key
  • QUOTA_EXCEEDED - API quota exceeded
  • REQUEST_FAILED - Network or API request failed

Security

  • API keys are never logged or exposed
  • Input validation prevents injection attacks
  • Rate limiting protects against abuse
  • IP addresses are hashed in logs for privacy

Contributing

Contributions are welcome! Please submit pull requests to our GitHub repository.

License

MIT License - see LICENSE file for details.