@yhwancha/mylocation-mcp
v1.0.15
Published
MCP server for location services
Maintainers
Readme
Location MCP Server
A Model Context Protocol (MCP) server that provides location information based on IP addresses or coordinates. This server can be integrated with Cursor AI to provide location context for AI operations.
Features
- 🌍 Get location from IP address
- 📍 Get location from coordinates
- 🔍 IP-based geolocation using IPInfo service
- ✅ Health check endpoint
- 🔒 CORS enabled
- 📦 Easy integration with Cursor AI
Installation
npm install -g @yhwancha/mylocation-mcpUsage with Cursor AI
Add the following configuration to your Cursor AI settings:
{
"mcpServers": {
"location": {
"command": "npx",
"args": [
"-y",
"@yhwancha/mylocation-mcp"
],
"env": {
"IPINFO_TOKEN": "<YOUR_IPINFO_TOKEN>"
}
}
}
}Replace <YOUR_IPINFO_TOKEN> with your IPInfo API token. You can get one at IPInfo.
API Endpoints
GET /get-location
Get location information either from IP address or coordinates.
Using IP Address
GET /get-locationResponse:
{
"status": "success",
"source": "ip_based",
"data": {
"ip": "8.8.8.8",
"city": "Mountain View",
"region": "California",
"country": "US",
"org": "Google LLC",
"latitude": 37.386,
"longitude": -122.0838
}
}Using Coordinates
GET /get-location?latitude=37.7749&longitude=-122.4194Response:
{
"status": "success",
"source": "user_provided",
"data": {
"latitude": 37.7749,
"longitude": -122.4194
}
}GET /health
Check the health status of the server.
GET /healthResponse:
{
"status": "healthy",
"service": "location-mcp"
}Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| IPINFO_TOKEN | Your IPInfo API token | Yes |
| PORT | Server port (default: 6000) | No |
Error Handling
The server returns appropriate HTTP status codes and error messages:
400- Bad Request (invalid coordinates or missing IP)500- Internal Server Error
Error response format:
{
"status": "error",
"error": "Error message here"
}Development
- Clone the repository:
git clone https://github.com/yhwancha/mylocation-mcp.git- Install dependencies:
npm install- Create a
.envfile:
IPINFO_TOKEN=your_token_here
PORT=6000- Start development server:
npm run build
npm startLicense
MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
