GrabMaps MCP Server

GrabMaps MCP Server

Provides access to GrabMaps services (Places, Maps, Routes) through AWS Location Service using the Model Context Protocol.

Category
访问服务器

README

GrabMaps MCP Server

A Model Context Protocol (MCP) server for GrabMaps API integration, providing access to GrabMaps services through AWS Location Service.

Do note that this MCP server is NOT officially affiliated with Grab, GrabMaps, or AWS Location Service.

Important: GrabMaps only supports eight countries in Southeast Asia.

  • 🇲🇾 Malaysia (MYS)
  • 🇸🇬 Singapore (SGP)
  • 🇹🇭 Thailand (THA)
  • 🇲🇲 Myanmar (MMR)
  • 🇰🇭 Cambodia (KHM)
  • 🇻🇳 Vietnam (VNM)
  • 🇵🇭 Philippines (PHL)
  • 🇮🇩 Indonesia (IDN)

Search requests outside these countries will not return accurate results.

Features

This MCP server provides access to GrabMaps functionality through two main categories:

Places Actions (Available via MCP)

  • SearchPlaceIndexForText: Forward geocoding to find places by name or address
  • SearchPlaceIndexForPosition: Reverse geocoding to find places by coordinates
  • SearchPlaceIndexForSuggestions: Get place suggestions as you type
  • GetPlace: Retrieve detailed information about a specific place

Routes Actions (Available via MCP)

  • CalculateRoute: Calculate routes between points with waypoints
  • CalculateRouteMatrix: Calculate a matrix of routes between multiple origins and destinations

Maps Functionality (Requires AWS Console)

Note: Map rendering functionality is not directly available through the MCP server. To view and use maps:

  1. Go to the AWS Location Service console
  2. Look for the Maps section and click the "Try it" button
  3. Ensure "Grab" is selected as the provider

To explore GrabMaps data coverage and see the maps in action without logging in to AWS, visit: https://grabmaps.grab.com/explore-data-coverage

Installation

From NPM

npm install mcp-grabmaps

From Source

git clone https://github.com/hithereiamaliff/mcp-grabmaps.git
cd mcp-grabmaps
npm install

Configuration

Create a .env file in the root directory with the following variables:

# GrabMaps API credentials
GRABMAPS_API_KEY=your_grabmaps_api_key_here

# AWS credentials for AWS Location Service
AWS_ACCESS_KEY_ID=your_aws_access_key_id_here
AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key_here
AWS_REGION=ap-southeast-5  # Default region for Malaysia (ap-southeast-1 for Singapore)

# Place Index name (default for GrabMaps)
PLACE_INDEX_NAME=explore.place.Grab

# Map name (for rendering maps)
MAP_NAME=explore.map.Grab

# Route calculator name
ROUTE_CALCULATOR_NAME=explore.route-calculator.Grab

# Server port
PORT=3000

Usage

Running Locally

# Development mode
npm run dev

# Production mode
npm run build
npm start

Using with Smithery

# Run in development mode
npm run smithery:dev

# Build for production
npm run smithery:build

# Deploy to Smithery
npm run smithery:deploy

Testing in Smithery Playground

For the best experience testing Places and Routes APIs, we recommend using the Smithery playground:

  1. Start your MCP server locally: npm run dev
  2. Open the Smithery playground at: https://smithery.ai/playground
  3. Connect to your local MCP server: http://localhost:3000
  4. Test Places and Routes API calls using the provided examples in SMITHERY_TESTING.md

Important Notes for AI Models

Supported Countries

GrabMaps ONLY supports the following eight countries in Southeast Asia:

  • Malaysia (MYS)
  • Singapore (SGP)
  • Thailand (THA)
  • Myanmar (MMR)
  • Cambodia (KHM)
  • Vietnam (VNM)
  • Philippines (PHL)
  • Indonesia (IDN)

AI models should not attempt to use GrabMaps for locations outside these countries as results will be inaccurate or non-existent.

