Baidu Maps MCP Server is a comprehensive mapping service that implements the Model Context Protocol (MCP), making it the first map service provider in China compatible with this protocol. It offers 10 standard API interfaces for location-based services including reverse geocoding, place search, and route planning.
Before getting started, you need to obtain an API key (AK) from the Baidu Maps Open Platform console. This server key allows you to access the Baidu Maps API capabilities.
If you have uv installed, you can use uvx to run the MCP server directly:
uvx mcp-server-baidu-maps
Install the package using pip:
pip install mcp-server-baidu-maps
After installation, run the server with:
python -m mcp_server_baidu_maps
Make sure you have Node.js installed. Verify your installation by running:
node -v
Add the following configuration to your MCP client (e.g., Claude.app), replacing <YOUR_API_KEY>
with your actual Baidu Maps API key:
When using uvx:
{
"mcpServers": {
"baidu-maps": {
"command": "uvx",
"args": ["mcp-server-baidu-maps"],
"env": {
"BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>"
}
}
}
}
When using pip installation:
{
"mcpServers": {
"baidu-maps": {
"command": "python",
"args": ["-m", "mcp_server_baidu_maps"],
"env": {
"BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>"
}
}
}
}
Open Claude for Desktop's settings, switch to the Developer tab, and click "Edit Config". Add the following configuration, replacing "xxx" with your actual API key:
For most systems:
{
"mcpServers": {
"baidu-map": {
"command": "npx",
"args": [
"-y",
"@baidumap/mcp-server-baidu-map"
],
"env": {
"BAIDU_MAP_API_KEY": "xxx"
}
}
}
}
For Windows systems:
"mcpServers": {
"baidu-map": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@baidumap/mcp-server-baidu-map"
],
"env": {
"BAIDU_MAP_API_KEY": "xxx"
},
}
}
Restart your MCP client after saving the configuration to use the Baidu Maps MCP Server.
The server provides the following 10 MCP-compatible API services:
map_geocode
)Converts addresses into geographic coordinates.
address
(address information)location
(latitude and longitude coordinates)map_reverse_geocode
)Gets address details from coordinates.
latitude
, longitude
formatted_address
, uid
, addressComponent
, etc.map_search_places
)Searches for places within cities or circular areas.
query
: Keywords (comma-separated)tag
: Type preferences (e.g., "food,hotel")region
: Administrative regionlocation
: Center point coordinates (lat,lng)radius
: Search radiusmap_place_details
)Retrieves detailed information about a specific place.
uid
(POI unique identifier)map_directions_matrix
)Calculates distances and travel times for multiple routes.
origins
: List of starting coordinatesdestinations
: List of ending coordinatesmodel
: Route type (driving, walking, riding)map_directions
)Plans travel routes between locations.
origin
: Starting locationdestination
: Ending locationmodel
: Travel type (driving, walking, riding, transit)map_weather
)Retrieves weather information for locations.
district_id
: Administrative region codelocation
: Coordinates (lng,lat)map_ip_location
)Locates users based on IP address.
ip
(defaults to user's IP)map_road_traffic
)Queries real-time traffic congestion.
map_poi_extract
)Extracts POI information from text (requires advanced permissions).
text_content
(text containing location information)You can also integrate the Baidu Maps MCP Server with Baidu's Qianfan AppBuilder platform:
import os
import asyncio
import appbuilder
from appbuilder.core.console.appbuilder_client.async_event_handler import (
AsyncAppBuilderEventHandler,
)
from appbuilder.mcp_server.client import MCPClient
class MyEventHandler(AsyncAppBuilderEventHandler):
# Event handler implementation
# ...
async def main():
appbuilder.logger.setLoglevel("DEBUG")
app_id = "" # Your published app ID
appbuilder_client = appbuilder.AsyncAppBuilderClient(app_id)
mcp_client = MCPClient()
# Path to your local MCP Server file
await mcp_client.connect_to_server("./<YOUR_FILE_PATH>/map.py")
print(mcp_client.tools)
await agent_run(
appbuilder_client,
mcp_client,
'Drive from Beijing to Shanghai', # Your query
)
await appbuilder_client.http_client.session.close()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Some advanced capabilities require special permissions. If needed, please contact Baidu Maps for access.
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.