home / mcp / google maps mcp server

Google Maps MCP Server

Provides map data access via Google Maps for MCP clients with a Python-based server and local inspection tools.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "amithmathew-mcp-demo": {
      "command": "python",
      "args": [
        "google_maps_server.py"
      ],
      "env": {
        "GOOGLE_MAPS_API_KEY": "YOUR_API_KEY",
        "GOOGLE_CLOUD_PROJECT": "my-gcp-project",
        "GOOGLE_GENAI_USE_VERTEXAI": "TRUE"
      }
    }
  }
}

You can deploy a local MCP (Model Context Protocol) server that interfaces with Google Maps data to power client applications. This server runs locally via Python and can be inspected or connected to by MCP clients to perform map-related actions using your configured API keys and project settings.

How to use

You connect to your MCP server from an MCP client. Start the server locally using Python, then start the inspector tool to verify the MCP endpoints are reachable. Once the server is running, your client can request map-related actions (such as geocoding or place lookups) and receive structured responses. Ensure you have set up the required environment variables and authenticated with cloud tools if your workflow requires it.

How to install

Prerequisites you need before starting:

- Python 3.x and virtual environments (venv) are recommended.

- Optional: gcloud CLI if you plan to authenticate applications against Google Cloud.

Follow these concrete steps to set up and run the MCP server locally.

Step by step commands

# 1. Set up a Python virtual environment and install dependencies
cd talk-building-your-own-mcp-server
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# 2. Create the MCP server environment and start the server
# Create environment for the MCP server as shown in the configuration details
# (GOOGLE_MAPS_API_KEY is required for the server to access Google Maps data)
# 3. Run the MCP server
cd mcpserver
python google_maps_server.py
# 4. Run the MCP Inspector to verify connectivity
# Ensure Node.js is installed on your system
npx @modelcontextprotocol/inspector

# Connect to your MCP Server using the URL exposed by the server, typically of the form:
# http://<host>:<port>/mcp

Additional setup and notes

Create the required environment files in your project to enable Google Maps integration. For each agent component, set up a .env file with these values:

GOOGLE_GENAI_USE_VERTEXAI=TRUE GOOGLE_CLOUD_PROJECT=<Your Project Name> GOOGLE_CLOUD_LOCATION=us-central1

For the MCP server component, create a .env file with the Google Maps API key:

GOOGLE_MAPS_API_KEY=<Your API Key>

Security and access

Authenticate with cloud tools if your workflow requires it. Use your Google Cloud credentials and ensure the API key you provide has the necessary permissions for Maps data access. Keep API keys secure and do not commit them to version control.

Troubleshooting

If the MCP server fails to start, verify that you are in the correct directories for the server code, that Python is installed, and that the required environment variables are defined. Check that the server process has access to the API key and that any dependent services (like Google Maps) are reachable from your network.

Examples and tips

Use the MCP Inspector to verify endpoints, and ensure the inspector connects over HTTP to the MCP URL exposed by your server. If you need to reconfigure, update the appropriate .env files and restart the server process.

Tools and endpoints

The MCP Inspector is a tool used to explore and validate MCP endpoints. It is run with a command such as npx @modelcontextprotocol/inspector and then connected to your MCP server to explore available endpoints and capabilities.

Available tools

inspector

MCP Inspector tool to explore endpoints and verify MCP server connectivity