Country Code Requirements

When using the Places API functions, AI models MUST analyze the user's query to determine the appropriate country and include the three-letter ISO country code in all requests:

{
  "query": "City Square Mall",
  "country": "SGP"  // SGP for Singapore, MYS for Malaysia, THA for Thailand, etc.
}

Examples of country codes:

  • Singapore: SGP
  • Malaysia: MYS
  • Thailand: THA
  • Indonesia: IDN
  • Philippines: PHL
  • Vietnam: VNM

Including the country code is critical for returning accurate search results.

This approach allows you to test the Places and Routes functionality without needing to set up map visualization components.

Example API Calls

Forward Geocoding

const response = await fetch('http://localhost:3000/searchPlaceIndexForText', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: 'KLCC, Kuala Lumpur',
    country: 'my',
    maxResults: 5
  })
});

const data = await response.json();
console.log(data);

Calculate Route

const response = await fetch('http://localhost:3000/calculateRoute', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    origin: {
      longitude: 101.6942371,
      latitude: 3.1516964
    },
    destination: {
      longitude: 101.7113,
      latitude: 3.1421
    },
    travelMode: 'Car'
  })
});

const data = await response.json();
console.log(data);

Integrating with AI Models

This MCP server can be integrated with AI models that support the Model Context Protocol. Example integration with an AI model:

// Example of how an AI model would use this MCP server
const result = await mcpClient.call('grabmaps', 'searchPlaceIndexForText', {
  query: 'KLCC, Kuala Lumpur',
  country: 'my'
});

// The AI model can then use the result in its response
console.log(`The coordinates of KLCC are: ${result.results[0].coordinates.latitude}, ${result.results[0].coordinates.longitude}`);

AWS Location Service Setup

Before using this MCP server, you need to set up the following resources in AWS Location Service:

  1. Create a Place Index with GrabMaps as the data provider
  2. Create a Map with GrabMaps as the data provider
  3. Create a Route Calculator with GrabMaps as the data provider

Map Component Limitations and Recommended Approach

The Maps API components have certain limitations when used through the MCP server:

  • Map tiles returned by the getMapTile endpoint are binary data encoded as base64 strings
  • Font stacks for getMapGlyphs must match those supported by GrabMaps via AWS Location Service
  • Sprite filenames for getMapSprites must follow specific regex patterns
  • Maximum zoom levels are restricted (typically max zoom 14)

Recommended Approach:

  • For Maps: Use direct integration with GrabMaps via MapLibre GL and AWS Location Service as shown in the official demo
  • For Places and Routes: Use the MCP server through the Smithery playground or direct API calls

This separation allows for optimal performance and visualization while still leveraging the MCP server for Places and Routes functionality.

Official GrabMaps MapLibre GL Demo

A comprehensive demo using the official GrabMaps integration with MapLibre GL is included in the examples/official-map-demo directory. This demo provides a complete testing interface for all GrabMaps components:

  • Places API: Forward/reverse geocoding and place details
  • Maps API: Map tiles, style descriptors, sprites, and glyphs
  • Routes API: Route calculation and route matrix

The demo features a tabbed interface for easy testing of different components and provides detailed feedback for each API call.

Key Features

  • Interactive map using official GrabMaps map tiles via MapLibre GL
  • Tabbed interface for testing different GrabMaps components
  • Comprehensive testing of all API endpoints
  • Configurable API key, region, and resource names
  • Visual display of routes, search results, and map components

To run the demo:

# Start the MCP server
npm start

# Then open examples/official-map-demo/index.html in your browser

See the Official Map Demo README for setup and usage instructions.

Testing

A comprehensive test suite is included in the tests directory to verify all endpoints are working correctly. For detailed testing instructions, examples, and troubleshooting tips, please refer to the TESTING.md file.

To run the tests:

# Start the MCP server in one terminal
npm start

# Run the test suite in another terminal
node tests/test-suite.js

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选