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

mongodb-js / mongodb-mcp-server / 17330103427

29 Aug 2025 05:17PM UTC coverage: 80.912% (-1.1%) from 82.036%
17330103427

push

github

web-flow
ci: add ipAccessList after creating project (#496)

889 of 1182 branches covered (75.21%)

Branch coverage included in aggregate %.

4520 of 5503 relevant lines covered (82.14%)

39.79 hits per line

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

96.34
/src/resources/common/debug.ts
1
import { ReactiveResource } from "../resource.js";
2✔
2
import type { Telemetry } from "../../telemetry/telemetry.js";
3
import type { Session, UserConfig } from "../../lib.js";
4
import type { AtlasClusterConnectionInfo, ConnectionStateErrored } from "../../common/connectionManager.js";
5

6
type ConnectionStateDebuggingInformation = {
7
    readonly tag: "connected" | "connecting" | "disconnected" | "errored";
8
    readonly connectionStringAuthType?: "scram" | "ldap" | "kerberos" | "oidc-auth-flow" | "oidc-device-flow" | "x.509";
9
    readonly errorReason?: string;
10
    readonly connectedAtlasCluster?: AtlasClusterConnectionInfo;
11
};
12

13
export class DebugResource extends ReactiveResource<
2✔
14
    ConnectionStateDebuggingInformation,
15
    readonly ["connect", "disconnect", "close", "connection-error"]
16
> {
2✔
17
    constructor(session: Session, config: UserConfig, telemetry: Telemetry) {
2✔
18
        super({
55✔
19
            resourceConfiguration: {
55✔
20
                name: "debug-mongodb",
55✔
21
                uri: "debug://mongodb",
55✔
22
                config: {
55✔
23
                    description:
55✔
24
                        "Debugging information for MongoDB connectivity issues. Tracks the last connectivity attempt and error information.",
55✔
25
                },
55✔
26
            },
55✔
27
            options: {
55✔
28
                initial: { tag: "disconnected" },
55✔
29
                events: ["connect", "disconnect", "close", "connection-error"],
55✔
30
            },
55✔
31
            session,
55✔
32
            config,
55✔
33
            telemetry,
55✔
34
        });
55✔
35
    }
55✔
36
    reduce(
2✔
37
        eventName: "connect" | "disconnect" | "close" | "connection-error",
494✔
38
        event: ConnectionStateErrored | undefined
494✔
39
    ): ConnectionStateDebuggingInformation {
494✔
40
        switch (eventName) {
494✔
41
            case "connect":
494✔
42
                return { tag: "connected" };
200✔
43
            case "connection-error": {
494✔
44
                return {
24✔
45
                    tag: "errored",
24✔
46
                    connectionStringAuthType: event?.connectionStringAuthType,
24✔
47
                    connectedAtlasCluster: event?.connectedAtlasCluster,
24✔
48
                    errorReason:
24✔
49
                        event?.errorReason ??
24!
50
                        "Could not find a reason. This might be a bug in the MCP Server. Please open an issue in https://github.com/mongodb-js/mongodb-mcp-server.",
×
51
                };
24✔
52
            }
24✔
53
            case "disconnect":
494✔
54
            case "close":
494✔
55
                return { tag: "disconnected" };
270✔
56
        }
494✔
57
    }
494✔
58

59
    toOutput(): string {
2✔
60
        let result = "";
6✔
61

62
        switch (this.current.tag) {
6✔
63
            case "connected":
6✔
64
                result += "The user is connected to the MongoDB cluster.";
1✔
65
                break;
1✔
66
            case "errored":
6✔
67
                result += `The user is not connected to a MongoDB cluster because of an error.\n`;
3✔
68
                if (this.current.connectedAtlasCluster) {
3✔
69
                    result += `Attempted connecting to Atlas Cluster "${this.current.connectedAtlasCluster.clusterName}" in project with id "${this.current.connectedAtlasCluster.projectId}".\n`;
1✔
70
                }
1✔
71

72
                if (this.current.connectionStringAuthType !== undefined) {
3✔
73
                    result += `The inferred authentication mechanism is "${this.current.connectionStringAuthType}".\n`;
2✔
74
                }
2✔
75
                result += `<error>${this.current.errorReason}</error>`;
3✔
76
                break;
3✔
77
            case "connecting":
6!
78
            case "disconnected":
6✔
79
                result += "The user is not connected to a MongoDB cluster.";
2✔
80
                break;
2✔
81
        }
6✔
82

83
        return result;
6✔
84
    }
6✔
85
}
2✔
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

© 2026 Coveralls, Inc