Cesium Mcp Runtime

io.github.gaopengbin由 GitHub 帳號 gaopengbin 發布v2.0.0更新於 Nov 7, 2026

Control CesiumJS 3D globes via MCP: camera, layers, entities, animation, and interaction.

概覽

AI 產生的概覽

把 AI 助理連接到瀏覽器中的 CesiumJS 三維地球,可移動相機、加入圖層與實體並播放動畫。

可以做什麼
  • 控制與查詢相機:飛往座標、設定視角、縮放至範圍、環繞與定點觀察
  • 新增、修改與移除地圖實體:標記、標籤、模型、多邊形、折線、方塊、牆面、圓柱等
  • 管理圖層與底圖:加入帶樣式的 GeoJSON、切換可見性、改樣式、更換底圖
  • 載入資料服務:3D Tiles、地形、影像服務、向量圖磚、CZML 與 KML
  • 動畫與視覺化:航點動畫、時鐘控制、實體追蹤、軌跡、熱區圖、光照
  • 截圖與檢視:截圖、圖徵醒目提示、量測,以及場景相機與圖層資源
適用情境
適合讓助理以互動方式建立或操作三維地理場景,例如在地球上檢視資料、產生地圖截圖,或在 CesiumJS 檢視器中演練相機飛行與動畫。
執行需求
透過 npx 或全域 npm 安裝在本機執行(需要 Node.js)。需在瀏覽器開啟 localhost:9100 的內建檢視器,或使用 cesium-mcp-bridge 的自訂頁面。CesiumJS 從官方 CDN 載入,需要網路存取。連接埠、工具集、語系、傳輸與驗證可透過環境變數設定。
安裝前請注意
預設開啟使用統計,可用 CESIUM_TELEMETRY_DISABLED=1、DO_NOT_TRACK=1 或 --no-telemetry 關閉。綁定到非回送位址時必須設定 CESIUM_AUTH_TOKEN,設定後所有 API 與 WebSocket 連線都需驗證。工具呼叫會改動即時場景(新增、修改、刪除實體與圖層)。地理編碼工具會把地名傳送給 Nominatim/OSM,scene 工具集可提供 Ion 憑證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Cesium Mcp Runtime,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

cesium-mcp-runtime

Usage statistics are on by default, with a startup notice on stderr. Set CESIUM_TELEMETRY_DISABLED=1, DO_NOT_TRACK=1, or pass --no-telemetry to disable. Collected fields and privacy.

English | 中文

MCP Server that enables AI Agents to control a Cesium globe in real-time via the Model Context Protocol.

[npm version] [license]

Release channel: latest uses the stable MCP SDK v2 and supports both MCP 2025-11-25 and 2026-07-28 from the same stdio/HTTP entry. If you only want to try the "AI + Cesium" feel, examples/browser-agent is the recommended starting point — zero backend, runs in three minutes. See Which mode should I use?.

MCP Apps map panel

openCesiumMap serves an interactive Cesium Viewer through the standard ui://cesium-mcp/map-v10.html MCP Apps resource. The map occupies the primary area and uses the host's existing native chat through ui/message, with no duplicate composer or history. Layout and host theme/locale changes preserve the Viewer, selection and session. The app follows host semantic style variables and fonts, supports Chinese and English, and publishes camera, layers and selected-object context. Local preview controls simulate live host settings and record message delivery. OpenAI global/thread entrypoint and fullscreen hints are included.

The built HTML, embedded Worker graph and Bridge bundle ship in dist. A compatible host must support WebGL and Blob module workers in an isolated, stable UI origin. The embedded panel exchanges commands through app-only MCP tools and does not access a local WebSocket. CESIUM_APP_DOMAIN optionally declares a dedicated UI origin. External browser Viewers retain the existing WebSocket transport.

For a real local MCP Apps preview, run npm run app:preview -w packages/cesium-mcp-runtime from a built repository and open http://127.0.0.1:19311/. See the full guide. Client-specific ChatGPT installation is a separate verification step.

Vector tiles

Enable the tiles toolset with CESIUM_TOOLSETS=view,entity,layer,interaction,tiles or enable_toolset. Use loadVectorTiles for MVT /{z}/{x}/{y} URLs or vector 3D Tiles, click a feature and read getSelectedTileFeature, then update its managed layer using updateLayerStyle with tileStyle.color and tileStyle.lineWidth. Read back getLayerSchema.metadata.tileStyle to verify the applied expressions.

