whereami-mcp

whereami-mcp:轻量级MCP服务器,通过IP地址为AI模型提供精准定位信息,支持自然语言查询。

whereami-mcp
whereami-mcp Capabilities Showcase

whereami-mcp Solution Overview

WhereAmI MCP server is a lightweight solution designed to provide AI models with geolocation data based on IP address. It offers dynamic resources, allowing models to fetch specific data points like IP, country, or city using the location://{type} format. For a comprehensive overview, the get_location() tool generates a detailed location report in Markdown table format.

This server seamlessly integrates with AI models, enabling them to answer location-based queries or personalize responses based on geographic data. A natural language prompt, "Where am I?", is also supported for ease of use. WhereAmI MCP excels in its simplicity, requiring minimal dependencies (mcp and httpx) and offering robust error handling for API and network issues. It can be easily installed as an MCP service or run directly, providing a quick and efficient way to enhance AI models with location awareness.

whereami-mcp Key Capabilities

Dynamic Location Resources

The whereami-mcp server provides dynamic access to geolocation data through the location://{type} resource. This feature allows AI models to request specific pieces of information about their current location, such as IP address, country, city, or timezone. The server leverages the ipapi.co service to resolve the IP address and retrieve the corresponding location details. This is particularly useful for AI models that need to personalize responses based on the user's location or for applications that require location-aware functionality. For example, an AI assistant could use @location://city and @location://country to provide localized weather updates or suggest nearby restaurants. The dynamic nature of the resource ensures that the AI model always receives the most up-to-date location information. The implementation relies on httpx to make API calls to ipapi.co and returns the data in a string format.

Detailed Location Report Tool

The get_location() tool offers a comprehensive report of geolocation data in a structured Markdown table. This tool aggregates various data points, including IP address, country, region, city, latitude, longitude, timezone, ISP, and ASN, providing a holistic view of the AI model's location. This is valuable for debugging, auditing, or when an AI model needs to present a complete location profile. For instance, a security AI could use this tool to log the location of each interaction for threat analysis. The Markdown format ensures readability and easy integration into reports or other documentation. The tool internally calls the ipapi.co API and formats the response into a Markdown table using string formatting.

Natural Language Location Prompt

The whereami-mcp server includes a predefined prompt, "Where am I?", that triggers the get_location() tool. This allows users to obtain a detailed location report using a simple, natural language query. This feature simplifies the interaction with the server and makes it more accessible to non-technical users. For example, in a chatbot interface, a user could simply ask "Where am I?" and the AI model would automatically retrieve and display the detailed location report. This enhances the user experience by providing a seamless and intuitive way to access location information. The prompt is configured within the server to directly invoke the get_location() tool when matched.

Minimal Dependencies

The whereami-mcp server is designed with minimal dependencies, requiring only mcp and httpx. This lightweight design simplifies installation, reduces the risk of dependency conflicts, and improves overall performance. This is particularly beneficial in resource-constrained environments or when deploying the server as part of a larger system. The small footprint makes it easy to integrate the server into existing MCP ecosystems without introducing unnecessary overhead. The server leverages mcp for handling the MCP protocol and httpx for making HTTP requests to the ipapi.co API.