Skip to content

feat: add imagery-server with imagery_add, imagery_remove, imagery_list tools#22

Merged
MKartaviciute merged 5 commits into
CesiumGS:mainfrom
gaopengbin:feat/imagery-server
Mar 23, 2026
Merged

feat: add imagery-server with imagery_add, imagery_remove, imagery_list tools#22
MKartaviciute merged 5 commits into
CesiumGS:mainfrom
gaopengbin:feat/imagery-server

Conversation

@gaopengbin
Copy link
Copy Markdown
Contributor

@gaopengbin gaopengbin commented Mar 18, 2026

Summary

Adds a new imagery-server MCP server that provides 3 tools for managing CesiumJS imagery layers through AI interactions.

imagery_server.mp4

New Tools

Tool Description
imagery_add Add imagery layers with 10 provider types
imagery_remove Remove layers by index, name, or remove all
imagery_list List all current imagery layers with details

Supported Provider Types

UrlTemplate, WMS, WMTS, ArcGisMapServer, BingMaps, TileMapService, OpenStreetMap, SingleTile, Ion, MapboxStyle

Architecture

  • Server-side (servers/imagery-server/): Full MCP server with Zod v4 schema validation, WebSocket communication on port 3005
  • Client-side (test-applications/):
    • ImageryManager in client-core handles all 3 commands in the browser
    • Supports both sync constructors and async fromUrl() factory patterns (CesiumJS 1.134+)
    • Registered alongside existing Camera, Entity, and Animation managers
    • Web-app configured with MCP_IMAGERY_PORT=3005

Quality

  • 68 unit tests with coverage: 100% statements / 96.42% branches / 100% functions / 100% lines
  • Zero ESLint errors, Prettier formatted
  • TypeScript strict mode — zero compilation errors
  • End-to-end tested: WebSocket connection verified, all 3 commands tested in live CesiumJS browser environment

Files Changed

Server (19 new files):

  • servers/imagery-server/ — package.json, tsconfig, vitest config
  • src/index.ts — Server entry point (port 3005)
  • src/schemas/ — Zod v4 schemas for providers, tools, responses
  • src/tools/ — imagery-add, imagery-remove, imagery-list handlers
  • src/utils/ — Type definitions
  • test/ — 4 test files covering schemas, add, remove, list

Client (6 modified/new files):

  • client-core/src/managers/imagery-manager.ts — NEW: Browser-side handler
  • client-core/src/cesium-app.ts — Register ImageryManager
  • web-app/src/app.ts — Add Imagery Server to MCP server list
  • web-app/.env.example — Add MCP_IMAGERY_PORT
  • web-app/esbuild.config.cjs — Add port define

Port Allocation

Server Port
Camera 3002
Entity 3003
Animation 3004
Imagery 3005

@MKartaviciute
Copy link
Copy Markdown
Contributor

Could you add README.md for this mcp server to match other mcp servers, also list a new mcp server under those READMEs: https://github.com/CesiumGS/cesium-ai-integrations/blob/main/mcp/README.md
https://github.com/CesiumGS/cesium-ai-integrations/blob/main/mcp/cesium-js/README.md

@MKartaviciute
Copy link
Copy Markdown
Contributor

There are some formatting issues: https://github.com/CesiumGS/cesium-ai-integrations/actions/runs/23234847210/job/67715534364?pr=22
You can run pnpm run format for formatting and pnpm run check to check if it pass formatting and linting

@MKartaviciute MKartaviciute self-requested a review March 19, 2026 09:49
@gaopengbin
Copy link
Copy Markdown
Contributor Author

Thanks for the review feedback! All issues have been addressed:

Commit 69a43f7:

  • Added servers/imagery-server/README.md with full tool documentation (3 tools, 10 provider types, MCP client config, environment variables)
  • Listed imagery-server in mcp/README.md (table, getting started, architecture tree)
  • Listed imagery-server in mcp/cesium-js/README.md (packages, tools, structure, build/run commands, MCP config)
  • Fixed Prettier formatting in imagery-manager.ts

Commit 79aad8b:

  • Fixed Prettier table column alignment in mcp/cesium-js/README.md

All 3 CI checks are now passing. Thanks for the reminder about running pnpm run format and pnpm run check — I'll make sure to do that before pushing in the future!

Rectangle,
} from "cesium";

export interface ImageryAddResult extends MCPCommandResult {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move interfaces into separate file under types folder

Comment thread mcp/cesium-js/servers/imagery-server/src/schemas/core-schemas.ts
Comment thread mcp/cesium-js/servers/imagery-server/README.md
@gaopengbin
Copy link
Copy Markdown
Contributor Author

Hi @MKartaviciute, all 6 comments addressed in this push:

