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
6.5K downloads
307 stars

Baidu Map MCP Server is a comprehensive Location-Based Service solution that implements the Model Context Protocol (MCP), allowing seamless integration between large language models, AI agents, and geospatial services. It provides a rich set of mapping capabilities including geocoding, POI search, route planning, weather information, and more.

Installation

Python Installation

Install the Python SDK using pip:

pip install mcp-server-baidu-maps

Run the server directly:

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 server, you'll need to register and create a server-side API Key:

  1. Visit the Baidu Maps Open Platform
  2. Register and create a server-side API Key (AK)
  3. Ensure you enable the "MCP (SSE)" service for optimal performance

Configuration

Python Configuration

When using with an MCP client (such as Claude or Cursor), configure as follows:

{
  "mcpServers": {
    "baidu-maps": {
      "command": "python",
      "args": ["-m", "mcp_server_baidu_maps"],
      "env": {
        "BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}

Node.js/TypeScript 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>"
      }
    }
  }
}

SSE Configuration (Recommended)

For low-latency and stable access, it's recommended to use Server-Sent Events (SSE). Refer to the SSE Quickstart for detailed setup instructions.

Available Tools

Baidu Map MCP Server provides the following MCP-compliant APIs:

Tool Name Description
map_geocode Convert addresses to geographic coordinates
map_reverse_geocode Get address information from coordinates
map_search_places Search for POIs by keyword, type, region, or radius
map_place_details Get detailed information for a POI by its ID
map_directions_matrix Calculate routes for multiple origins/destinations
map_directions Plan routes between two points with various transit modes
map_weather Query weather data by region or coordinates
map_ip_location Determine location from IP address
map_road_traffic Get real-time traffic conditions
map_poi_extract* Extract POI information from text (requires special permission)

*Note: Some advanced features require additional permissions.

Use Cases

Travel Planning Assistant

Combine multiple tools to create a comprehensive travel assistant:

# Search for tourist attractions
places = map_search_places(query="tourist attractions", region="Beijing", page_size=5)

# Get directions between locations
route = map_directions(
    origin="39.9042,116.4074",  # Beijing city center
    destination=places[0]["location"],
    mode="transit"
)

# Check weather at the destination
weather = map_weather(location=places[0]["location"])

Logistics Optimization

Calculate multiple routes simultaneously for delivery planning:

routes_matrix = map_directions_matrix(
    origins=["39.9042,116.4074", "39.9975,116.3038"],  # Multiple starting points
    destinations=["40.0096,116.3168", "39.9837,116.3229"],  # Multiple destinations
    mode="driving"
)

Real-time Traffic Navigation

Create context-aware navigation by combining traffic and weather data:

# Get current traffic conditions
traffic = map_road_traffic(road_name="Chang'an Avenue", city="Beijing")

# Check weather along route
weather = map_weather(location="Beijing")

# Calculate optimal route considering traffic
route = map_directions(
    origin="39.9042,116.4074",
    destination="40.0096,116.3168",
    mode="driving"
)

Additional Resources

For more detailed information and advanced usage, refer to these resources:

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