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

mongodb-js / mongodb-mcp-server / 20237133797

15 Dec 2025 03:10PM UTC coverage: 79.68% (-0.4%) from 80.089%
20237133797

Pull #783

github

web-flow
Merge 8aebebbbf into cced0c7fe
Pull Request #783: feat: implement MCP-UI support

1471 of 1927 branches covered (76.34%)

Branch coverage included in aggregate %.

57 of 238 new or added lines in 13 files covered. (23.95%)

26 existing lines in 1 file now uncovered.

6744 of 8383 relevant lines covered (80.45%)

84.67 hits per line

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

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

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

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

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

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

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

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

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

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

NEW
64
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