Skip to main content
Glama
PostalDataPI MCP Server

PostalDataPI MCP Server

by PostalDataPI

PostalDataPI MCP 服务器

License: MIT Python 3.10+ PyPI

PostalDataPI 的 MCP (Model Context Protocol) 服务器——让 AI 智能体能够查询、验证和搜索全球 240 多个国家和地区的邮政编码,并获取丰富的元数据:时区、行政区域、海拔和坐标。

工具

工具

描述

lookup_postal_code

获取邮政编码(如美国 ZIP、英国邮编、德国 PLZ 等)对应的城市、州/地区及缩写

validate_postal_code

检查某个国家是否存在该邮政编码

search_by_city

查找某个城市的所有邮政编码

get_postal_code_metadata

获取完整元数据:坐标、行政层级、时区、海拔等

Related MCP server: ZipExplore MCP Server

设置

1. 获取 API 密钥

在 postaldatapi.com/register 注册——无需信用卡,即可获得 1,000 次免费查询。

2. 安装

pip install postaldatapi-mcp

3. 配置 Claude Code

claude mcp add --transport stdio postaldatapi -- \
  env POSTALDATAPI_KEY=your_api_key_here postaldatapi-mcp

4. 配置 Claude Desktop

添加到您的 Claude Desktop 配置文件中(macOS 上位于 ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "postaldatapi": {
      "command": "postaldatapi-mcp",
      "env": {
        "POSTALDATAPI_KEY": "your_api_key_here"
      }
    }
  }
}

使用方法

配置完成后,您可以自然地询问 Claude:

  • “邮政编码 90210 是哪个城市?”

  • “查询英国邮编 SW1A”

  • “10115 是有效的德国邮政编码吗?”

  • “加利福尼亚州比佛利山庄的邮政编码有哪些?”

  • “获取日本邮政编码 100-0001 的坐标”

Claude 将自动使用 PostalDataPI 工具来回答。

支持的国家/地区

涵盖美国、英国、加拿大、德国、法国、日本、澳大利亚、巴西、印度等 240 多个国家和地区。查看完整列表请访问 postaldatapi.com/countries。

丰富的元数据

除了基础查询外,get_postal_code_metadata 工具每个邮政编码最多可返回 18 个字段,包括:

  • 坐标(纬度、经度)

  • 时区(例如 America/Mexico_City, Europe/Berlin)

  • 行政层级(州/省、县、市)

  • 海拔(海拔高度,单位:米)

  • 地名和国家信息

墨西哥城 06000 的响应示例:

{
  "postalCode": "06000",
  "country": "MX",
  "placeName": "Centro",
  "latitude": 19.4364,
  "longitude": -99.1553,
  "timezone": "America/Mexico_City",
  "adminLevel1": "Ciudad de México",
  "adminLevel2": "Cuauhtémoc",
  "elevation": 2239
}

链接

Available Tools

4 tools
get_postal_code_metadataA

Get full metadata for a postal code including coordinates.

Returns latitude, longitude, county/municipality, and all available country-specific fields. Use this when someone needs geographic coordinates, timezone, or detailed location data for a postal code.

Args: postal_code: The postal code to look up country: ISO 3166-1 alpha-2 country code. Defaults to "US".

Returns: Full metadata including coordinates, region, and country-specific fields.

Inputs: postal_code (required), country. Returns: result

lookup_postal_codeA

Look up a postal code and get city, state, and region information.

Works for ZIP codes (US), postcodes (UK), PLZ (Germany), and postal codes in 70+ countries. Use this when someone asks about a postal code, wants to know what city a ZIP code belongs to, or needs address information.

Args: postal_code: The postal code to look up (e.g., "90210", "SW1A", "10115", "100-0001") country: ISO 3166-1 alpha-2 country code (e.g., "US", "GB", "DE", "JP"). Defaults to "US".

Returns: City, state/region, and abbreviation for the postal code.

Inputs: postal_code (required), country. Returns: result

search_by_cityA

Find all postal codes for a given city.

Use this when someone has a city name and needs the postal codes that serve it. For US cities, provide the state name or 2-letter abbreviation.

Args: city: City name (e.g., "Beverly Hills", "Berlin", "Tokyo") state: State or region name/abbreviation. Required for US cities (e.g., "CA" or "California"). country: ISO 3166-1 alpha-2 country code. Defaults to "US".

Returns: List of postal codes for the city.

Inputs: city (required), state, country. Returns: result

validate_postal_codeA

Check whether a postal code exists in a given country.

Use this when someone wants to verify if a postal code is valid before processing an order, form, or address.

Args: postal_code: The postal code to validate country: ISO 3166-1 alpha-2 country code. Defaults to "US".

Returns: Whether the postal code is valid or invalid.

Inputs: postal_code (required), country. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 4 tools

    Disambiguation4/5

    The tools have distinct primary purposes: get_postal_code_metadata for detailed geographic data, lookup_postal_code for basic address information, search_by_city for reverse lookup, and validate_postal_code for validation. However, get_postal_code_metadata and lookup_postal_code could be confused as both retrieve postal code information, though their descriptions clarify different use cases.

    Naming Consistency5/5

    All tool names follow a consistent snake_case pattern with clear verb_noun structure: get_postal_code_metadata, lookup_postal_code, search_by_city, validate_postal_code. The naming is predictable and readable throughout the set.

    Tool Count5/5

    With 4 tools, this is well-scoped for a postal code data server. Each tool serves a distinct function in the domain, and the count is appropriate for covering core operations without being overwhelming or insufficient.

    Completeness4/5

    The toolset covers key postal code operations: lookup, validation, reverse search, and metadata retrieval. A minor gap exists in lacking explicit update or delete operations, but these are not typically needed for a read-only data service, and agents can work effectively with the provided tools.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      UK address (Royal Mail PAF), email, and phone (live HLR carrier) validation via the Postio API. Six tools: address search, postcode lookup, UDPRN, email validate, phone validate, and a health probe.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables location intelligence for US ZIP codes, allowing users to search, profile, and compare ZIP codes across various domains like crime, income, schools, and more.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides address validation and geocoding for 240+ countries, including UK Royal Mail PAF and US/Canada census enrichment. Enables batch validation, forward/reverse geocoding, UK postcode expansion, and automatic refunds for failed lookups.
      76 PyPI
      MIT