MCP ExplorerExplorer

Baidu Maps MCP Server

@baidu-mapson 12 days ago
275 MIT
FreeCommunity
Web Services
#maps#geolocation#geocoding#routing#places#weather#traffic#navigation#MCP#baidu
百度地图API现已全面兼容[MCP协议](https://modelcontextprotocol.io/),是国内首家兼容MCP协议的地图服务商。

Overview

What is Baidu Maps MCP Server

The Baidu Map MCP Server is an open-source Location-Based Service solution that adheres to the Model Context Protocol (MCP). It provides a wide range of geospatial APIs and tools for developers and AI agents, enabling seamless integration of real-world location data with AI technology.

Use cases

Use cases include travel planning assistants that utilize geocoding, route planning, and weather APIs; logistics optimization through batch route calculations; and dynamic navigation solutions that incorporate real-time traffic and weather data. The server can also facilitate text-to-POI extraction for enhanced user interaction.

How to use

To use the Baidu Map MCP Server, developers must first register to obtain an API Key from the Baidu Maps Open Platform. After installation via pip for Python or npm for Node.js, users can run the server and configure it in their MCP clients by specifying the API Key in the environment variables. It is recommended to utilize Server-Sent Events (SSE) for optimal performance.

Key features

Key features include full compliance with the MCP protocol, extensive location-based services such as geocoding, POI search, real-time weather, and traffic analysis. The server offers cross-platform SDKs for Python and TypeScript, enterprise-grade geospatial data, high performance, and extensibility under the MIT License.

Where to use

The Baidu Map MCP Server can be integrated into applications across various sectors like travel and logistics, smart city solutions, navigation apps, and AI agents that require location awareness. It offers essential tools for developers looking to enhance their applications with geospatial intelligence.

Content

中文| English


stars
python
MIT License
pypi
npm


🚀 Introduction

Baidu Map MCP Server is a fully MCP-compliant, open-source Location-Based Service (LBS) solution, providing a comprehensive suite of geospatial APIs and tools for developers and AI agents. As the first map service provider in China to support the Model Context Protocol (MCP), Baidu Map MCP Server bridges the gap between large language models (LLMs), AI agents, and real-world location data and services.

With Baidu Map MCP Server, you can easily empower your applications, LLMs, and agents with advanced mapping, geocoding, POI search, route planning, weather, traffic, and more — all via standardized, developer-friendly MCP interfaces.

Key Features:

  • Full MCP Protocol Support: Seamless integration with any MCP-compliant agent, LLM, or platform.
  • Rich LBS Capabilities: Geocoding, reverse geocoding, POI search, route planning (driving, walking, cycling, transit), weather, IP location, real-time traffic, and more.
  • Cross-Platform SDKs: Official Python and TypeScript SDKs, easy CLI and cloud deployment.
  • Enterprise-Grade Data: Powered by Baidu Maps’ authoritative, up-to-date geospatial data.
  • High Performance & Stability: Recommended SSE (Server-Sent Events) access for low latency and high reliability.
  • Open Source & Extensible: MIT licensed, easy to customize and extend.

Whether you are building a travel assistant, logistics platform, smart city solution, or an LLM-powered agent, Baidu Map MCP Server provides the essential geospatial intelligence and tools you need.

The MCP Server architecture enables:

  • Seamless AI Integration: Allows LLMs and agents to understand and process location data naturally
  • Contextual Understanding: Provides rich geospatial context for more intelligent decision-making
  • Standardized Interfaces: Consistent API design following MCP principles for easy integration
  • Scalable Implementation: Suitable for projects of any size, from small applications to enterprise solutions

Whether you’re building a navigation app, delivery service, smart city solution, or enhancing an AI agent with location awareness, Baidu Map MCP Server provides the tools and infrastructure you need to succeed.

🛠️ Supported Tools & APIs

Baidu Map MCP Server provides the following MCP-compliant APIs (tools):

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 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 (driving, walking, cycling).
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. See Authorization for details.

All APIs follow the MCP protocol and can be called from any MCP-compliant client, LLM, or agent platform.

⚡ Quick Start

1. Get Your API Key

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

2. Python Integration

Install the SDK:

pip install mcp-server-baidu-maps

Run as a script:

python -m mcp_server_baidu_maps

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

3. Node.js/TypeScript Integration

Install:

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

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

4. Recommended: Use SSE for low-latency, stable access

See SSE Quickstart.

5. More Platforms

  • Claude/Agent/千帆AppBuilder: See README_zh.md for detailed integration guides and advanced configuration.

🚀 Advanced 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 POIs.

  • Batch Route Matrix:
    Use map_directions_matrix to calculate multiple routes and durations for logistics or delivery optimization.

  • Text-to-POI Extraction:
    Use map_poi_extract to extract POIs from user input or travel notes (requires advanced permission).

  • Real-time Traffic & Weather-aware Navigation:
    Combine map_road_traffic and map_weather for dynamic, context-aware travel suggestions.

  • Integration with Claude, Qianfan, AppBuilder:
    Seamlessly connect Baidu Map MCP Server to LLMs and agent frameworks for natural language geospatial reasoning.

See README_zh.md for more detailed Chinese documentation, configuration, and examples.


⛰️ Advanced Tutorials

👩‍👩‍👧‍👦 Contributors

🌟 Star History

Star History Chart

📄 License

MIT © baidu-maps

Tools

map_geocode
Name: 地理编码服务 Description: 将地址解析为对应的位置坐标。地址结构越完整,地址内容越准确,解析的坐标精度越高。 Args: address: 待解析的地址。最多支持84个字节。可以输入两种样式的值,分别是: 1、标准的结构化地址信息,如北京市海淀区上地十街十号【推荐,地址结构越完整,解析精度越高】 2、支持“*路与*路交叉口”描述方式,如北一环路和阜阳路的交叉路口 第二种方式并不总是有返回结果,只有当地址库中存在该地址描述时才有返回。
map_reverse_geocode
Name: 地理编码服务 Description: 将地址解析为对应的位置坐标。地址结构越完整,地址内容越准确,解析的坐标精度越高。 Args: latitude: 纬度 (gcj02ll) longitude: 经度 (gcj02ll)
map_search_places
Name: 地理编码服务 Description: 市内检索: 检索某一城市内(目前最细到城市级别)的地点信息。 周边检索: 设置圆心和半径,检索圆形区域内的地点信息(常用于周边检索场景)。 Args: query: 检索关键字 region: 检索的行政区划 location: 圆形区域检索中心点 radius: 圆形区域检索半径,单位:米
map_place_details
Name: 地理编码服务 Description: 地理编码服务:将地址解析为对应的位置坐标。地址结构越完整,地址内容越准确,解析的坐标精度越高。 Args: uid: poi的唯一标识
map_distance_matrix
Name: 距离矩阵服务 Description: 根据起点和终点坐标计算距离矩阵和行车时间 批量算路目前支持驾车、骑行、步行 步行时任意起终点之间的距离不得超过200KM,超过此限制会返回参数错误 驾车批量算路一次最多计算100条路线,起终点个数之积不能超过100 Args: origins: 多个起点坐标纬度,经度,按|分隔。示例:40.056878,116.30815|40.063597,116.364973【骑行】【步行】支持传入起点uid提升绑路准确性,格式为:纬度,经度;POI的uid|纬度,经度;POI的uid。示例:40.056878,116.30815;xxxxx|40.063597,116.364973;xxxxx destinations: 多个终点坐标纬度,经度,按|分隔。示例:40.056878,116.30815|40.063597,116.364973【【骑行】【步行】支持传入终点uid提升绑路准确性,格式为:纬度,经度;POI的uid|纬度,经度;POI的uid。示例:40.056878,116.30815;xxxxx|40.063597,116.364973;xxxxx mode: 批量算路类型(driving, riding, walking)
map_directions
Name: 路线规划服务 Description: 驾车路线规划: 根据起终点坐标规划驾车出行路线 骑行路线规划: 根据起终点坐标规划骑行出行路线 步行路线规划: 根据起终点坐标规划步行出行路线 公交路线规划: 根据起终点坐标规划公共交通出行路线 Args: model: 路线规划类型(driving, riding, walking, transit) origin: 起点坐标,当用户只有起点名称时,需要先通过地理编码服务或地点地点检索服务确定起点的坐标 destination: 终点坐标,当用户只有起点名称时,需要先通过地理编码服务或地点检索服务确定起点的坐标
map_weather
Name: 天气查询服务 Description: 用户可通过行政区划或是经纬度坐标查询实时天气信息及未来5天天气预报(注意: 使用经纬度坐标需要高级权限)。 Args: location: 经纬度,经度在前纬度在后,逗号分隔 (需要高级权限, 例如: 116.30815,40.056878) district_id: 行政区划 (例如: 1101010)
map_ip_location
Name: IP定位服务 Description: 根据用户请求的IP获取当前的位置,当需要知道用户当前位置、所在城市时可以调用该工具获取 Args:
map_road_traffic
Name: 实时路况查询服务 Description: 查询实时交通拥堵情况, 可通过指定道路名和区域形状(矩形, 多边形, 圆形)进行实时路况查询。 道路实时路况查询: 查询具体道路的实时拥堵评价和拥堵路段、拥堵距离、拥堵趋势等信息 矩形区域实时路况查询: 查询指定矩形地理范围的实时拥堵情况和各拥堵路段信息 多边形区域实时路况查询: 查询指定多边形地理范围的实时拥堵情况和各拥堵路段信息 圆形区域(周边)实时路况查询: 查询某中心点周边半径范围内的实时拥堵情况和各拥堵路段信息 Args: model: 路况查询类型(road, bound, polygon, around) road_name: 道路名称和道路方向, model=road时必传 (如:朝阳路南向北) city: 城市名称或城市adcode, model=road时必传 (如:北京市) bounds: 区域左下角和右上角的经纬度坐标, model=bound时必传 (如:39.912078,116.464303;39.918276,116.475442) vertexes: 多边形区域的顶点经纬度, model=polygon时必传 (如:39.910528,116.472926;39.918276,116.475442;39.916671,116.459056;39.912078,116.464303) center: 圆形区域的中心点经纬度坐标, model=around时必传 (如:39.912078,116.464303) radius: 圆形区域的半径(米), 取值[1,1000], model=around时必传 (如:200)
map_poi_extract
Name: POI智能提取 Description: 根据用户提供的文本描述信息, 智能提取出文本中所提及的POI相关信息. (注意: 使用该服务, api_key需要拥有对应的高级权限, 否则会报错) Args: text_content: 用于提取POI的文本描述信息 (完整的旅游路线,行程规划,景点推荐描述等文本内容, 例如: 新疆独库公路和塔里木湖太美了, 从独山子大峡谷到天山神秘大峡谷也是很不错的体验)

Comments