Vector rendering and clamping require CesiumJS 1.147. Clamped line/polygon picking uses an experimental bounded adapter. For external data in an MCP Apps panel, configure exact allowed origins with CESIUM_MAP_DATA_ORIGINS. See the vector tiles guide for source formats, styling and limits.

Architecture

AI Agent <--MCP stdio--> cesium-mcp-runtime <--WebSocket--> Browser (cesium-mcp-bridge)AI Agent <--MCP HTTP---> cesium-mcp-runtime <--WebSocket--> Browser (cesium-mcp-bridge)

The runtime acts as a bridge between MCP-compatible AI clients (Claude Desktop, VS Code Copilot, Cursor, etc.) and a browser running CesiumJS. It translates MCP tool calls into WebSocket commands that cesium-mcp-bridge executes.

The npm package ships its browser Bridge bundle locally. The built-in Viewer at http://localhost:9100/ therefore does not depend on an unpkg fallback; CesiumJS itself is still loaded from the official Cesium CDN.

For ordinary MCP users this is a one-package setup: run cesium-mcp-runtime and use the built-in Viewer. Install cesium-mcp-bridge separately only when developing a custom CesiumJS page.

Two transport modes are supported:

TransportUse CaseProtocol
stdio (default)Local AI clients (Claude Desktop, VS Code, Cursor)Standard I/O
httpRemote/cloud MCP clients (Dify, custom backends)Streamable HTTP

Install & Run

bash
# Stable channel (stdio mode, default)npx -y cesium-mcp-runtime
# Or install globallynpm install -g cesium-mcp-runtimecesium-mcp-runtime

Then open http://localhost:9100/ to use the built-in Viewer. No separate Bridge installation is required for this default path.

Streamable HTTP Mode

For remote/cloud MCP clients like Dify:

bash
# Start in HTTP transport modenpx -y cesium-mcp-runtime --transport http --port 3000
# MCP endpoint: POST http://localhost:3000/mcp

Environment variable alternative:

bash
MCP_TRANSPORT=http MCP_HTTP_PORT=3000 npx -y cesium-mcp-runtime

In HTTP mode, all 62 Cesium command tools are enabled by default (no dynamic toolset discovery needed).

MCP Client Configuration

Network access

Runtime binds to 127.0.0.1 by default, including its HTTP and WebSocket ports. Local native MCP clients and pages served from localhost continue to work. Pages opened directly as file:// must instead be served by a local HTTP server.

VariablePurpose
CESIUM_HOSTBind address, default 127.0.0.1. Non-loopback addresses require CESIUM_AUTH_TOKEN.
CESIUM_AUTH_TOKENShared connection secret. When set, all APIs and WebSocket connections require authentication, including local clients.
CESIUM_ALLOWED_HOSTSComma-separated exact hostnames without ports, in addition to loopback and the bind address. No wildcards.
CESIUM_ALLOWED_ORIGINSComma-separated exact HTTPS page origins. Loopback HTTP/HTTPS origins are allowed by default. No wildcards.

For remote access, use HTTPS/WSS through a reverse proxy and configure the public hostname and Viewer origin explicitly. For example, set CESIUM_HOST=0.0.0.0, CESIUM_ALLOWED_HOSTS=maps.example.com, CESIUM_ALLOWED_ORIGINS=https://maps.example.com, and a generated CESIUM_AUTH_TOKEN in the server environment. Preserve the public Host header and WebSocket upgrades in the proxy.

MCP HTTP and REST clients send Authorization: Bearer <token>. The built-in Viewer asks for the connection token when authentication is enabled; it keeps the token in the page only. Custom browser bridges authenticate with WebSocket subprotocols:

js
const encoded = btoa(String.fromCharCode(...new TextEncoder().encode(token)))  .replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')const ws = new WebSocket('wss://maps.example.com/?session=demo', [  'cesium-mcp', `cesium-token.${encoded}`,])

Do not put credentials in query strings. Reverse proxies must not log Authorization or Sec-WebSocket-Protocol headers. The Viewer HTML and Bridge script are public assets; protected APIs and WebSocket upgrades still require the token. Secondary local Runtime instances must use the same token to relay to an existing instance. Browser session IDs select a Viewer; they are not credentials.

Claude Desktop

json
{  "mcpServers": {    "cesium": {      "command": "npx",      "args": ["-y", "cesium-mcp-runtime"],      "env": {        "CESIUM_WS_PORT": "9100",        "DEFAULT_SESSION_ID": "default"      }    }  }}

VS Code (Copilot)

In .vscode/mcp.json:

json
{  "servers": {    "cesium": {      "command": "npx",      "args": ["-y", "cesium-mcp-runtime"],      "env": {        "DEFAULT_SESSION_ID": "default"      }    }  }}

