IP定位服务

一个轻量级的MCP服务器,根据当前IP地址提供精确的地理位置信息,包括IP、国家、城市、经纬度等详细数据。

  • by kukapay
  • Python
  • 本地部署
  • 4 星标
  • 更新于
在 GitHub 查看 kukapay/whereami-mcp

使用说明

何处AmI MCP服务器

一个轻量级mcp服务器,根据您当前的IP告诉您的确切位置,由 Pi.co.

特性

  • 动态资源:通过以下方式获取特定数据(例如IP、国家、城市) location://{type}.
  • 详细工具:生成一份全面的位置报告 get_location().
  • 自然语言提示问“我在哪里?”以获得详细的结果。
  • 稳健的错误处理:优雅地管理API和网络问题。
  • 最小依赖性:仅需要 mcp 和 httpx.

安装

先决条件

  • Python 3.10+
  • pip

设置

  1. 克隆存储库:
    git clone https://github.com/kukapay/whereami-mcp.git
    cd whereami-mcp
    
  2. 安装依赖项:
    pip install mcp httpx
    
  3. (可选)作为MCP服务安装:
    mcp install whereami_mcp.py --name "WhereAmI"
    

用法

运行服务器

  • 直接执行:
    python whereami_mcp.py
    
  • 开发模式:
    mcp dev whereami_mcp.py
    

组件

资源: location://{type}

基于以下内容返回特定位置详细信息 {type}.

  • 支持的类型: ip, country, country_code, region, city, latitude, longitude, timezone, isp, asn
  • 例子:
    • @location://ip → "8.8.8.8"
    • @location://city → "Mountain View"
    • @location://country → "United States"

工具: get_location()

生成地理位置数据的详细Markdown表。

  • 领域:
    • 知识产权
    • 国家
    • 国家代码
    • 区域
    • 城市
    • 纬度
    • 经度
    • 时区
    • 互联网服务提供商
    • 自治系统号
  • 样本输出:
    | Field          | Value             |
    |----------------|-------------------|
    | IP            | 8.8.8.8           |
    | Country       | United States     |
    | Country Code  | US                |
    | Region        | California        |
    | City          | Mountain View     |
    | Latitude      | 37.4223           |
    | Longitude     | -122.0848         |
    | Timezone      | America/Los_Angeles |
    | ISP           | GOOGLE            |
    | ASN           | AS15169           |
    

提示: where_am_i_prompt

预定义查询:“请根据我当前的IP地址告诉我我在哪里。”触发器 get_location().

Claude Desktop中的示例

  1. 安装服务器:
    mcp install whereami_mcp.py --name "WhereAmI"
    
  2. 查询数据:
    • “我的IP是 @location://ip"
    • “我进去了 @location://city, @location://country"
  3. 获取完整报告:
    • “我在哪里?”
    • get_location()

许可证

MIT许可证。看 许可证 了解详情。