Skip to content

Conversation

@tsck
Copy link
Collaborator

@tsck tsck commented Dec 4, 2025

Summary

  • Adds support of the MCP-UI
  • Adds build tooling for React components so that they can be rendered via an iframe client
  • Implements UI for list-database tool calls
  • Adds the ability to add additional UI's on server instantiation

Testing

I've been using MCPJam Inspector which has MCP-UI implemented in the client.

Screenshot

Screenshot 2025-12-04 at 10 11 20 AM

@tsck tsck requested review from gagik and nirinchev December 4, 2025 15:26
@tsck tsck force-pushed the feature/mcp-ui branch 2 times, most recently from d484367 to e223056 Compare December 4, 2025 17:24
tsck added 2 commits December 5, 2025 09:44
- Added UIRegistry class to manage custom and default UI HTML for tools.
- Integrated custom UI support in the Server and ToolBase classes.
- Created ListDatabases tool with a corresponding UI component.
- Introduced Vite configuration for building UI components and generating HTML entries.
- Updated TypeScript configuration to support JSX and include UI components.
- Enhanced package.json with new dependencies for React and Vite.
- Updated .gitignore to exclude generated UI files.
@tsck tsck marked this pull request as ready for review December 5, 2025 14:58
@tsck tsck requested a review from a team as a code owner December 5, 2025 14:58
Copilot AI review requested due to automatic review settings December 5, 2025 14:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds MCP-UI support to the MongoDB MCP server, enabling tools to render rich React-based UIs in compatible clients. The implementation includes build tooling for React components, a UI registry system for managing component HTML, and an initial UI component for the list-databases tool.

Key changes:

  • Adds build infrastructure using Vite to compile React components into self-contained HTML files
  • Implements a UI registry system that maps tool names to UI components and manages HTML loading
  • Updates the list-databases tool to return structured content and automatically attach UI resources

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
vite.ui.config.ts New Vite configuration for building React UI components into standalone HTML files
tsconfig.build.json Enables JSX compilation for React components
src/ui/registry/uiMap.ts Maps tool names to UI component names
src/ui/registry/registry.ts Core UIRegistry class for managing and loading UI HTML strings
src/ui/registry/index.ts Registry module exports
src/ui/index.ts Main UI module exports
src/ui/hooks/useRenderData.ts React hook for receiving render data via postMessage
src/ui/hooks/index.ts Hooks module exports
src/ui/components/ListDatabases/schema.ts Zod schema defining list-databases output contract
src/ui/components/ListDatabases/index.ts ListDatabases component module exports
src/ui/components/ListDatabases/ListDatabases.tsx React component rendering database list as a table
src/ui/components/ListDatabases/ListDatabases.styles.ts Styles for ListDatabases component
src/ui/build/template.html HTML template for generated component entry files
src/ui/build/mount.tsx Entry point that mounts React components in the browser
src/tools/tool.ts Adds UIRegistry integration and automatic UI resource attachment to tools
src/tools/mongodb/metadata/listDatabases.tsx Updates tool to return structured content for UI rendering
src/server.ts Adds UIRegistry instantiation and customUIs configuration option
package.json Adds React, Vite, and MCP-UI dependencies plus UI build script

@coveralls
Copy link
Collaborator

coveralls commented Dec 5, 2025

Pull Request Test Coverage Report for Build 20137060666

Details

  • 57 of 238 (23.95%) changed or added relevant lines in 13 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 79.333%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ui/components/ListDatabases/index.ts 0 1 0.0%
src/ui/hooks/index.ts 0 1 0.0%
src/ui/index.ts 0 1 0.0%
src/ui/components/ListDatabases/ListDatabases.styles.ts 0 2 0.0%
src/tools/tool.ts 23 38 60.53%
src/ui/registry/registry.ts 9 39 23.08%
src/ui/components/ListDatabases/ListDatabases.tsx 0 42 0.0%
src/ui/hooks/useRenderData.ts 0 43 0.0%
src/ui/build/mount.tsx 0 46 0.0%
Totals Coverage Status
Change from base Build 20130488921: -0.7%
Covered Lines: 6685
Relevant Lines: 8348

💛 - Coveralls

Copy link
Collaborator

@gagik gagik left a comment

Choose a reason for hiding this comment

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

Haven't tried running the project itself just yet but changes LGTM! Would be nice to add some tests to validate this is working as intended.

@tsck
Copy link
Collaborator Author

tsck commented Dec 10, 2025

Haven't tried running the project itself just yet but changes LGTM! Would be nice to add some tests to validate this is working as intended.

@gagik I have another PR open for that! It's probably a bit outdated now because its based on this PR which has changed since, but I kept it separate in order to not bloat this more. Happy to merge it in if that's better on your end #787

Also just a note about trying it - it won't work in the built-in inspector because that doesn't support mcp ui. To try the UI response you'll need to use another inspector, I've been using MCPJam

@tsck tsck requested a review from gagik December 10, 2025 20:10
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.

6 participants