Data source: Zippopotam.us
Overview
Postal Codes wraps Zippopotam.us, handling authentication, pagination, and rate limits for you. This tutorial covers all 4 tools with working code examples you can copy and run.
Prerequisites
- Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
- Choose your integration method: MCP protocol or REST API.
Connect via MCP
Add to your MCP client config (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"gnist-postal-codes": {
"url": "https://context.gnist.ai/mcp/postal-codes/",
"headers": {
"Gnist-API-Key": "YOUR_API_KEY"
}
}
}
}
Tools (4)
lookup_postal_code
Look up location details for a postal/ZIP code — city, state, country, and coordinates. Supports 70+ countries including US, UK, Norway, Germany, France, Japan, and more.
| Parameter | Type | Required | Description |
|---|---|---|---|
country_code | string | required | ISO 3166-1 alpha-2 country code (e.g. 'US', 'NO', 'DE'). |
postal_code | string | required | Postal or ZIP code to look up (e.g. '90210', '0150'). |
curl -X POST "https://context.gnist.ai/mcp/postal-codes/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "lookup_postal_code", "arguments": {"country_code": "'US'", "postal_code": "'90210'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/postal-codes/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'country_code': "'US'", 'postal_code': "'90210'"},
'name': 'lookup_postal_code'}},
)
print(resp.json())
search_by_place
Find postal codes for a city within a country and state. Useful for reverse lookup — find postal codes when you know the place name.
| Parameter | Type | Required | Description |
|---|---|---|---|
country_code | string | required | ISO 3166-1 alpha-2 country code (e.g. 'US', 'DE'). |
state | string | required | State or province name (e.g. 'California', 'Bayern'). |
city | string | required | City or place name (e.g. 'Los Angeles', 'München'). |
curl -X POST "https://context.gnist.ai/mcp/postal-codes/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_by_place", "arguments": {"country_code": "'US'", "state": "'California'", "city": "'Los"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/postal-codes/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'city': "'Los",
'country_code': "'US'",
'state': "'California'"},
'name': 'search_by_place'}},
)
print(resp.json())
list_supported_countries
List all countries supported for postal code lookup. Returns ISO country codes and names for all 70+ supported countries.
curl -X POST "https://context.gnist.ai/mcp/postal-codes/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_supported_countries", "arguments": {}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/postal-codes/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {}, 'name': 'list_supported_countries'}},
)
print(resp.json())
report_feedback
Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: general) |
curl -X POST "https://context.gnist.ai/mcp/postal-codes/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/postal-codes/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())
Common Patterns
Use
search_by_place to find items, then lookup_postal_code to get full details. This two-step pattern is common for exploring data before drilling down.FAQ
What data does Postal Codes provide?
Postal/ZIP code lookup — city, state, coordinates for 70+ countries. It exposes 4 tools: lookup_postal_code, search_by_place, list_supported_countries, report_feedback.
What do I need to get started?
A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.
What format does the Postal Codes API return?
JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.