  1. Provider type names — switch cases now use the full schema names (UrlTemplateImageryProvider, etc.) and getProviderTypeName() returns consistent names too.
  2. Interfaces — moved to types/imagery-types.ts.
  3. Unit tests — added 23 tests for imagery-manager (all providers, add/remove/list, edge cases).
  4. assetId & key — added both to ImageryAddInputSchema and wired through the tool handler.
  5. url & readylistImagery() now populates them from the layer/provider.
  6. .env.example — done, same pattern as other servers.

Also updated the README to document assetId and key params.

…st tools

Server-side (servers/imagery-server/):
- 3 MCP tools: imagery_add, imagery_remove, imagery_list
- 10 imagery provider types: UrlTemplate, WMS, WMTS, ArcGisMapServer,
  BingMaps, TileMapService, OpenStreetMap, SingleTile, Ion, MapboxStyle
- Zod v4 schema validation for all tool inputs
- WebSocket communication on port 3005
- 68 unit tests with 100%/96%/100%/100% coverage
- ESLint and Prettier clean

Client-side (test-applications/):
- ImageryManager in client-core: handles imagery_add/remove/list commands
- Supports both sync constructors and async fromUrl() factory patterns
- Registered in cesium-app.ts alongside existing managers
- web-app configured with MCP_IMAGERY_PORT=3005

Port fix: changed default from 3004 to 3005 to avoid conflict with Animation Server
- Add README.md for imagery-server with full tool documentation
- Add imagery-server to mcp/README.md (table, getting started, architecture)
- Add imagery-server to mcp/cesium-js/README.md (packages, tools, build, run, config)
- Fix prettier formatting in imagery-manager.ts
…nd missing fields

- Align switch cases with ImageryProviderTypeSchema full names

- Extract interfaces to types/imagery-types.ts

- Add 23 unit tests for imagery-manager

- Add assetId and key fields to ImageryAddInputSchema

- Populate url and ready in listImagery response

- Add .env.example for imagery-server

- Update README with assetId and key params
@gaopengbin gaopengbin force-pushed the feat/imagery-server branch from d6b7fc3 to 07ae80a Compare March 20, 2026 08:30
@gaopengbin
Copy link
Copy Markdown
Contributor Author

Hi @MKartaviciute 👋

I've rebased to the latest main and all review feedback has been addressed in the previous commit (fix: address code review feedback). Summary of changes:

  • ✅ Provider type names aligned (IonImageryProvider → IonImageryProviderConfig, etc.)
  • ✅ Interfaces extracted to types/ directory
  • ✅ 68 unit tests with full coverage (100% statements / 96.42% branches / 100% functions / 100% lines)
  • assetId / key included in schema definitions
  • url / ready properly populated in imagery_list response
  • .env.example includes all 5 standard environment variables

All CI checks are green. Would appreciate a re-review when you have a moment. Thanks! 🙏

Comment thread mcp/cesium-js/servers/imagery-server/src/tools/imagery-list.ts
Comment thread mcp/cesium-js/servers/imagery-server/src/tools/imagery-remove.ts
Comment thread mcp/cesium-js/servers/imagery-server/src/schemas/tool-schemas.ts Outdated
@MKartaviciute
Copy link
Copy Markdown
Contributor

Hi @gaopengbin — I’ve left a few more comments.
Thanks for helping add this functionality!

@gaopengbin gaopengbin force-pushed the feat/imagery-server branch 2 times, most recently from 412c943 to a01cfb3 Compare March 23, 2026 10:17
- Use buildSuccessResponse helper in imagery-list for consistency
- Fix removedCount reporting 1 on empty removeAll (now returns 0)
- Make url field optional in schema (not required for IonImageryProvider)
- Replace GoogleEarthEnterpriseImageryProvider fallback with proper
  fromMetadata implementation and add to getProviderTypeName detection
- Add unit tests for empty removeAll and GoogleEarthEnterprise provider
- Update affected tests for new response format and optional url
@gaopengbin gaopengbin force-pushed the feat/imagery-server branch from a01cfb3 to 1ab32ed Compare March 23, 2026 10:25
@MKartaviciute
Copy link
Copy Markdown
Contributor

@gaopengbin Looks good!. Approved PR.

@MKartaviciute MKartaviciute merged commit d20e554 into CesiumGS:main Mar 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants