WhereAmI MCP 服务器
轻量级 mcp 服务器,根据您当前的 IP 准确告诉您您所在的位置,由ipapi.co提供支持。
特征
动态资源:通过
location://{type}获取特定数据(例如,IP、国家、城市)。详细工具:使用
get_location()生成全面的位置报告。自然语言提示:询问“我在哪里?”即可获得详细结果。
强大的错误处理:优雅地管理 API 和网络问题。
最小依赖:仅需要
mcp和httpx。
安装
先决条件
Python 3.10+
pip
设置
克隆存储库:
git clone https://github.com/kukapay/whereami-mcp.git cd whereami-mcp安装依赖项:
pip install mcp httpx(可选)安装为 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 表。
字段:
知识产权
国家
国家/地区代码
地区
城市
纬度
经度
时区
互联网服务提供商
ASN
示例输出:
| 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中的示例
安装服务器:
mcp install whereami_mcp.py --name "WhereAmI"查询数据:
“我的 IP 是
@location://ip”“我在
@location://city,@location://country”
获取完整报告:
“我在哪儿?”
get_location()
执照
MIT 许可证。详情请参阅许可证。
Related MCP Servers
- AsecurityAlicenseAqualityA lightweight MCP server that tells you exactly who you are.Last updated -11MIT License
- -securityAlicense-qualityAn MCP server for nearby place searches with IP-based location detection.Last updated -21MIT License
- -securityAlicense-qualityA lightweight gateway server that provides a unified connection entry point for accessing multiple MCP servers, supporting various protocols including Network and Local Transports.Last updated -Apache 2.0
- -security-license-qualityA MCP server that uses Amap API to provide location-based services, allowing users to get geographic information based on IP addresses and search for nearby points of interest.Last updated -18