How to Add Google Maps Search to Codex

Codex CLI is a solid terminal-based coding agent, but it can’t look up real-world locations. When you’re building location-aware features and need actual business data to work with, you either leave the terminal to search manually or use a placeholder. AgentPatch adds Google Maps directly to Codex so it can pull location data on its own.

Why This Matters

Location features are common — store finders, delivery radius checks, address validation, nearby search. Building them well requires real data. If Codex can access Maps directly, it can test with actual results rather than mocked data you had to look up yourself.

It also matters for non-location projects that occasionally need place data: generating realistic test fixtures, seeding a database, checking a business’s existence. Having Maps available means Codex can handle those requests inline.

Setup

Add AgentPatch to ~/.codex/config.toml:

[mcp_servers.agentpatch]
url = "https://agentpatch.ai/mcp"
bearer_token_env_var = "AGENTPATCH_API_KEY"

Then set your API key:

export AGENTPATCH_API_KEY=your_api_key

Replace your_api_key with your actual key from the AgentPatch dashboard. Codex discovers all AgentPatch tools automatically on next start.

Example

You’re working on an app that shows nearby pharmacies and need to verify the search feature works with real data. You tell Codex:

“Search for pharmacies near zip code 10001 and show me what the results look like so I can model the response type.”

Codex searches Maps directly:

Searching Google Maps for "pharmacy near 10001"...

Results:
- Duane Reade (4.1★) — 300 W 34th St, New York, NY 10001
- CVS Pharmacy (3.8★) — 345 8th Ave, New York, NY 10001
- Rite Aid (3.9★) — 352 W 42nd St, New York, NY 10036

Each result has: name, rating (number), address (string), coordinates (lat/lng).

Here's the TypeScript type for the response:

interface PharmacyResult {
  name: string;
  rating: number;
  address: string;
  lat: number;
  lng: number;
}

Codex used the real search results to derive the response type. That’s more useful than guessing at a schema.

Wrapping Up

Connecting AgentPatch to Codex gives it direct access to Google Maps during any session. That’s one tool — the same connection also unlocks web search, news, email, image generation, and everything else on the marketplace. Visit agentpatch.ai to explore.