百度地图API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。百度地图提供的MCP Server包含10个符合MCP协议标准的API接口,涵盖逆地理编码、地点检索、路线规划等服务。依赖MCP Python SDK和MCP Typescript SDK开发,任意支持MCP协议的智能体助手(如Claude、Cursor以及千帆AppBuilder等)都可以快速接入。
1.4k 查看 · 2026-07-07 更新
简介
百度地图API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。百度地图提供的MCP Server包含10个符合MCP协议标准的API接口,涵盖逆地理编码、地点检索、路线规划等服务。依赖MCP Python SDK和MCP Typescript SDK开发,任意支持MCP协议的智能体助手(如Claude、Cursor以及千帆AppBuilder等)都可以快速接入。
简介
百度地图API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。百度地图提供的MCP Server包含10个符合MCP协议标准的API接口,涵盖逆地理编码、地点检索、路线规划等服务。依赖MCP Python SDK和MCP Typescript SDK开发,任意支持MCP协议的智能体助手(如Claude、Cursor以及千帆AppBuilder等)都可以快速接入。
Baidu Map MCP Server
Overview
Baidu Map API is now fully compatible with the MCP protocol, making it the first map service provider in China to support the MCP protocol.
The MCP Server provided by Baidu Maps includes 10 APIs that comply with MCP protocol standards, covering services such as reverse geocoding, place search, and route planning.
Developed using MCP Python SDK and MCP Typescript SDK, any intelligent agent assistant that supports the MCP protocol (such as Claude, Cursor, and Qianfan AppBuilder, etc.) can quickly integrate.
It is strongly recommended to access the Baidu Map MCP Server via SSE for lower latency and higher stability. Don't forget to enable the MCP(SSE) service for your AK in the console.
Tools
-
Geocoding
map_geocode- Description: Converts an address into corresponding geographic coordinates. The more complete and accurate the address structure, the higher the precision of the parsed coordinates.
- Parameters:
addressAddress information - Output:
locationLatitude and longitude coordinates
-
Reverse Geocoding
map_reverse_geocode- Description: Retrieves the address description, administrative division, road, and related POI information based on latitude and longitude coordinates.
- Parameters:
latitudeLatitude coordinatelongitudeLongitude coordinate
- Output: Semantic address information such as
formatted_address,uid,addressComponent
-
Place Search
map_search_places- Description: Supports searching for location information within a city (down to the
citylevel) and also allows searching for nearby locations within a circular area. - Parameters:
querySearch keywords, which can be names or types. Multiple keywords should be separated by commas, e.g.,query=Tiananmen,FoodtagType preference for the search, formatted astag=Foodortag=Food,HotelregionAdministrative division for the search, formatted asregion=citynameorregion=citycodelocationLatitude and longitude coordinates of the center point for a circular search, formatted aslocation=lat,lngradiusRadius of the circular search
- Output: List of POIs, including
name,location,address, etc.
- Description: Supports searching for location information within a city (down to the
-
Place Details Search
map_place_details- Description: Retrieves detailed information about a POI based on its UID, such as ratings, business hours, etc. (Different types of POIs correspond to different categories of detailed data)
- Parameters:
uidUnique identifier of the POI - Output: POI details, including
name,location,address,brand,price, etc.
-
Batch Route Calculation
map_directions_matrix- Description: Calculates the distance and travel time for route planning based on the start and end coordinates. Supports driving, cycling, and walking. For walking, the distance between any start and end points must not exceed 200KM. For batch driving route calculation, up to 100 routes can be calculated at once, and the product of the number of start and end points cannot exceed 100.
- Parameters:
originsList of latitude and longitude coordinates for the starting points, formatted asorigins=lat,lng. Multiple origins are separated by|destinationsList of latitude and longitude coordinates for the destination points, formatted asdestinations=lat,lng. Multiple destinations are separated by|modelRoute calculation type, possible values includedriving,walking,riding, default isdriving
- Output: Travel time and distance for each route, including
distance,duration, etc.
-
Route Planning
map_directions- Description: Plans travel routes and duration based on the start and end position names or latitude and longitude coordinates. You can specify the mode of transportation such as driving, walking, cycling, or public transit.
- Parameters:
originStart position name or latitude and longitude, formatted asorigin=lat,lngdestinationEnd position name or latitude and longitude, formatted asdestination=lat,lngmodelMode of transportation, possible values includedriving,walking,riding,transit, default isdriving
- Output: Route details, including
steps,distance,duration, etc.
-
Weather Query
map_weather- Description: Queries real-time weather information and a 5-day weather forecast through administrative divisions or latitude and longitude coordinates.
- Parameters:
district_idAdministrative division codelocationLatitude and longitude coordinates, formatted aslocation=lng, lat
- Output: Weather information, including
temperature,weather,wind, etc.
-
IP Location
map_ip_location- Description: Obtain specific location information and city name through the given IP, which can be used for IP or user's current location positioning. Optional parameterip, if empty, it will get the local machine's IP address (supports both IPv4 and IPv6).
- Parameters:
ip(optional) The IP address to be located
- Output: The current city and the midpoint
locationof the city
-
Real-time Traffic Conditions Query
map_road_traffic- Description: Query real-time traffic congestion conditions, supports querying by specifying road names and area shapes (rectangle, polygon, circle).
- Parameters:
modelType of traffic condition query (optional values includeroad,bound,polygon,around, default isroad)road_nameRoad name and direction, required whenmodel=road(e.g.,Chaoyang Road South to North)cityCity name or city adcode, required whenmodel=road(e.g.,Beijing)boundsLatitude and longitude coordinates of the lower left and upper right corners of the area, required whenmodel=bound(e.g.,39.9,116.4;39.9,116.4)vertexesLatitude and longitude coordinates of the vertices of the polygonal area, required whenmodel=polygon(e.g.,39.9,116.4;39.9,116.4;39.9,116.4;39.9,116.4)centerLatitude and longitude coordinates of the center point of the circular area, required whenmodel=around(e.g.,39.912078,116.464303)radiusRadius of the circular area (meters), value range[1,1000], required whenmodel=around(e.g.,200)
- Output: Traffic condition information, including
road_name,traffic_condition, etc.
-
Smart POI Extraction
map_poi_extract- Description: Can only be used if the provided
API_KEYhas advanced permissions. Extracts relevant POI information based on the given text content. - Parameters:
text_contentText description used for extracting POIs (complete travel routes, itinerary planning, scenic spot recommendations, etc., e.g., "The Duku Highway and Tarim Lake in Xinjiang are so beautiful. The experience from Dushanzi Grand Canyon to the Mysterious Tianshan Grand Canyon is also great.") - Output: Relevant POI information, including
name,location, etc.
- Description: Can only be used if the provided
Getting Started
Using Baidu Map MCP Server primarily involves two forms: Python and Typescript. Below, we introduce each method.
Acquiring AK
Before choosing either method, you need to create a server-side AK in the Baidu Map Open Platform console. Only with an AK can you call Baidu Map API capabilities.
Python Integration
If you wish to customize the Baidu Map MCP Server capabilities, you can integrate via the source code. For details, see the Python Integration Documentation.
In the v1.1 update, we published the Baidu Map MCP Server: mcp-server-baidu-maps on pypi, allowing you to easily obtain and quickly configure it using any Python package management tool.
Installation
Using uv (Recommended)
When using uv, no special installation is required. We will use uvx to directly run mcp-server-baidu-maps.
Using pip
Alternatively, you can install mcp-server-baidu-maps using pip: bash pip install mcp-server-baidu-maps
After installation, you can run it as a script using the following command: bash python -m mcp_server_baidu_maps
Configuration
Add the following configuration in any MCP client (such as Claude.app). Some clients may require formatting adjustments.
Replace the value of BAIDU_MAPS_API_KEY with your own AK.
Using uvx
json { "mcpServers": { "baidu-maps": { "command": "uvx", "args": ["mcp-server-baidu-maps"], "env": { "BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>" } } } }
Using pip installation
json { "mcpServers": { "baidu-maps": { "command": "python", "args": ["-m", "mcp_server_baidu_maps"], "env": { "BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>" } } } }
After saving the configuration, restart your MCP client to start using the Baidu Map MCP Server.
Typescript Integration
Node.js Installation
For integration via Typescript, you just need to install node.js.When you can run the following in your terminal:
bash node -v
This indicates that node.js has been successfully installed.
Configuration
Open the Claude for Desktop Setting, switch to Developer, and click on Edit Config. Open the configuration file with any IDE.


Add the following configuration to the file. BAIDU_MAP_API_KEY is the AK for accessing the Baidu Map Open Platform API, which you can apply for on this page:
json { "mcpServers": { "baidu-map": { "command": "npx", "args": [ "-y", "@baidumap/mcp-server-baidu-map" ], "env": { "BAIDU_MAP_API_KEY": "xxx" } } } }
For Windows systems, the JSON needs a specific configuration: json "mcpServers": { "baidu-map": { "command": "cmd", "args": [ "/c", "npx", "-y", "@baidumap/mcp-server-baidu-map" ], "env": { "BAIDU_MAP_API_KEY": "xxx" }, } }
Restart Claude. At this point, the settings panel should have successfully loaded the Baidu Map MCP Server. In the main interface of the software, you will see 8 available MCP tools; clicking on them will show more details.


Effect
You can now start asking questions to verify the capabilities of the travel planning assistant.

Integration via Qianfan AppBuilder Platform
The Qianfan platform supports integration through SDK or API. By building an application using AppBuilder, each application will have its own unique app_id. In the Python file, call the corresponding app_id and then invoke the Baidu Map Python MCP Tool.
The template code below demonstrates how to use the SDK Agent and the Map MCP Server to obtain navigation routes and route information, and provide travel suggestions.
Agent Configuration
Go to the Qianfan platform, create a new application, and publish it.

Set the number of thinking rounds for the Agent to 6. Publish the application.
Invocation
This code can be used as a template to call the already built and published App on the Qianfan platform via SDK. Download the MCP Server locally and write the relative file path into the code.
Note: Use the actual app_id, token, query, and mcp file.
python 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): def init(self, mcp_client): super().init() self.mcp_client = mcp_client
def get_current_weather(self, location=None, unit="摄氏度"): return "{} 的温度是 {} {}".format(location, 20, unit) async def interrupt(self, run_context, run_response): thought = run_context.current_thought # Green print print("\033[1;31m", "-> Agent intermediate thought: ", thought, "\033[0m") tool_output = [] for tool_call in run_context.current_tool_calls: tool_res = "" if tool_call.function.name == "get_current_weather": tool_res = self.get_current_weather(**tool_call.function.arguments) else: print( "\033[1;32m", "MCP tool name: {}, MCP parameters: {}\n".format(tool_call.function.name, tool_call.function.arguments), "\033[0m", ) mcp_server_result = await self.mcp_client.call_tool( tool_call.function.name, tool_call.function.arguments ) print("\033[1;33m", "MCP result: {}\n\033[0m".format(mcp_server_result)) for i, content in enumerate(mcp_server_result.content): if content.type == "text": tool_res += mcp_server_result.content[i].text tool_output.append( { "tool_call_id": tool_call.id, "output": tool_res, } ) return tool_output async def success(self, run_context, run_response): print("\n\033[1;34m", "-> Agent non-streaming response: ", run_response.answer, "\033[0m")
async def agent_run(client, mcp_client, query): tools = mcp_client.tools conversation_id = await client.create_conversation() with await client.run_with_handler( conversation_id=conversation_id, query=query, tools=tools, event_handler=MyEventHandler(mcp_client), ) as run: await run.until_done()
User Token
os.environ["APPBUILDER_TOKEN"] = ""
async def main(): appbuilder.logger.setLoglevel("DEBUG") ### Published app ID app_id = "" appbuilder_client = appbuilder.AsyncAppBuilderClient(app_id) mcp_client = MCPClient()
### Note: The path here is the relative local path of the 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, 'Driving navigation from Beijing to Shanghai', ) await appbuilder_client.http_client.session.close()
if name == "main": loop = asyncio.get_event_loop() loop.run_until_complete(main())#### Effect
After the Agent's own deliberation, by calling multiple tools such as MCPServer location retrieval, geocoding service, and route planning service, it acquires navigation routes and route information, and provides travel suggestions.
Actual user request: "Please plan a one-day flower viewing trip in Beijing for me. Try to provide a more comfortable travel arrangement, of course, also pay attention to the weather conditions."
Thought Process