Cursor

In .cursor/mcp.json:

json
{  "mcpServers": {    "cesium": {      "command": "npx",      "args": ["-y", "cesium-mcp-runtime"]    }  }}

MCP Tools (62 command tools + 2 discovery meta-tools)

Tools are organized into 12 toolsets. By default, 4 core toolsets are enabled (30 tools). Additional toolsets can be activated via environment variable or dynamically by the AI agent at runtime. Shared titles, behavior annotations, localized descriptions, defaults, input validation, advertised output schemas, and structured results are generated from the canonical JSON Schemas in cesium-mcp-contracts. Tool calls also retain text content for older clients.

Toolsets Overview

ToolsetToolsDefaultDescription
view8YesCamera view controls + viewpoint bookmarks + scene export
entity10YesCore entity operations + batch, query & property inspection
layer9YesLayer management (GeoJSON, schema, style, basemap)
interaction3YesScreenshot, highlight & measurement
camera4—Advanced camera controls (orbit, lookAt)
entity-ext7—Extended entity types (box, cylinder, wall, etc.)
animation8—Animation system (waypoints, clock, tracking, lighting)
tiles7—3D Tiles, Gaussian Splats, terrain, imagery services, CZML & KML
trajectory1—Trajectory playback
heatmap1—Heatmap visualization
scene3—Scene options, post-processing & Runtime-only Ion credentials
geolocation1—Geocoding — convert address/place name to coordinates (Nominatim/OSM)

Toolset Configuration

json
{  "mcpServers": {    "cesium": {      "command": "npx",      "args": ["-y", "cesium-mcp-runtime"],      "env": {        "CESIUM_TOOLSETS": "all"      }    }  }}
CESIUM_TOOLSETS valueResult
(not set)Default 4 toolsets (30 tools + 2 meta-tools)
view,entity,camera,animationOnly specified toolsets + 2 meta-tools
allAll 62 command tools, no meta-tools

Dynamic Discovery (meta-tools)

When not in all mode, two meta-tools are always available so the AI can discover and activate additional capabilities on demand:

ToolDescription
list_toolsetsList all toolset groups with enabled status and tool names
enable_toolsetDynamically enable a toolset — new tools become immediately available

View

ToolDescription
flyToFly to coordinates (lon, lat, height, heading, pitch, roll, duration)
setViewSet camera position instantly
getViewGet current camera state
zoomToExtentZoom to bounding box (west, south, east, north)

Entity

ToolDescription
addMarkerAdd a marker at coordinates
addLabelAdd text labels to the map
addModelAdd 3D model (glTF/GLB or Ion asset)
addPolygonAdd polygon with styling
addPolylineAdd polyline with styling
updateEntityUpdate entity properties
removeEntityRemove entity by ID

Layer

ToolDescription
addGeoJsonLayerAdd GeoJSON with styling (choropleth, category, etc.)
listLayersList all layers
removeLayerRemove layer by ID
setLayerVisibilityToggle layer visibility
updateLayerStyleChange layer color/opacity/width
setBasemapSwitch basemap

Camera (toolset: camera)

ToolDescription
lookAtTransformOrbit-style camera aim at a position (heading/pitch/range)
startOrbitStart orbiting the camera around current center
stopOrbitStop orbit animation
setCameraOptionsConfigure camera controller (enable/disable rotation, zoom, tilt)

Extended Entity Types (toolset: entity-ext)

ToolDescription
addBillboardAdd an image icon at a position
addBoxAdd a 3D box with dimensions and material
addCorridorAdd a corridor (path with width)
addCylinderAdd a cylinder or cone
addEllipseAdd an ellipse (oval)
addRectangleAdd a rectangle by geographic bounds
addWallAdd a wall along positions

Animation (toolset: animation)

ToolDescription
createAnimationCreate time-based animation with waypoints (moving entity along path)
controlAnimationPlay or pause the current animation
removeAnimationRemove an animation entity
listAnimationsList all active animations
updateAnimationPathUpdate animation path visual properties
trackEntityFollow an entity with the camera
controlClockConfigure Cesium clock (time range, speed, animation state)
setGlobeLightingEnable/disable globe lighting and atmospheric effects

Tiles & Data (toolset: tiles)

ToolDescription
load3dTilesLoad 3D Tiles from URL or Ion asset ID
loadTerrainSet terrain provider
loadImageryServiceAdd imagery service (WMS/WMTS/XYZ/Ion)

Interaction (toolset: interaction)

