🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

cesium-mcp-runtime

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cesium-mcp-runtime

Cesium MCP Runtime Server — AI Agent 通过 MCP 协议操控浏览器 Cesium

latest
Source
npmnpm
Version
1.144.1
Version published
Weekly downloads
457
-1.51%
Maintainers
1
Weekly downloads
 
Created
Source

cesium-mcp-runtime

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?.

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.

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

# Stable channel (stdio mode, default)
npx cesium-mcp-runtime

# Or install globally
npm install -g cesium-mcp-runtime
cesium-mcp-runtime

Streamable HTTP Mode

For remote/cloud MCP clients like Dify:

# Start in HTTP transport mode
npx cesium-mcp-runtime --transport http --port 3000

# MCP endpoint: POST http://localhost:3000/mcp

Environment variable alternative:

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

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

MCP Client Configuration

Claude Desktop

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

VS Code (Copilot)

In .vscode/mcp.json:

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

Cursor

In .cursor/mcp.json:

{
  "mcpServers": {
    "cesium": {
      "command": "npx",
      "args": ["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, and input validation are generated from the canonical JSON Schemas in cesium-mcp-contracts.

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
camera4Advanced camera controls (orbit, lookAt)
entity-ext7Extended entity types (box, cylinder, wall, etc.)
animation8Animation system (waypoints, clock, tracking, lighting)
tiles73D Tiles, Gaussian Splats, terrain, imagery services, CZML & KML
trajectory1Trajectory playback
heatmap1Heatmap visualization
scene3Scene options, post-processing & Runtime-only Ion credentials
geolocation1Geocoding — convert address/place name to coordinates (Nominatim/OSM)

Toolset Configuration

{
  "mcpServers": {
    "cesium": {
      "command": "npx",
      "args": ["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:

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=geoagent
Tab B: ws://localhost:9100?session=demo

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

  • sessionId in tool parameters (explicit per-call override)
  • ?session=xxx in MCP HTTP URL (connection-level)
  • DEFAULT_SESSION_ID environment variable
  • 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.

HTTP Push API

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

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
latestcurrent stablematching stable2025-11-25 + 2026-07-28~1.143.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:

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

Keywords

cesium

FAQs

Package last updated on 05 Aug 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts