• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 20316573569

17 Dec 2025 08:38PM UTC coverage: 79.128% (-0.3%) from 79.433%
20316573569

Pull #811

github

web-flow
Merge 792b50d74 into ff4901030
Pull Request #811: feat(mcp-ui): polish up `ListDatabases` UI and enable it to render as standalone component

1469 of 1926 branches covered (76.27%)

Branch coverage included in aggregate %.

0 of 69 new or added lines in 6 files covered. (0.0%)

3 existing lines in 2 files now uncovered.

6735 of 8442 relevant lines covered (79.78%)

84.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.08
/src/ui/build/mount.tsx
1
/// <reference types="vite/client" />
3✔
NEW
2
import "../styles/fonts.css";
×
3
import React from "react";
×
4
import { createRoot } from "react-dom/client";
×
5

6
// Type for component modules loaded via glob import
7
type ComponentModule = Record<string, React.ComponentType>;
8

9
// Auto-import all components using Vite's glob import
10
// Each component folder must have an index.ts that exports the component as a named export matching the folder name
11
const componentModules: Record<string, ComponentModule> = import.meta.glob("../components/*/index.ts", {
×
12
    eager: true,
13
});
×
14

15
// Build component registry from glob imports
16
// Extracts component name from path: "../components/ListDatabases/index.ts" -> "ListDatabases"
17
const components: Record<string, React.ComponentType> = {};
×
18

19
for (const [path, module] of Object.entries(componentModules)) {
×
20
    const match = path.match(/\.\.\/components\/([^/]+)\/index\.ts$/);
×
21
    if (match) {
×
22
        const componentName = match[1];
×
23
        if (!componentName) continue;
×
24
        // The component should be exported with the same name as the folder
25
        const Component = module[componentName];
×
26
        if (Component) {
×
27
            components[componentName] = Component;
×
28
        } else {
×
29
            console.warn(
×
30
                `[mount] Component "${componentName}" not found in ${path}. ` +
×
31
                    `Make sure to export it as: export { ${componentName} } from "./${componentName}.js"`
×
32
            );
×
33
        }
×
34
    }
×
35
}
×
36

37
function mount(): void {
×
38
    const container = document.getElementById("root");
×
39
    if (!container) {
×
40
        console.error("[mount] No #root element found");
×
41
        return;
×
42
    }
×
43

44
    const componentName = container.dataset.component;
×
45
    if (!componentName) {
×
46
        console.error("[mount] No data-component attribute found on #root");
×
47
        return;
×
48
    }
×
49

50
    const Component = components[componentName];
×
51
    if (!Component) {
×
52
        console.error(`[mount] Unknown component: ${componentName}`);
×
53
        console.error(`[mount] Available components: ${Object.keys(components).join(", ")}`);
×
54
        return;
×
55
    }
×
56

57
    const root = createRoot(container);
×
58
    root.render(
×
59
        <React.StrictMode>
×
60
            <Component />
×
61
        </React.StrictMode>
×
62
    );
×
63
}
×
64

65
mount();
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc