• 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

24.39
/src/ui/registry/registry.ts
1
// Converts kebab-case to PascalCase: "list-databases" -> "ListDatabases"
2
function toPascalCase(kebabCase: string): string {
3✔
NEW
3
    return kebabCase
×
NEW
4
        .split("-")
×
NEW
5
        .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
×
NEW
6
        .join("");
×
NEW
7
}
×
8

9
/**
10
 * UI Registry that manages bundled UI HTML strings for tools.
11
 */
12
export class UIRegistry {
3✔
13
    private customUIs: Map<string, string> = new Map();
3✔
14
    private cache: Map<string, string> = new Map();
3✔
15

16
    constructor(options?: { customUIs?: Record<string, string> }) {
3✔
17
        if (options?.customUIs) {
126!
NEW
18
            for (const [toolName, html] of Object.entries(options.customUIs)) {
×
NEW
19
                this.customUIs.set(toolName, html);
×
NEW
20
            }
×
NEW
21
        }
×
22
    }
126✔
23

24
    /**
25
     * Gets the UI HTML string for a tool, or null if none exists.
26
     */
27
    async get(toolName: string): Promise<string | null> {
3✔
NEW
28
        const customUI = this.customUIs.get(toolName);
×
NEW
29
        if (customUI !== undefined) {
×
NEW
30
            return customUI;
×
NEW
31
        }
×
32

NEW
33
        const cached = this.cache.get(toolName);
×
NEW
34
        if (cached !== undefined) {
×
NEW
35
            return cached;
×
NEW
36
        }
×
37

NEW
38
        try {
×
NEW
39
            const module = (await import(`../lib/tools/${toolName}.js`)) as Record<string, string>;
×
NEW
40
            const exportName = `${toPascalCase(toolName)}Html`;
×
NEW
41
            const html = module[exportName];
×
NEW
42
            if (html === undefined) {
×
NEW
43
                return null;
×
NEW
44
            }
×
NEW
45
            this.cache.set(toolName, html);
×
NEW
46
            return html;
×
NEW
47
        } catch {
×
NEW
48
            return null;
×
NEW
49
        }
×
NEW
50
    }
×
51
}
3✔
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