How to Give Claude Direct Access to Postal Code Data
What if Claude could look up postal codes for you — not by generating code, but by calling the API directly? With the PostalDataPI MCP server, it can. One pip install, one config line, and Claude has live access to postal code data across 70+ countries.
What Is MCP?
MCP (Model Context Protocol) is an open standard from Anthropic that lets AI agents use external tools. Instead of generating code for you to run, Claude calls the API directly and returns real results.
The PostalDataPI MCP server exposes four tools:
| Tool | What It Does |
|------|-------------|
| lookup_postal_code | Get city, state, and region for any postal code |
| validate_postal_code | Check if a postal code exists in a country |
| search_by_city | Find all postal codes for a city |
| get_postal_code_metadata | Full metadata including coordinates |
# PostalDataPI MCP Tools
lookup_postal_code — city, state, region
validate_postal_code — check if code exists
search_by_city — find codes for a city
get_postal_code_metadata — coordinates, timezone
Install the MCP Server
Install from PyPI:
pip install postaldatapi-mcp
Get Your API Key
Sign up at postaldatapi.com/register — free, no credit card, 1,000 queries included.
Configure with Claude Code
Run this command to register the MCP server with Claude Code:
claude mcp add --transport stdio postaldatapi -- \
env POSTALDATAPI_KEY=your_api_key_here postaldatapi-mcp
Restart Claude Code and the tools appear automatically.
Configure with Claude Desktop
Add this to your Claude Desktop config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, ~/.config/Claude/claude_desktop_config.json on Linux):
{
"mcpServers": {
"postaldatapi": {
"command": "postaldatapi-mcp",
"env": {
"POSTALDATAPI_KEY": "your_api_key_here"
}
}
}
}
Try It: Natural Language Lookups
Once configured, just ask Claude naturally:
> "What city is ZIP code 90210?"
Claude automatically calls the lookup_postal_code tool and returns live data:
> City: Beverly Hills
> State/Region: California
> Abbreviation: CA
> Country: US
No code, no curl commands — just a question and an answer backed by live API data.
Global Coverage
It works globally — Claude handles the country parameter automatically:
> "Look up UK postcode SW1A" → Westminster Abbey
> "What's German PLZ 10115?" → Berlin
> "Japanese postal code 100-0001" → Chiyoda
70+ countries, same tool, same natural language interface.
Validate Postal Codes
Ask Claude to validate:
> "Is 99999 a valid US ZIP code?" → INVALID
> "Is SW1A a valid UK postcode?" → VALID
Useful when building forms and you want to sanity-check input with your AI assistant.
Next Steps
The PostalDataPI MCP server is open source and free to use with your API key. Sign up at postaldatapi.com for 1,000 free queries, install the MCP server, and start asking Claude about postal codes. Check the GitHub repo for the latest updates.