Skip to main content

Baidu Map MCP Server (Python)

🚀 快速启动(推荐)

使用 UVX 一键启动

uvx bach-baidu-maps

在 Cursor/Cherry Studio 中配置

{
  "mcpServers": {
    "baidu-maps": {
      "command": "uvx",
      "args": ["bach-baidu-maps"],
      "env": {
        "BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}

包地址: https://pypi.org/project/bach-baidu-maps/


传统方式:搭建 Python 虚拟环境

我们推荐通过uv构建虚拟环境来运行 MCP server,关于`uv 你可以在这里找到一些说明。

按照官方流程,你会安装Python包管理工具uv。除此之外,你也可以尝试其他方法(如Anaconda)来创建你的Python虚拟环境。

通过uv添加mcp依赖

uv add "mcp[cli]"

验证 mcp 依赖是否安装成功,执行如下命令

uv run mcp

当出现下图时代表安装成功

通过uv安装python,最低版本要求为 3.11

uv python install 3.11

获取 MCP Server

前往百度地图 MCP Server 开源仓库下载

配置本地项目

通过uv创建一个项目

uv init mcp_server_baidu_maps

将map.py拷贝到该目录下,通过如下命令测试 mcp server 是否正常运行

uv run --with mcp[cli] mcp run {YOUR_PATH}/mcp_server_baidu_maps/map.py
# 如果是mac,需要加转义符
uv run --with mcp\[cli\] mcp run {YOUR_PATH}/mcp_server_baidu_maps/map.py

如果没有报错则 MCP Server 启动成功

在 Cursor 中使用

打开Cursor配置,在 MCP 中添加 MCP Server

在文件中添加如下内容后保存

{
  "mcpServers": {
    "baidu-map": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "mcp",
        "run",
        "{YOUR_PATH}/mcp_server_baidu_maps/map.py"
      ],
      "env": {
        "BAIDU_MAPS_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}

回到配置,此时百度 MCP Server 已经启用

测试

行程规划:

Metadata

Release files for bach-baidu-maps 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bach-baidu-maps 1.0.2
File Size Uploaded
bach_baidu_maps-1.0.2.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bach-baidu-maps 1.0.2
File Interpreter ABI Platform
bach_baidu_maps-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / bach_baidu_maps-1.0.2.tar.gz

Download URL bach_baidu_maps-1.0.2.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
515e13ef04eef2a3004d02ad18ac0843290df58a806f5c232332fc52c448bed2
BLAKE2b-256 checksum
How to use checksums
8ea7d535742d4a980504477c1cce7cd825abe3ec0a1bd948024950c2be4e1713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / bach_baidu_maps-1.0.2-py3-none-any.whl

Download URL bach_baidu_maps-1.0.2-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
938d9f35ddc970204d5b4ac53ccb8d1c712b014a1e3875a2af087144ca83b270
BLAKE2b-256 checksum
How to use checksums
14a78cf4f9feea5c90cd60132dd9d6562195a896691f44cd8fc317c730512f96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page