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

mongodb-js / mongodb-mcp-server / 14671892165

25 Apr 2025 07:17PM UTC coverage: 67.88% (-14.6%) from 82.446%
14671892165

Pull #136

github

web-flow
chore(deps-dev): bump @types/node from 22.14.1 to 22.15.2

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.14.1 to 22.15.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.15.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #136: chore(deps-dev): bump @types/node from 22.14.1 to 22.15.2

99 of 212 branches covered (46.7%)

Branch coverage included in aggregate %.

628 of 859 relevant lines covered (73.11%)

43.31 hits per line

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

23.53
/src/tools/atlas/create/createAccessList.ts
1
import { z } from "zod";
31✔
2
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
import { AtlasToolBase } from "../atlasTool.js";
31✔
4
import { ToolArgs, OperationType } from "../../tool.js";
5

6
const DEFAULT_COMMENT = "Added by Atlas MCP";
31✔
7

8
export class CreateAccessListTool extends AtlasToolBase {
31✔
9
    protected name = "atlas-create-access-list";
23✔
10
    protected description = "Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.";
23✔
11
    protected operationType: OperationType = "create";
23✔
12
    protected argsShape = {
23✔
13
        projectId: z.string().describe("Atlas project ID"),
14
        ipAddresses: z
15
            .array(z.string().ip({ version: "v4" }))
16
            .describe("IP addresses to allow access from")
17
            .optional(),
18
        cidrBlocks: z.array(z.string().cidr()).describe("CIDR blocks to allow access from").optional(),
19
        currentIpAddress: z.boolean().describe("Add the current IP address").default(false),
20
        comment: z.string().describe("Comment for the access list entries").default(DEFAULT_COMMENT).optional(),
21
    };
22

23
    protected async execute({
24
        projectId,
25
        ipAddresses,
26
        cidrBlocks,
27
        comment,
28
        currentIpAddress,
29
    }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
30
        if (!ipAddresses?.length && !cidrBlocks?.length && !currentIpAddress) {
×
31
            throw new Error("One of  ipAddresses, cidrBlocks, currentIpAddress must be provided.");
×
32
        }
33

34
        const ipInputs = (ipAddresses || []).map((ipAddress) => ({
×
35
            groupId: projectId,
36
            ipAddress,
37
            comment: comment || DEFAULT_COMMENT,
×
38
        }));
39

40
        if (currentIpAddress) {
×
41
            const currentIp = await this.session.apiClient.getIpInfo();
×
42
            const input = {
×
43
                groupId: projectId,
44
                ipAddress: currentIp.currentIpv4Address,
45
                comment: comment || DEFAULT_COMMENT,
×
46
            };
47
            ipInputs.push(input);
×
48
        }
49

50
        const cidrInputs = (cidrBlocks || []).map((cidrBlock) => ({
×
51
            groupId: projectId,
52
            cidrBlock,
53
            comment: comment || DEFAULT_COMMENT,
×
54
        }));
55

56
        const inputs = [...ipInputs, ...cidrInputs];
×
57

58
        await this.session.apiClient.createProjectIpAccessList({
×
59
            params: {
60
                path: {
61
                    groupId: projectId,
62
                },
63
            },
64
            body: inputs,
65
        });
66

67
        return {
×
68
            content: [
69
                {
70
                    type: "text",
71
                    text: `IP/CIDR ranges added to access list for project ${projectId}.`,
72
                },
73
            ],
74
        };
75
    }
76
}
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