Skip to content

Commit d9a16d8

Browse files
ochafikclaude
andcommitted
fix(map-server): fix Express listen callback + add e2e tests
- Fix incorrect Express listen() callback signature (err param doesn't exist) - Add map-server to e2e test suite with SLOW_SERVERS timeout (5s for tiles) - Improve comment about experimental ui/update-model-context API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 99fce46 commit d9a16d8

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

examples/map-server/server-utils.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ export async function startServer(
5454
}
5555
});
5656

57-
const httpServer = app.listen(port, (err) => {
58-
if (err) {
59-
console.error("Failed to start server:", err);
60-
process.exit(1);
61-
}
57+
const httpServer = app.listen(port, () => {
6258
console.log(`${name} listening on http://localhost:${port}/mcp`);
6359
});
6460

examples/map-server/src/mcp-app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ function scheduleLocationUpdate(cesiumViewer: any): void {
294294

295295
log.info("Updating model context:", contextText);
296296

297-
// Warning: This request method isn't standard yet
297+
// EXPERIMENTAL: This request method isn't standard yet and may change.
298+
// It updates the model's context with the current map location.
298299
// See https://github.com/modelcontextprotocol/ext-apps/pull/125
300+
// If the host doesn't support this, the request will silently fail.
299301
app.request(
300302
<any>{
301303
method: "ui/update-model-context",

tests/e2e/servers.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const DYNAMIC_MASKS: Record<string, string[]> = {
1313
"basic-vue": ["#server-time"], // Server time display
1414
"cohort-heatmap": ['[class*="heatmapWrapper"]'], // Heatmap grid (random data)
1515
"customer-segmentation": [".chart-container"], // Scatter plot (random data)
16+
// Note: map-server uses SLOW_SERVERS timeout instead of masking to wait for tiles
1617
"system-monitor": [
1718
".chart-container", // CPU chart (highly dynamic)
1819
"#status-text", // Current timestamp
@@ -25,6 +26,12 @@ const DYNAMIC_MASKS: Record<string, string[]> = {
2526
"wiki-explorer": ["#graph"], // Force-directed graph (dynamic layout)
2627
};
2728

29+
// Servers that need extra stabilization time (e.g., for tile loading, WebGL init)
30+
const SLOW_SERVERS: Record<string, number> = {
31+
"map-server": 5000, // CesiumJS needs time for tiles to load
32+
threejs: 2000, // Three.js WebGL initialization
33+
};
34+
2835
// Server configurations (key is used for screenshot filenames, name is the MCP server name)
2936
const SERVERS = [
3037
{ key: "integration", name: "Integration Test Server" },
@@ -37,6 +44,7 @@ const SERVERS = [
3744
{ key: "budget-allocator", name: "Budget Allocator Server" },
3845
{ key: "cohort-heatmap", name: "Cohort Heatmap Server" },
3946
{ key: "customer-segmentation", name: "Customer Segmentation Server" },
47+
{ key: "map-server", name: "CesiumJS Map Server" },
4048
{ key: "scenario-modeler", name: "SaaS Scenario Modeler" },
4149
{ key: "sheet-music", name: "Sheet Music Server" },
4250
{ key: "system-monitor", name: "System Monitor Server" },
@@ -121,7 +129,10 @@ SERVERS.forEach((server) => {
121129

122130
test("screenshot matches golden", async ({ page }) => {
123131
await loadServer(page, server.name);
124-
await page.waitForTimeout(500); // Brief stabilization
132+
133+
// Some servers (WebGL, tile-based) need extra stabilization time
134+
const stabilizationMs = SLOW_SERVERS[server.key] ?? 500;
135+
await page.waitForTimeout(stabilizationMs);
125136

126137
// Get mask locators for dynamic content (timestamps, charts, etc.)
127138
const mask = getMaskLocators(page, server.key);
386 KB
Loading

0 commit comments

Comments
 (0)