ToolDescription
screenshotCapture map as base64 PNG
highlightHighlight layer features

Other

ToolToolsetDescription
playTrajectorytrajectoryAnimate entity along coordinate path
addHeatmapheatmapGenerate heatmap from point data

MCP Resources

URIDescription
cesium://scene/cameraCurrent camera position, heading, pitch, roll
cesium://scene/layersList of all loaded layers with types and visibility

Environment Variables

VariableDefaultDescription
CESIUM_WS_PORT9100WebSocket server port
DEFAULT_SESSION_IDdefaultPreferred browser session for MCP tool routing
CESIUM_TOOLSETS(not set)Toolset activation: omit for defaults, all for everything, or comma-separated list
CESIUM_LOCALEenTool description language: en (English, default) or zh-CN (Chinese)
MCP_TRANSPORTstdioMCP transport mode: stdio or http
MCP_HTTP_PORT(auto)HTTP port for Streamable HTTP mode (default: CESIUM_WS_PORT + 100)

Browser-Side Setup

Your browser page needs to connect to the runtime via WebSocket and relay commands to cesium-mcp-bridge:

typescript
import { CesiumBridge } from 'cesium-mcp-bridge'
const bridge = new CesiumBridge(viewer)const ws = new WebSocket('ws://localhost:9100?session=default')
ws.onmessage = async (event) => {  const { id, method, params } = JSON.parse(event.data)  try {    const result = await bridge.execute({ action: method, params })    ws.send(JSON.stringify({ id, result }))  } catch (error) {    ws.send(JSON.stringify({ id, error: { message: String(error) } }))  }}

Session Routing

Multiple browser tabs can connect to a single runtime using different session IDs:

Tab A: ws://localhost:9100?session=geoagentTab B: ws://localhost:9100?session=demo

Routing via MCP URL (recommended for Dify / third-party integrations)

Add ?session=xxx to the MCP HTTP endpoint URL:

http://localhost:3216/mcp?session=geoagent

All tool calls from that connection are automatically routed to the matching browser — no need to inject sessionId into prompts or tool parameters.

Routing priority

  1. sessionId in tool parameters (explicit per-call override)
  2. ?session=xxx in MCP HTTP URL (connection-level)
  3. DEFAULT_SESSION_ID environment variable
  4. First connected browser (fallback)

Explicit routing is fail-closed: when a tool parameter or MCP URL names a session that is missing or disconnected, the call returns an error instead of running against another Viewer. The default/first-connected fallback applies only when the caller did not explicitly select a session. Pending responses are also accepted only from the browser that received the command, and are rejected immediately if that browser disconnects.

Resource Handles

The runtime always registers storeResource, listResources, and deleteResource. Store large GeoJSON or CZML once, then pass the returned resourceId to addGeoJsonLayer, addGeoJsonPrimitive, addLabel, addHeatmap, or loadCzml.

Resources are isolated by the same browser sessionId used for command routing. They expire after 30 minutes by default and are never forwarded to the browser until a consuming tool resolves the handle. Existing inline data and remote url inputs remain compatible.

See the resource handle guide.

HTTP Push API

The runtime also exposes an HTTP endpoint for non-MCP integrations (e.g., FastAPI backend):

bash
curl -X POST http://localhost:9100/push \  -H "Content-Type: application/json" \  -d '{"sessionId": "default", "command": {"action": "flyTo", "params": {"longitude": 116.39, "latitude": 39.91}}}'

Compatibility

ChannelRuntimeBridgeMCP protocolCesium
latest1.147.1+ (1.147.x)matching aligned release2025-11-25 + 2026-07-28~1.147.0
historical 2.0.02.0.02.0.02025-11-25 + 2026-07-28~1.147.0
historical 1.148.01.148.01.148.02025-11-25 + 2026-07-28~1.145.0

The stable release serves both protocol generations from the same stdio/HTTP entry using @modelcontextprotocol/server and @modelcontextprotocol/node 2.0.0 packages.

The repository pins the official conformance runner separately and validates the 2026-07-28 server-stateless scenario with:

bash
npm run test:conformance:mcp

Conformance-only diagnostic tools are enabled only for that command. They are not registered by normal stdio, HTTP, or browser-demo runtime startup.

License

MIT

來源:packages/cesium-mcp-runtime/README.md,提交 6572b72

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

5
  1. v2.0.0最新Nov 7, 2026
  2. v1.147.0Oct 10, 2026
  3. v1.146.0Sep 28, 2026
  4. v1.145.3Sep 17, 2026
  5. v1.145.1Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分