Skip to content

Conversation

@mattpodwysocki
Copy link
Contributor

Description

Adds MCP-UI support to URL-returning tools, enabling rich iframe embedding in compatible MCP clients
while maintaining full backwards compatibility.

What is MCP-UI?

MCP-UI is an open specification that allows MCP tools to return interactive UI resources that clients can
render as embedded iframes. This enables richer, more visual experiences in supporting clients like
Goose, while seamlessly falling back to text URLs in clients like Claude Desktop.

Changes

Enhanced Tools (3 total):

  • preview_style_tool - Embeds Mapbox style previews
  • geojson_preview_tool - Embeds geojson.io visualizations
  • style_comparison_tool - Embeds side-by-side style comparisons

Implementation Details:

  • Tools now return both text URL and UIResource content
  • MCP-UI is enabled by default (fully backwards compatible)
  • Added @mcp-ui/server@^5.13.1 dependency
  • Configuration via ENABLE_MCP_UI env var or --disable-mcp-ui flag
  • Helper function isMcpUiEnabled() in src/config/toolConfig.ts

Backwards Compatibility:

  • Clients without MCP-UI support (e.g., Claude Desktop) ignore the UIResource and use the text URL
  • Clients with MCP-UI support (e.g., Goose) can render embedded iframes
  • No breaking changes - existing integrations continue working unchanged

Documentation:

  • Updated README.md with MCP-UI configuration section
  • Updated CLAUDE.md with developer guidance
  • Added inline code comments

Files Changed

  • src/config/toolConfig.ts - Configuration and helper functions
  • src/tools/preview-style-tool/PreviewStyleTool.ts - MCP-UI support
  • src/tools/geojson-preview-tool/GeojsonPreviewTool.ts - MCP-UI support
  • src/tools/style-comparison-tool/StyleComparisonTool.ts - MCP-UI support
  • package.json - Added @mcp-ui/server dependency
  • test/**/*.test.ts - Updated tests for default enabled behavior
  • README.md & CLAUDE.md - Documentation updates

Test

Unit Tests:

  • ✅ All 282 tests passing
  • ✅ New tests for MCP-UI enabled (default) behavior
  • ✅ New tests for MCP-UI disabled behavior
  • ✅ Configuration parsing tests for --disable-mcp-ui flag
  • ✅ Environment variable override tests

Manual Testing:

  1. With MCP-UI enabled (default):
    npm run build
    # Test in Goose or ui-inspector - should see both text URL and UIResource
    
  2. With MCP-UI disabled:
    ENABLE_MCP_UI=false npm run build

Should return only text URL (original behavior)

  1. Backwards compatibility:
    - Tested in Claude Desktop - works unchanged (ignores UIResource)
    - Text URLs remain fully functional in all clients

Test Prompts:

Preview a Mapbox style:
Preview Mapbox style Urban Night with my public token

Results in Claude with no MCP-UI support (redacted for security)
Screenshot 2025-11-07 at 09 51 15

Results in Goose with MCP-UI support
Screenshot 2025-11-07 at 09 47 08

Preview GeoJSON:
Preview this GeoJSON: {"type": "Point", "coordinates": [2.2945, 48.8584]}

In Claude Desktop with no MCP-UI support
Screenshot 2025-11-07 at 09 53 40

In Goose with MCP-UI support (note there is a CORS issue)
Screenshot 2025-11-07 at 09 54 47

We can ask Goose, however to visualize it inline with their own OSM view:
Screenshot 2025-11-07 at 09 55 38

Expected Behavior:

  • MCP-UI supporting clients: See embedded iframe
  • Non-supporting clients: See clickable text URL
  • Both provide full functionality

Code Quality:

  • ✅ Linter passed (68 pre-existing warnings unrelated to this PR)
  • ✅ Formatter passed
  • ✅ Build successful

Checklist

  • Code has been tested locally
  • Unit tests have been added or updated
  • Documentation has been updated if needed

Additional Notes

@mattpodwysocki mattpodwysocki requested a review from a team as a code owner November 7, 2025 14:55
zmofei
zmofei previously approved these changes Nov 7, 2025
Copy link
Member

@zmofei zmofei left a comment

Choose a reason for hiding this comment

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

Nice improvement.

@mattpodwysocki
Copy link
Contributor Author

Nice improvement.

@zmofei increased the size to 1100x700 as a suggested size. That works for the most part.

@mattpodwysocki mattpodwysocki requested a review from zmofei November 8, 2025 04:10
**Supported Tools:**

- `preview_style_tool` - Embeds Mapbox style previews
- `geojson_preview_tool` - Embeds geojson.io visualizations

Choose a reason for hiding this comment

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

I thought it's static image api and not geojson.io?

@mattpodwysocki mattpodwysocki merged commit 2b2ba53 into main Nov 12, 2025
1 check 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.

3 participants