Skip to content

Add MCP Apps support alongside MCP-UI#107

Closed
mattpodwysocki wants to merge 6 commits intomainfrom
add-mcp-apps-support
Closed

Add MCP Apps support alongside MCP-UI#107
mattpodwysocki wants to merge 6 commits intomainfrom
add-mcp-apps-support

Conversation

@mattpodwysocki
Copy link
Contributor

Summary

This PR implements the MCP Apps pattern for static_map_image_tool, maintaining backward compatibility by supporting both patterns simultaneously.

Changes

Tool with MCP Apps Support

  • static_map_image_tool - Generate and preview static map images

Implementation Details

The tool now returns both:

  1. MCP-UI resource content via createUIResource() (existing pattern)
  2. MCP Apps metadata via _meta.ui.resourceUri field (new pattern)

New UI resource created (ui:// scheme):

  • StaticMapUIResource - Serves HTML for static map preview

Client Compatibility

This graceful degradation approach supports:

  • Claude Code - Supports MCP Apps via _meta.ui.resourceUri
  • VS Code - Supports MCP Apps via _meta.ui.resourceUri
  • Existing MCP-UI clients - Continue to use createUIResource()

Testing

All tests passing: 582 tests

Build verified successfully.

Related

mattpodwysocki and others added 6 commits January 12, 2026 16:18
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
Implement the MCP Apps pattern for static_map_image_tool, maintaining backward compatibility by supporting both patterns simultaneously.

Changes:
- Add _meta.ui.resourceUri to static_map_image_tool response for MCP Apps pattern
- Create StaticMapUIResource (ui:// scheme) for static map previews
- Register StaticMapUIResource in resourceRegistry.ts

The MCP Apps pattern enables broader client compatibility (Claude Code, VS Code) while preserving existing MCP-UI functionality. The tool now returns both:
1. MCP-UI resource content via createUIResource()
2. MCP Apps metadata via _meta.ui.resourceUri

This graceful degradation allows clients to use whichever pattern they support.

Related: https://blog.modelcontextprotocol.io/posts/2026-01-26-mcp-apps/
All tests passing (582 tests).
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner January 28, 2026 15:05
@mattpodwysocki
Copy link
Contributor Author

Closing this PR - MCP Apps support doesn't make sense for static_map_image_tool since it returns an image (base64 data), not a URL. The tool already includes the image in the response and MCP-UI handles iframe display.

MCP Apps is better suited for tools that return URLs as primary content (like the devkit tools: preview_style_tool, style_comparison_tool, geojson_preview_tool).

Focusing on mcp-devkit-server PR #62 for MCP Apps support instead.

@mattpodwysocki mattpodwysocki deleted the add-mcp-apps-support branch January 28, 2026 16:01
mattpodwysocki added a commit that referenced this pull request Feb 2, 2026
This PR implements MCP Apps support for static_map_image_tool, enabling
interactive map preview in compatible hosts (VS Code, Claude Code, Goose).

## Changes

- Add @modelcontextprotocol/ext-apps dependency and upgrade SDK to 1.25.3
- Add meta property to BaseTool for MCP Apps metadata (_meta.ui)
- Create StaticMapUIResource serving interactive HTML with MCP Apps SDK
- Refactor StaticMapImageTool to return URL instead of base64 image
- Update index.ts to register UI resources with registerAppResource
- Update all tests to expect URL text content instead of image data

## Benefits

- No server-side image fetching (URL-based approach)
- Interactive visualization in MCP Apps-capable hosts
- CSP configuration for api.mapbox.com domains
- Maintains backward compatibility with MCP-UI pattern
- Consistent with mcp-devkit-server implementation

## Testing

All 597 tests passing ✅

## Related

- Companion to mcp-devkit-server PR #62
- Resolves closed PR #107 properly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
mattpodwysocki added a commit that referenced this pull request Feb 18, 2026
This PR implements MCP Apps support for static_map_image_tool, enabling
interactive map preview in compatible hosts (VS Code, Claude Code, Goose).

- Add @modelcontextprotocol/ext-apps dependency and upgrade SDK to 1.25.3
- Add meta property to BaseTool for MCP Apps metadata (_meta.ui)
- Create StaticMapUIResource serving interactive HTML with MCP Apps SDK
- Refactor StaticMapImageTool to return URL instead of base64 image
- Update index.ts to register UI resources with registerAppResource
- Update all tests to expect URL text content instead of image data

- No server-side image fetching (URL-based approach)
- Interactive visualization in MCP Apps-capable hosts
- CSP configuration for api.mapbox.com domains
- Maintains backward compatibility with MCP-UI pattern
- Consistent with mcp-devkit-server implementation

All 597 tests passing ✅

- Companion to mcp-devkit-server PR #62
- Resolves closed PR #107 properly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
mattpodwysocki added a commit that referenced this pull request Feb 23, 2026
This PR implements MCP Apps support for static_map_image_tool, enabling
interactive map preview in compatible hosts (VS Code, Claude Code, Goose).

- Add @modelcontextprotocol/ext-apps dependency and upgrade SDK to 1.25.3
- Add meta property to BaseTool for MCP Apps metadata (_meta.ui)
- Create StaticMapUIResource serving interactive HTML with MCP Apps SDK
- Refactor StaticMapImageTool to return URL instead of base64 image
- Update index.ts to register UI resources with registerAppResource
- Update all tests to expect URL text content instead of image data

- No server-side image fetching (URL-based approach)
- Interactive visualization in MCP Apps-capable hosts
- CSP configuration for api.mapbox.com domains
- Maintains backward compatibility with MCP-UI pattern
- Consistent with mcp-devkit-server implementation

All 597 tests passing ✅

- Companion to mcp-devkit-server PR #62
- Resolves closed PR #107 properly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
mattpodwysocki added a commit that referenced this pull request Feb 23, 2026
* Add MCP Apps support for static_map_image_tool

This PR implements MCP Apps support for static_map_image_tool, enabling
interactive map preview in compatible hosts (VS Code, Claude Code, Goose).

- Add @modelcontextprotocol/ext-apps dependency and upgrade SDK to 1.25.3
- Add meta property to BaseTool for MCP Apps metadata (_meta.ui)
- Create StaticMapUIResource serving interactive HTML with MCP Apps SDK
- Refactor StaticMapImageTool to return URL instead of base64 image
- Update index.ts to register UI resources with registerAppResource
- Update all tests to expect URL text content instead of image data

- No server-side image fetching (URL-based approach)
- Interactive visualization in MCP Apps-capable hosts
- CSP configuration for api.mapbox.com domains
- Maintains backward compatibility with MCP-UI pattern
- Consistent with mcp-devkit-server implementation

All 597 tests passing ✅

- Companion to mcp-devkit-server PR #62
- Resolves closed PR #107 properly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Enhance static map UI with click-to-zoom and better layout

- Add click-to-zoom functionality (toggle fit-to-window vs full size)
- Add hover hint showing zoom instructions at bottom
- Improve layout with dark theme and centered image
- Suggest larger default window size (1200x900)
- Remove fullscreen button (doesn't work in embedded views)
- Add smooth hover effects and transitions

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Update CHANGELOG with MCP Apps support details

Add detailed entry for PR #109 describing:
- Interactive map preview in compatible MCP clients
- StaticMapUIResource implementation
- URL-based approach instead of base64 encoding
- MCP Apps metadata support in BaseTool
- Backward compatibility with MCP-UI

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix registerAppResource call to include required _meta.ui CSP config

The McpUiAppResourceConfig type requires a _meta.ui field with CSP
configuration. This was missing from the registerAppResource call,
causing a TypeScript build error in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix registerAppResource config: cast type instead of adding _meta

The McpUiAppResourceConfig type incorrectly requires _meta.ui in the
registration config, but the ext-apps example and JSDoc both show CSP
belongs only in the response contents. Cast to any to bypass the bad
type definition and match the intended usage pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add viewUUID to static_map_image_tool response _meta

The ext-apps protocol requires a viewUUID in the tool response _meta
so the host (Claude Desktop) can correlate the tool result with the
correct UI view instance and route the ui/notifications/tool-result
notification to it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add size-changed and fullscreen support to static map UI

- Send ui/notifications/size-changed after image loads so the host
  resizes the inline container to fit the map image
- Add fullscreen toggle button when host supports it
- Handle ui/notifications/host-context-changed to re-fit on returning
  to inline mode

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix HTML entity rendering and black space in static map UI

- Use Unicode characters directly instead of HTML entities (textContent
  doesn't parse entities, and direct chars are more reliable)
- Account for toolbar height in size-changed notification
- Use align-items: flex-start so image sits at top with no black gap above

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove height:100vh to eliminate black padding below map image

The body was filling the full container height regardless of content
size. Removing the fixed height lets the body be exactly as tall as
the toolbar + image, so no black area appears below the map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Measure actual rendered height for size-changed, not natural dimensions

image.naturalHeight is the intrinsic pixel size (e.g. 1280px) but
the image renders smaller due to max-width:100%. Use getBoundingClientRect
after a requestAnimationFrame so we send the true rendered height,
matching what the PDF example does.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add screenshots of MCP Apps static map preview

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove screenshots from docs (will attach directly to PR)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Sync manifest/server versions after rebase onto main

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Restore package.json from main and add ext-apps dependency

The rebase incorrectly resolved package.json conflicts, losing subpath
exports, the SDK 1.26.0 upgrade, and other changes from main. Restore
from main and add back the only PR-specific change: ext-apps dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Document breaking change: static_map_image_tool returns URL not base64

Addresses review feedback from ctufts. The tool now returns the map URL
as text content rather than a base64-encoded image, which is a breaking
change for consumers expecting image content.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Upgrade @modelcontextprotocol/ext-apps to 1.1.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
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.

1 participant