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

mongodb-js / mongodb-mcp-server / 19462524052

18 Nov 2025 10:20AM UTC coverage: 80.328% (+0.1%) from 80.187%
19462524052

Pull #729

github

web-flow
Merge 8e32474a4 into 53143eecd
Pull Request #729: chore: refactor config initialisation for CLI to allow easy extension from other config sources as well MCP-288

1328 of 1750 branches covered (75.89%)

Branch coverage included in aggregate %.

332 of 346 new or added lines in 12 files covered. (95.95%)

15 existing lines in 2 files now uncovered.

6406 of 7878 relevant lines covered (81.32%)

72.35 hits per line

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

57.78
/src/resources/common/config.ts
1
import { ReactiveResource } from "../resource.js";
3✔
2
import type { UserConfig } from "../../common/config/userConfig.js";
3
import type { Telemetry } from "../../telemetry/telemetry.js";
4
import type { Session } from "../../lib.js";
5
import { generateConnectionInfoFromCliArgs } from "@mongosh/arg-parser";
3✔
6

7
export class ConfigResource extends ReactiveResource<UserConfig, readonly []> {
3✔
8
    constructor(session: Session, config: UserConfig, telemetry: Telemetry) {
3✔
9
        super({
106✔
10
            resourceConfiguration: {
106✔
11
                name: "config",
106✔
12
                uri: "config://config",
106✔
13
                config: {
106✔
14
                    description:
106✔
15
                        "Server configuration, supplied by the user either as environment variables or as startup arguments",
106✔
16
                },
106✔
17
            },
106✔
18
            options: {
106✔
19
                initial: { ...config },
106✔
20
                events: [],
106✔
21
            },
106✔
22
            session,
106✔
23
            config,
106✔
24
            telemetry,
106✔
25
        });
106✔
26
    }
106✔
27
    reduce(eventName: undefined, event: undefined): UserConfig {
3✔
28
        void eventName;
×
29
        void event;
×
30

31
        return this.current;
×
32
    }
×
33

34
    toOutput(): string {
3✔
NEW
35
        const connectionInfo = generateConnectionInfoFromCliArgs(this.current);
×
36
        const result = {
×
37
            telemetry: this.current.telemetry,
×
38
            logPath: this.current.logPath,
×
NEW
39
            connectionString: connectionInfo.connectionString
×
40
                ? "set; access to MongoDB tools are currently available to use"
×
41
                : "not set; before using any MongoDB tool, you need to configure a connection string, alternatively you can setup MongoDB Atlas access, more info at 'https://github.com/mongodb-js/mongodb-mcp-server'.",
×
NEW
42
            connectOptions: connectionInfo.driverOptions,
×
43
            atlas:
×
44
                this.current.apiClientId && this.current.apiClientSecret
×
45
                    ? "set; MongoDB Atlas tools are currently available to use"
×
46
                    : "not set; MongoDB Atlas tools are currently unavailable, to have access to MongoDB Atlas tools like creating clusters or connecting to clusters make sure to setup credentials, more info at 'https://github.com/mongodb-js/mongodb-mcp-server'.",
×
47
        };
×
48

49
        return JSON.stringify(result);
×
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