AMap Maps MCP Server provides a Model Context Protocol server for the AMap Maps API, allowing you to integrate AMap's location-based services into compatible MCP clients like Cursor or Claude. It enables access to various location services including geocoding, routing, and POI search through a standardized protocol.
Before setting up the AMap Maps MCP Server, you need to obtain an API key from AMap:
The simplest way to use the AMap Maps MCP Server is through NPX. Add the following configuration to your MCP client's settings:
{
"mcpServers": {
"amap-maps": {
"command": "npx",
"args": ["-y", "@masx200/amap-maps-mcp-server"],
"env": {
"AMAP_MAPS_API_KEY": "your-amap-api-key"
}
}
}
}
Replace your-amap-api-key
with the API key you obtained from the AMap developer platform.
The AMap Maps MCP Server supports the following environment variables:
AMAP_MAPS_API_KEY
: Your AMap API key (required)HTTP_API_TOKEN
: HTTP API access token (optional)HTTP_API_PORT
: HTTP server port number (optional, defaults to 3000)To use AMap Maps MCP Server with Cursor:
The AMap Maps MCP Server can also run as a standalone streamable-HTTP protocol server:
node ./build/streamable-http.js
# Set port (default 3000)
export HTTP_API_PORT=3000
# Set access token (optional)
export HTTP_API_TOKEN=your-secret-token
# Set AMap API key
export AMAP_MAPS_API_KEY=your-amap-api-key
# Start the server
node ./build/streamable-http.js
Once started, the server runs at http://localhost:3000
and supports:
POST /mcp
- MCP protocol communication endpointIf you've set an HTTP_API_TOKEN
, add the following header to your requests:
Authorization: Bearer your-secret-token
The AMap Maps MCP Server provides access to various location-based services:
AMap Maps provides geocoding, weather information, distance measurement, and route planning for various transportation modes.
The usage limits depend on your API key and the specific service being used. Please refer to the AMap documentation for details.
You can obtain an API key by creating a project on the AMap developer platform.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "amap-maps" '{"command":"npx","args":["-y","@masx200/amap-maps-mcp-server"],"env":{"AMAP_MAPS_API_KEY":"\u60a8\u5728\u9ad8\u5fb7\u5b98\u7f51\u4e0a\u7533\u8bf7\u7684key"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"amap-maps": {
"command": "npx",
"args": [
"-y",
"@masx200/amap-maps-mcp-server"
],
"env": {
"AMAP_MAPS_API_KEY": "\u60a8\u5728\u9ad8\u5fb7\u5b98\u7f51\u4e0a\u7533\u8bf7\u7684key"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"amap-maps": {
"command": "npx",
"args": [
"-y",
"@masx200/amap-maps-mcp-server"
],
"env": {
"AMAP_MAPS_API_KEY": "\u60a8\u5728\u9ad8\u5fb7\u5b98\u7f51\u4e0a\u7533\u8bf7\u7684key"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect