Baidu Map MCP Server is a comprehensive Location-Based Service (LBS) solution that supports the Model Context Protocol (MCP), enabling seamless integration between large language models, AI agents, and real-world location services. It provides a wide range of geospatial capabilities including mapping, geocoding, POI search, route planning, weather information, and more.
Install the Python SDK using pip:
pip install mcp-server-baidu-maps
Run as a standalone script:
python -m mcp_server_baidu_maps
Install the package using npm:
npm install @baidumap/mcp-server-baidu-map
Before using the MCP server, you'll need to:
Configure in your MCP client (e.g., Claude, Cursor):
{
"mcpServers": {
"baidu-maps": {
"command": "python",
"args": ["-m", "mcp_server_baidu_maps"],
"env": {
"BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>"
}
}
}
}
Configure in your MCP client:
{
"mcpServers": {
"baidu-map": {
"command": "npx",
"args": [
"-y",
"@baidumap/mcp-server-baidu-map"
],
"env": {
"BAIDU_MAP_API_KEY": "<YOUR_API_KEY>"
}
}
}
}
For low-latency and stable access, it's recommended to use Server-Sent Events (SSE). Check the quickstart guide at SSE Quickstart.
Baidu Map MCP Server provides the following MCP-compliant APIs:
Tool Name | Description |
---|---|
map_geocode |
Convert address to geographic coordinates |
map_reverse_geocode |
Get address, region, and POI info from coordinates |
map_search_places |
Search for global POIs by keyword, type, region, or within a radius |
map_place_details |
Get detailed info for a POI by its unique ID |
map_directions_matrix |
Batch route planning for multiple origins/destinations |
map_directions |
Plan routes between two points (driving, walking, cycling, transit) |
map_weather |
Query real-time and forecast weather by region or coordinates |
map_ip_location |
Locate city and coordinates by IP address |
map_road_traffic |
Query real-time traffic conditions for roads or regions |
map_poi_extract * |
Extract POI info from free text (requires advanced permission) |
*Some advanced features require additional permissions.
Use map_search_places
, map_directions
, and map_weather
to build an agent that plans optimal sightseeing routes, checks weather, and recommends points of interest.
Use map_directions_matrix
to calculate multiple routes and durations for logistics or delivery optimization.
Combine map_road_traffic
and map_weather
for dynamic, context-aware travel suggestions.
For more detailed information on specific APIs, you can refer to:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "baidu-map" '{"command":"npx","args":["-y","@baidumap/mcp-server-baidu-map"],"env":{"BAIDU_MAP_API_KEY":"<YOUR_API_KEY>"}}'
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": {
"baidu-map": {
"command": "npx",
"args": [
"-y",
"@baidumap/mcp-server-baidu-map"
],
"env": {
"BAIDU_MAP_API_KEY": "<YOUR_API_KEY>"
}
}
}
}
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": {
"baidu-map": {
"command": "npx",
"args": [
"-y",
"@baidumap/mcp-server-baidu-map"
],
"env": {
"BAIDU_MAP_API_KEY": "<YOUR_API_KEY>"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect