Baidu Maps MCP server

Integrates with Baidu Maps API for location-based operations including geocoding, route planning, and location search within the Baidu Maps ecosystem.
Back to servers
Setup instructions
Provider
Baidu Maps
Release date
Mar 20, 2025
Language
TypeScript
Package
Stats
7.7K downloads
312 stars

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.

Installation Options

Python Installation

Install the Python SDK using pip:

pip install mcp-server-baidu-maps

Run as a standalone script:

python -m mcp_server_baidu_maps

Node.js/TypeScript Installation

Install the package using npm:

npm install @baidumap/mcp-server-baidu-map

Getting an API Key

Before using the MCP server, you'll need to:

  1. Register and create a server-side API Key (AK) at Baidu Maps Open Platform
  2. Be sure to enable "MCP (SSE)" service for best performance

Configuration

Python Client Configuration

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>"
      }
    }
  }
}

Node.js Client Configuration

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>"
      }
    }
  }
}

Using SSE for Better Performance

For low-latency and stable access, it's recommended to use Server-Sent Events (SSE). Check the quickstart guide at SSE Quickstart.

Available Tools and APIs

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 Cases

Travel Planning Assistant

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.

Batch Route Matrix

Use map_directions_matrix to calculate multiple routes and durations for logistics or delivery optimization.

Real-time Traffic & Weather-aware Navigation

Combine map_road_traffic and map_weather for dynamic, context-aware travel suggestions.

Additional Resources

For more detailed information on specific APIs, you can refer to:

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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>"
            }
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later