/ 目錄 / 演練場 / jsapi-skills
● 社群 baidu-maps ⚡ 即開即用

jsapi-skills

作者 baidu-maps · baidu-maps/jsapi-skills

Official Baidu Maps JSAPI skills — 2D/2.5D (BMapGL), 3D with three.js, and the jsapi-ui-kit for PlaceSearch/PlaceDetail components.

baidu-maps/jsapi-skills is the official Baidu Maps team's Claude skill set. Three sub-skills: bmap-jsapi-gl (WebGL map init, overlays, events, layers, routing, geocoding), bmap-jsapi-three (3D maps with three.js — multi-source base map, 3D models, natural environment, digital twin), and jsapi-ui-kit (PlaceSearch with keyword/nearby/bounds search + PlaceDetail components). Claude gets accurate docs and code examples for Baidu Maps development.

為什麼要用

核心特性

即時演示

實際使用效果

jsapi-skill.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "jsapi-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/baidu-maps/jsapi-skills",
        "~/.claude/skills/jsapi-skills"
      ],
      "_inferred": true
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "jsapi-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/baidu-maps/jsapi-skills",
        "~/.claude/skills/jsapi-skills"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "jsapi-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/baidu-maps/jsapi-skills",
        "~/.claude/skills/jsapi-skills"
      ],
      "_inferred": true
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "jsapi-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/baidu-maps/jsapi-skills",
        "~/.claude/skills/jsapi-skills"
      ],
      "_inferred": true
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "jsapi-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/baidu-maps/jsapi-skills",
        "~/.claude/skills/jsapi-skills"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "jsapi-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/baidu-maps/jsapi-skills",
          "~/.claude/skills/jsapi-skills"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add jsapi-skill -- git clone https://github.com/baidu-maps/jsapi-skills ~/.claude/skills/jsapi-skills

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: jsapi-skills

Embed a Baidu map with markers and routing into a web app

👤 Devs serving Chinese users where Baidu Maps is the default ⏱ ~30 min intermediate

何時使用: Google Maps isn't viable for your audience; Baidu Maps is the standard.

前置條件
  • Skill cloned — git clone https://github.com/baidu-maps/jsapi-skills ~/.claude/skills/jsapi-skills
  • Baidu Maps API key (ak) — lbsyun.baidu.com — create an app, enable the APIs you need
步驟
  1. Scaffold with bmap-jsapi-gl
    Use bmap-jsapi-gl skill — init a BMapGL map in <div id='map'>, center on Beijing, add markers for 5 lat/lng pairs.✓ 已複製
    → Claude uses correct BMapGL constructors, not the old BMap JSAPI
  2. Add routing
    Now add driving directions between the first two markers.✓ 已複製
    → DrivingRoute usage with correct event wiring

結果: A working map component in your app.

注意事項
  • Mixing legacy BMap JSAPI with BMapGL (WebGL) APIs — Skill keeps them distinct; pick one family and stick with it
搭配使用: filesystem

Render a 3D digital-twin scene over a Baidu Maps base layer

👤 Devs building industrial / smart-city visualizations ⏱ ~120 min advanced

何時使用: You need 3D models overlaid on a geospatial base.

步驟
  1. Set up bmap-jsapi-three
    bmap-jsapi-three — base map + three.js scene, load a glTF building model at given coords.✓ 已複製
    → Correct camera sync between Baidu base and three.js scene
  2. Visualize data
    Add a heatmap from sensor data points on top.✓ 已複製
    → Geodata visualization layered correctly

結果: A 3D scene anchored to real-world coordinates.

Drop-in a PlaceSearch + PlaceDetail UI with jsapi-ui-kit

👤 Devs who don't want to hand-build place-search UI ⏱ ~30 min intermediate

何時使用: You need a functional 'find nearby' UI fast.

步驟
  1. Scaffold components
    jsapi-ui-kit — PlaceSearch by keyword within current bounds + PlaceDetail panel.✓ 已複製
    → Components mounted with bind to the map instance

結果: A working place-search UX without writing the UI shell.

組合

與其他 MCP 搭配,撬動十倍槓桿

jsapi-skill + filesystem

Scaffold across your actual project structure

Create BaiduMap.tsx under src/components and wire it into the search page.✓ 已複製
jsapi-skill + github

Commit integration with proper config separation

Add the map component and open a PR; keep the ak key in .env, not source.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
bmap-jsapi-gl 2D/2.5D map intent Standard map embedding 0
bmap-jsapi-three 3D scene intent + models 3D visualization 0
jsapi-ui-kit component intent (PlaceSearch / PlaceDetail) Need place-search UI without building it 0

成本與限制

運行它的成本

API 配額
Baidu Maps API has per-day quotas depending on tier
每次呼叫 Token 數
Moderate per sub-skill
費用
Free for dev usage; production tiers vary — check lbsyun.baidu.com
提示
Use staging ak for dev, production ak with quota monitoring for prod.

安全

權限、密鑰、影響範圍

憑證儲存: Baidu Maps ak goes in env var / server-side; don't commit to source
資料出站: Map tiles and API calls go to Baidu Maps servers

故障排查

常見錯誤與修復

Skill not invoked — Claude uses outdated BMap (non-GL) API

Say 'BMapGL' or 'bmap-jsapi-gl' explicitly.

驗證: ls ~/.claude/skills/jsapi-skills/
SKILL.md frontmatter wrong in a sub-skill

Check the specific sub-skill folder.

驗證: head ~/.claude/skills/jsapi-skills/bmap-jsapi-gl/SKILL.md
Wrong trigger keywords — three.js scene mis-aligned with base map

Use bmap-jsapi-three explicitly rather than generic 'three.js' prompts.

替代方案

jsapi-skills 對比其他方案

替代方案何時用它替代權衡
Google Maps JavaScript APIYour audience is outside ChinaDoesn't work reliably inside China
Mapbox / MapLibreYou want OSM-based vector tilesDifferent coordinate systems; more DIY

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills