Get My Location
@mcpchina
获取用户当前的精准位置,配合天气、地图等需要基于位置提供服务的MCP时有奇效
Overview
What is Get My Location?
Get My Location is an MCP (Model Context Protocol) server that obtains a user’s precise geographic location by opening a browser for manual permission authorization. It is designed for AI assistants or applications that need real‑time latitude/longitude coordinates, works cross‑platform (Windows, macOS, Linux), and communicates via stdio.
How to use Get My Location?
Install the server by running npx -y @mcpcn/mcp-get-location and add it to your MCP client’s configuration under the mcpServers key. No environment variables are required. After configuration, call the get_location tool – the server will automatically open a browser, ask you to grant location permission, poll for the position for up to 60 seconds, and return the coordinates.
Key features of Get My Location
- Obtains precise location via browser geolocation API
- Automatically opens the browser for user permission
- Polls location data; 60‑second timeout if no response
- Cross‑platform (Windows, macOS, Linux)
- Returns latitude and longitude as a JSON object
- No external API keys or configuration files needed
Use cases of Get My Location
- Answer “Where am I?” by returning current coordinates
- Provide location context to a weather MCP server for local forecasts
- Supply starting coordinates to a map/directions MCP server for route planning
- Enable location‑aware prompts in AI assistants without manual coordinate input
FAQ from Get My Location
What tool does Get My Location expose?
It exposes a single tool called get_location, which takes no parameters and returns latitude and longitude.
Does the server need an internet connection?
Yes. A network connection is required to access the browser geolocation service and to communicate with external APIs during the polling process.
How long does the server wait for a location?
It polls for up to 60 seconds. If the user does not grant permission or no location is obtained within that time, a timeout error is returned.
What runtime or dependencies are needed?
You need Node.js (npx) and a modern web browser. The server itself is a TypeScript package published on npm and uses MCP SDK 1.12.0.
How is the location data transported and authenticated?
The server communicates via stdio (standard input/output) with the MCP host. Authentication is handled entirely by the browser’s built‑in geolocation permission prompt – no additional credentials are needed.