nearby-search-mcp
NearbySearch MCP Server: AI-powered nearby place search using IP-based location.

nearby-search-mcp Solution Overview
The NearbySearch MCP server is a valuable resource for AI models needing location-aware search capabilities. This server empowers models to find nearby places based on a user's IP address, leveraging IP-based geolocation and the Google Places API. Its core functionality includes determining the user's location and searching for places using keywords and optional type filters, such as restaurants or cafes.
This MCP solution addresses the developer need for seamless integration of location-based services into AI applications. The server offers a simple tool endpoint, search_nearby
, with customizable radius, allowing AI models to easily query for relevant nearby locations. By integrating this server, developers can enhance their AI models with accurate and context-aware search functionality, improving user experience and providing more relevant results. It's implemented in Python and integrates smoothly with the MCP ecosystem via standard client configurations.
nearby-search-mcp Key Capabilities
IP-Based Location Detection
This feature allows the AI model to automatically determine the user's approximate location based on their IP address. It leverages the ipapi.co service to geolocate the user, eliminating the need for the user to manually input their location. This is crucial for providing location-aware services without requiring explicit user permission for location data, which can improve user experience and privacy. The IP-based location detection provides a foundation for subsequent nearby place searches.
For example, a travel planning AI could use this feature to suggest nearby restaurants or attractions without asking the user for their current location. This simplifies the interaction and makes the AI more proactive in providing relevant recommendations. The implementation involves making an API call to ipapi.co with the user's IP address and parsing the response to extract the latitude and longitude coordinates.
Google Places Integration
This feature integrates the MCP with the Google Places API, enabling the AI model to search for nearby places based on keywords and optional filters. It allows the AI to find specific types of establishments (e.g., restaurants, cafes, parks) within a defined radius of the user's location. The integration provides access to a vast database of places, complete with details like name, address, rating, and user reviews. This allows the AI to provide rich and informative recommendations to the user.
Imagine a user asking an AI assistant, "Find me a coffee shop with Wi-Fi nearby." The Google Places Integration would allow the AI to query the Google Places API with the keyword "coffee shop" and the "Wi-Fi" attribute, returning a list of nearby coffee shops that meet the criteria. The AI can then present this information to the user in a clear and concise manner. This feature requires a Google Cloud Platform API key with the Places API enabled.
Simple Search Interface
The search_nearby
tool provides a straightforward and easy-to-use interface for AI models to initiate nearby place searches. It abstracts away the complexities of interacting directly with the Google Places API, offering a single endpoint with well-defined parameters: keyword
, radius
, and type
. This simplifies the integration process for developers and allows them to quickly incorporate location-based search functionality into their AI applications. The default radius of 1500 meters provides a reasonable search area, while the optional type
parameter allows for more specific searches.
For instance, a chatbot designed to help users find local services could use this tool to search for "pharmacies" or "grocery stores" near the user's location. The chatbot would simply need to call the search_nearby
tool with the appropriate parameters, and the MCP server would handle the rest. This streamlined interface makes it easy for AI models to access and utilize the power of the Google Places API.