mcpField
G
Get My Location

Get My Location

Local
github.com/mcpchinaMedia & Design9Updated 66w ago

About Get My Location

通过浏览器授权获取用户经网络定位的经纬度,适用于需要当前位置的 MCP 客户端。服务会打开浏览器请求权限,并轮询最多 60 秒以获取位置。

Key features

  1. 01浏览器授权获取位置
  2. 02自动轮询位置,最长 60 秒
  3. 03返回纬度和经度
  4. 04支持 Windows、macOS、Linux

Use cases

  1. 01查询当前位置
  2. 02将位置提供给天气服务
  3. 03将位置提供给地图服务以规划路线

MCP support

此 MCP 服务通过 `get_location` 工具向客户端返回用户授权后的纬度和经度。通过 stdio 与客户端通信。

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"get-location": {
"command": "npx",
"args": [
"-y",
"@mcpcn/mcp-get-location"
]
}
}
}
Run commandnpx -y @mcpcn/mcp-get-location

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@mcpcn/mcp-get-location

Tools

1

Saved tool list · updated 3w ago

This tool takes no parameters.

Details

From the project README

MCP Location Server

A location acquisition server based on MCP (Model Context Protocol) that obtains precise user location information through browser authorization.

Features

  • 🌍 Get precise user location through browser (network positioning)
  • 🔄 Automatic polling for location information, up to 60 seconds
  • 🌐 Cross-platform support (Windows, macOS, Linux)
  • 📱 Automatically opens browser for location authorization
  • 📍 Returns latitude and longitude coordinates

Use Case Examples

  • Where am I?
  • How's the weather? (combined with weather mcp)
  • How to get to xxx by car/subway/bus? (combined with map mcp)

Direct Use in MCP Client

For stdio installation, configure as follows:

{
  "mcpServers": {
    "get-location": {
      "command": "npx",
      "args": ["-y", "@mcpcn/mcp-get-location"],
      "env": {}
    }
  }
}

Available Tools

get_location

Get user location information through browser authorization.

Parameters: None

Return Value:

{
  "latitude": 39.78463536888209,
  "longitude": 116.50960396229777,
}

Usage Example: After calling this tool, the system will:

  1. Automatically open the browser
  2. Guide user to authorize location permissions
  3. Poll for location information
  4. Return latitude and longitude coordinates

Technical Implementation

  • Based on MCP SDK 1.12.0
  • Developed using TypeScript
  • Communication via stdio
  • Cross-platform browser call support

Notes

  • Requires user to manually authorize location permissions in browser
  • Returns timeout error if location is not obtained within 60 seconds
  • Ensure network connection is normal and can access external APIs

Development and Debugging

# Install dependencies
npm install

# Build
npm run build

# Start development mode
npm start

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.