From 1e72d21a350609109de0f998187a851cef976db7 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Mon, 12 Jan 2026 16:18:47 -0500 Subject: [PATCH 1/4] Add server-level icons with light and dark theme support Implements MCP server icons at the correct architectural level (server initialization) instead of at the tool level. Adds both light and dark theme variants of the Mapbox logo using base64-encoded SVG data URIs. - Add mapbox-logo-black.svg for light theme backgrounds - Add mapbox-logo-white.svg for dark theme backgrounds - Update server initialization to include icons array with theme property - Use 800x180 SVG logos embedded as base64 data URIs This replaces the previous incorrect approach of adding icons to individual tools, which was not aligned with the MCP specification. Co-Authored-By: Claude Sonnet 4.5 --- assets/mapbox-logo-black.svg | 38 ++++++++++++++++++++++++++++++++ assets/mapbox-logo-white.svg | 42 ++++++++++++++++++++++++++++++++++++ src/index.ts | 16 +++++++++++++- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 assets/mapbox-logo-black.svg create mode 100644 assets/mapbox-logo-white.svg diff --git a/assets/mapbox-logo-black.svg b/assets/mapbox-logo-black.svg new file mode 100644 index 0000000..a0cbd94 --- /dev/null +++ b/assets/mapbox-logo-black.svg @@ -0,0 +1,38 @@ + + + +Mapbox_Logo_08 + + + + + + + + + + + + + + + diff --git a/assets/mapbox-logo-white.svg b/assets/mapbox-logo-white.svg new file mode 100644 index 0000000..8d62aef --- /dev/null +++ b/assets/mapbox-logo-white.svg @@ -0,0 +1,42 @@ + + + + +Mapbox_Logo_08 + + + + + + + + + + + + + + + diff --git a/src/index.ts b/src/index.ts index 50d53a7..c4313fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,21 @@ const allResources = getAllResources(); const server = new McpServer( { name: versionInfo.name, - version: versionInfo.version + version: versionInfo.version, + icons: [ + { + src: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIxLjAuMiwgU1ZHIEV4c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jcsNzkuOCAxMTIuOCw3MS4xIAkJIi8+Cgk8L2c+CjwvZz4KPC9zdmc+Cg==', + mimeType: 'image/svg+xml', + sizes: ['800x180'], + theme: 'dark' + } + ] }, { capabilities: { From c20582133bba072c7d879d77d1650a06c301bc07 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Mon, 12 Jan 2026 16:24:43 -0500 Subject: [PATCH 2/4] Update @modelcontextprotocol/sdk to 1.25.2 Updates the MCP SDK from 1.25.1 to 1.25.2 and recreates the output validation patch for the new version. The patch continues to convert strict output schema validation errors to warnings, allowing tools to gracefully handle schema mismatches. Changes: - Update @modelcontextprotocol/sdk from ^1.25.1 to ^1.25.2 - Recreate SDK patch for version 1.25.2 - Remove obsolete 1.25.1 patch file - All 397 tests pass with new SDK version Co-Authored-By: Claude Sonnet 4.5 --- package-lock.json | 8 ++++---- package.json | 2 +- ....25.1.patch => @modelcontextprotocol+sdk+1.25.2.patch} | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename patches/{@modelcontextprotocol+sdk+1.25.1.patch => @modelcontextprotocol+sdk+1.25.2.patch} (100%) diff --git a/package-lock.json b/package-lock.json index 87d6481..1fae152 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@mcp-ui/server": "^5.13.1", - "@modelcontextprotocol/sdk": "^1.25.1", + "@modelcontextprotocol/sdk": "^1.25.2", "@opentelemetry/api": "^1.9.0", "@opentelemetry/auto-instrumentations-node": "^0.56.0", "@opentelemetry/exporter-trace-otlp-http": "^0.56.0", @@ -1913,9 +1913,9 @@ } }, "node_modules/@modelcontextprotocol/sdk": { - "version": "1.25.1", - "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.25.1.tgz", - "integrity": "sha512-yO28oVFFC7EBoiKdAn+VqRm+plcfv4v0xp6osG/VsCB0NlPZWi87ajbCZZ8f/RvOFLEu7//rSRmuZZ7lMoe3gQ==", + "version": "1.25.2", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.25.2.tgz", + "integrity": "sha512-LZFeo4F9M5qOhC/Uc1aQSrBHxMrvxett+9KLHt7OhcExtoiRN9DKgbZffMP/nxjutWDQpfMDfP3nkHI4X9ijww==", "license": "MIT", "dependencies": { "@hono/node-server": "^1.19.7", diff --git a/package.json b/package.json index 5c5e77a..304046d 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ ], "dependencies": { "@mcp-ui/server": "^5.13.1", - "@modelcontextprotocol/sdk": "^1.25.1", + "@modelcontextprotocol/sdk": "^1.25.2", "@opentelemetry/api": "^1.9.0", "@opentelemetry/auto-instrumentations-node": "^0.56.0", "@opentelemetry/exporter-trace-otlp-http": "^0.56.0", diff --git a/patches/@modelcontextprotocol+sdk+1.25.1.patch b/patches/@modelcontextprotocol+sdk+1.25.2.patch similarity index 100% rename from patches/@modelcontextprotocol+sdk+1.25.1.patch rename to patches/@modelcontextprotocol+sdk+1.25.2.patch From 640559c5a42cdce77a51910b5536b815d4942111 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Tue, 13 Jan 2026 14:08:45 -0500 Subject: [PATCH 3/4] Add geocoding disambiguation with elicitations - Implement elicitation support for SearchAndGeocodeTool - When 2-10 results are returned, present user with selection form - User can select specific result or decline to see all results - Falls back gracefully if elicitation fails or is unsupported - Uses enum with enumNames for better UX in supporting clients Co-Authored-By: Claude Sonnet 4.5 --- .../SearchAndGeocodeTool.ts | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/src/tools/search-and-geocode-tool/SearchAndGeocodeTool.ts b/src/tools/search-and-geocode-tool/SearchAndGeocodeTool.ts index ebabf3b..87948b2 100644 --- a/src/tools/search-and-geocode-tool/SearchAndGeocodeTool.ts +++ b/src/tools/search-and-geocode-tool/SearchAndGeocodeTool.ts @@ -211,6 +211,89 @@ export class SearchAndGeocodeTool extends MapboxApiBasedTool< `SearchAndGeocodeTool: Successfully completed search, found ${data.features?.length || 0} results` ); + // Check if we have multiple results that might be ambiguous + if ( + this.server && + data.features && + data.features.length >= 2 && + data.features.length <= 10 + ) { + // Use elicitation to let user choose which result they want + try { + const options = data.features.map((feature, index) => { + const props = feature.properties || {}; + let label = props.name || 'Unknown'; + if (props.place_formatted) { + label += ` - ${props.place_formatted}`; + } else if (props.full_address) { + label += ` - ${props.full_address}`; + } + return { value: String(index), label }; + }); + + // Create a JSON Schema with enum for the selection + const result = await this.server.server.elicitInput({ + mode: 'form', + message: `Found ${data.features.length} results for "${input.q}". Please select the correct location:`, + requestedSchema: { + type: 'object', + properties: { + selectedIndex: { + type: 'string', + title: 'Select Location', + description: 'Choose the correct location from the results', + enum: options.map((o) => o.value), + // Include labels for better UX (some clients may support this) + enumNames: options.map((o) => o.label) + } + }, + required: ['selectedIndex'] + } + }); + + if (result.action === 'accept' && result.content?.selectedIndex) { + const selectedIndexStr = + typeof result.content.selectedIndex === 'string' + ? result.content.selectedIndex + : String(result.content.selectedIndex); + const selectedIndex = parseInt(selectedIndexStr, 10); + const selectedFeature = data.features[selectedIndex]; + + // Return only the selected result + const singleResult: SearchBoxResponse = { + ...data, + features: [selectedFeature] + }; + + return { + content: [ + { + type: 'text', + text: this.formatGeoJsonToText( + singleResult as MapboxFeatureCollection + ) + } + ], + structuredContent: singleResult, + isError: false + }; + } else if (result.action === 'decline') { + // User declined to select - return all results as before + this.log( + 'info', + 'SearchAndGeocodeTool: User declined to select a specific result' + ); + } + } catch (elicitError) { + // If elicitation fails, fall back to returning all results + this.log( + 'warning', + `SearchAndGeocodeTool: Elicitation failed: ${elicitError instanceof Error ? elicitError.message : 'Unknown error'}` + ); + } + } + + // Default behavior: return all results return { content: [ { From 7d8cab3ff560e8bbb2d7ec123734dc223b6a3ba0 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Tue, 13 Jan 2026 14:51:13 -0500 Subject: [PATCH 4/4] Add unit tests for elicitation behavior - Test elicitation triggers when 2-10 results returned - Test no elicitation with 1 result or >10 results - Test user accepts elicitation (returns selected result) - Test user declines elicitation (returns all results) - Test graceful fallback when elicitation fails - Test graceful fallback when server not installed - Test enumNames are correctly formatted with location labels - Mock server.elicitInput and sendLoggingMessage for testing All 25 SearchAndGeocodeTool tests passing. Co-Authored-By: Claude Sonnet 4.5 --- .../SearchAndGeocodeTool.test.ts | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) diff --git a/test/tools/search-and-geocode-tool/SearchAndGeocodeTool.test.ts b/test/tools/search-and-geocode-tool/SearchAndGeocodeTool.test.ts index 9bda04e..5d8ee20 100644 --- a/test/tools/search-and-geocode-tool/SearchAndGeocodeTool.test.ts +++ b/test/tools/search-and-geocode-tool/SearchAndGeocodeTool.test.ts @@ -391,4 +391,230 @@ describe('SearchAndGeocodeTool', () => { isError: true }); }); + + describe('Elicitation behavior', () => { + const createMockServer = (elicitResponse?: { + action: 'accept' | 'decline'; + content?: Record; + }) => { + return { + server: { + elicitInput: vi.fn().mockResolvedValue( + elicitResponse || { + action: 'accept', + content: { selectedIndex: '0' } + } + ), + sendLoggingMessage: vi.fn() + }, + registerTool: vi.fn() + } as any; + }; + + const createMultipleResultsResponse = (count: number) => ({ + type: 'FeatureCollection', + features: Array.from({ length: count }, (_, i) => ({ + type: 'Feature', + properties: { + name: `Springfield #${i + 1}`, + place_formatted: `Springfield, State ${i + 1}, United States` + }, + geometry: { + type: 'Point', + coordinates: [-73.0 - i, 42.0 + i] + } + })) + }); + + it('triggers elicitation when 2-10 results returned', async () => { + const mockResponse = createMultipleResultsResponse(5); + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + const mockServer = createMockServer(); + tool.installTo(mockServer); + + await tool.run({ q: 'Springfield' }); + + expect(mockServer.server.elicitInput).toHaveBeenCalledOnce(); + expect(mockServer.server.elicitInput).toHaveBeenCalledWith({ + mode: 'form', + message: + 'Found 5 results for "Springfield". Please select the correct location:', + requestedSchema: expect.objectContaining({ + type: 'object', + properties: expect.objectContaining({ + selectedIndex: expect.objectContaining({ + type: 'string', + title: 'Select Location', + enum: ['0', '1', '2', '3', '4'], + enumNames: expect.arrayContaining([ + expect.stringContaining('Springfield #1'), + expect.stringContaining('Springfield #2') + ]) + }) + }), + required: ['selectedIndex'] + }) + }); + }); + + it('does not trigger elicitation with only 1 result', async () => { + const mockResponse = createMultipleResultsResponse(1); + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + const mockServer = createMockServer(); + tool.installTo(mockServer); + + const result = await tool.run({ q: 'Paris' }); + + expect(mockServer.server.elicitInput).not.toHaveBeenCalled(); + expect(result.isError).toBe(false); + expect((result.structuredContent as any).features).toHaveLength(1); + }); + + it('does not trigger elicitation with more than 10 results', async () => { + const mockResponse = createMultipleResultsResponse(15); + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + const mockServer = createMockServer(); + tool.installTo(mockServer); + + const result = await tool.run({ q: 'Main Street' }); + + expect(mockServer.server.elicitInput).not.toHaveBeenCalled(); + expect(result.isError).toBe(false); + expect((result.structuredContent as any).features).toHaveLength(15); + }); + + it('returns only selected result when user accepts elicitation', async () => { + const mockResponse = createMultipleResultsResponse(3); + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + const mockServer = createMockServer({ + action: 'accept', + content: { selectedIndex: '1' } // Select second item + }); + tool.installTo(mockServer); + + const result = await tool.run({ q: 'Springfield' }); + + expect(result.isError).toBe(false); + const features = (result.structuredContent as any).features; + expect(features).toHaveLength(1); + expect(features[0].properties.name).toBe('Springfield #2'); + }); + + it('returns all results when user declines elicitation', async () => { + const mockResponse = createMultipleResultsResponse(4); + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + const mockServer = createMockServer({ + action: 'decline' + }); + tool.installTo(mockServer); + + const result = await tool.run({ q: 'Springfield' }); + + expect(result.isError).toBe(false); + const features = (result.structuredContent as any).features; + expect(features).toHaveLength(4); + }); + + it('falls back to all results when elicitation fails', async () => { + const mockResponse = createMultipleResultsResponse(3); + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + const mockServer = { + server: { + elicitInput: vi + .fn() + .mockRejectedValue(new Error('Elicitation not supported')), + sendLoggingMessage: vi.fn() + }, + registerTool: vi.fn() + } as any; + tool.installTo(mockServer); + + const result = await tool.run({ q: 'Springfield' }); + + expect(result.isError).toBe(false); + const features = (result.structuredContent as any).features; + expect(features).toHaveLength(3); + }); + + it('handles elicitation gracefully when server is not installed', async () => { + const mockResponse = createMultipleResultsResponse(5); + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + // Don't install to server - tool.server will be null + + const result = await tool.run({ q: 'Springfield' }); + + expect(result.isError).toBe(false); + const features = (result.structuredContent as any).features; + expect(features).toHaveLength(5); + }); + + it('builds correct enumNames with location labels', async () => { + const mockResponse = { + type: 'FeatureCollection', + features: [ + { + type: 'Feature', + properties: { + name: 'Springfield', + place_formatted: 'Springfield, Illinois, United States' + }, + geometry: { type: 'Point', coordinates: [-89.6501, 39.7817] } + }, + { + type: 'Feature', + properties: { + name: 'Springfield', + full_address: '123 Main St, Springfield, MA 01103' + }, + geometry: { type: 'Point', coordinates: [-72.5301, 42.1015] } + } + ] + }; + const { httpRequest } = setupHttpRequest({ + json: async () => mockResponse + }); + + const tool = new SearchAndGeocodeTool({ httpRequest }); + const mockServer = createMockServer(); + tool.installTo(mockServer); + + await tool.run({ q: 'Springfield' }); + + const elicitCall = mockServer.server.elicitInput.mock.calls[0][0]; + expect( + elicitCall.requestedSchema.properties.selectedIndex.enumNames + ).toEqual([ + 'Springfield - Springfield, Illinois, United States', + 'Springfield - 123 Main St, Springfield, MA 01103' + ]); + }); + }); });