Agent Result

Explanation
Some parameter specifications when using Baidu Map MCP Server:
- Administrative division codes all adopt Baidu adcode mapping table.
- Latitude and longitude coordinates use the national surveying and mapping bureau's latitude and longitude coordinates
bd09ll. For details, see Baidu Coordinate System. - Chinese string parameters like types should comply with Baidu POI type standards.
License
MIT © baidu-maps
Authorization
Some advanced capabilities in Baidu Map MCP Server require applying for advanced permissions to be used. If needed, please contact us.
Feedback
If you encounter any issues while using Baidu Map MCP Server, feel free to report them through an issue or via the Baidu Map Open Platform. We also welcome every positive PR. Thank you very much for your support and contributions ❤️
Updates
The team is currently focusing on providing services in Remote form, so updates to the open-source part will be relatively fewer. Please understand.
| Version | Function Description | Update Date |
|---|---|---|
| V1.0 | Official launch of Baidu Map MCP Server | 2025-03-21 |
| V1.1 | Added quick integration in uvx, pip forms | 2025-03-28 |
| V1.2 | Added integration method for Qianfan AppBuilder | 2025-04-05 |
| V2.0 | Supports MCP 1.9.0 protocol | 2025-05-16 |
工具列表
-
map_geocode: 地理编码服务: 将地址解析为对应的位置坐标.地址结构越完整, 地址内容越准确, 解析的坐标精度越高.
-
map_reverse_geocode: 逆地理编码服务: 根据纬经度坐标, 获取对应位置的地址描述, 所在行政区划, 道路以及相关POI等信息
-
map_search_places: 地点检索服务: 支持检索城市内的地点信息(最小到city级别), 也可支持圆形区域内的周边地点信息检索. 城市内检索: 检索某一城市内(目前最细到城市级别)的地点信息. 周边检索: 设置圆心和半径, 检索圆形区域内的地点信息(常用于周边检索场景).
-
map_place_details: 地点详情检索服务: 地点详情检索针对指定POI, 检索其相关的详情信息. 通过地点检索服务获取POI uid.使用地点详情检索功能, 传入uid, 即可检索POI详情信息, 如评分、营业时间等(不同类型POI对应不同类别详情数据).
-
map_directions_matrix: 批量算路服务: 根据起点和终点坐标计算路线规划距离和行驶时间. 批量算路目前支持驾车、骑行、步行. 步行时任意起终点之间的距离不得超过200KM, 超过此限制会返回参数错误. 驾车批量算路一次最多计算100条路线, 起终点个数之积不能超过100.
-
map_directions: 路线规划服务: 根据起终点
位置名称或纬经度坐标规划出行路线. 驾车路线规划: 根据起终点位置名称或纬经度坐标规划驾车出行路线. 骑行路线规划: 根据起终点位置名称或纬经度坐标规划骑行出行路线. 步行路线规划: 根据起终点位置名称或纬经度坐标规划步行出行路线. 公交路线规划: 根据起终点位置名称或纬经度坐标规划公共交通出行路线. -
map_weather: 天气查询服务: 通过行政区划或是经纬度坐标查询实时天气信息及未来5天天气预报.
-
map_ip_location: IP定位服务: 通过所给IP获取具体位置信息和城市名称, 可用于定位IP或用户当前位置.
-
map_road_traffic: 实时路况查询服务: 查询实时交通拥堵情况, 可通过指定道路名和区域形状(矩形, 多边形, 圆形)进行实时路况查询. 道路实时路况查询: 查询具体道路的实时拥堵评价和拥堵路段、拥堵距离、拥堵趋势等信息. 矩形区域实时路况查询: 查询指定矩形地理范围的实时拥堵情况和各拥堵路段信息. 多边形区域实时路况查询: 查询指定多边形地理范围的实时拥堵情况和各拥堵路段信息. 圆形区域(周边)实时路况查询: 查询某中心点周边半径范围内的实时拥堵情况和各拥堵路段信息.
-
map_poi_extract: POI智能提取
服务配置
[{'mcpServers': {'baidu-maps': {'args': ['mcp-server-baidu-maps'], 'command': 'uvx', 'env': {'BAIDU_MAPS_API_KEY': '<YOUR_API_KEY>'}}}}, {'mcpServers': {'baidu-maps': {'args': ['-m', 'mcp_server_baidu_maps'], 'command': 'python', 'env': {'BAIDU_MAPS_API_KEY': '<YOUR_API_KEY>'}}}}, {'mcpServers': {'baidu-map': {'args': ['-y', '@baidumap/mcp-server-baidu-map'], 'command': 'npx', 'env': {'BAIDU_MAP_API_KEY': 'xxx'}}}}]
来源
- 来源:github
- 链接:https://github.com/baidu-maps/mcp