Skip to main content
Glama
mongodb-js

MongoDB MCP Server

Official
by mongodb-js

atlas-inspect-access-list

Check IP and CIDR ranges authorized to access MongoDB Atlas clusters to verify network security settings.

Instructions

Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesAtlas project ID

Implementation Reference

  • The execute method fetches the access list entries from MongoDB Atlas API for the given projectId, processes the results, and returns a formatted response or a message if none found.
    protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
        const accessList = await this.session.apiClient.listAccessListEntries({
            params: {
                path: {
                    groupId: projectId,
                },
            },
        });
    
        const results = accessList.results ?? [];
    
        if (!results.length) {
            return {
                content: [{ type: "text", text: "No access list entries found." }],
            };
        }
    
        const entries = results.map((entry) => ({
            ipAddress: entry.ipAddress,
            cidrBlock: entry.cidrBlock,
            comment: entry.comment,
        }));
    
        return {
            content: formatUntrustedData(`Found ${results.length} access list entries`, JSON.stringify(entries)),
        };
    }
  • Defines the input schema for the tool, requiring a projectId using AtlasArgs.projectId().
    export const InspectAccessListArgs = {
        projectId: AtlasArgs.projectId().describe("Atlas project ID"),
    };
    
    export class InspectAccessListTool extends AtlasToolBase {
        public name = "atlas-inspect-access-list";
        protected description = "Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.";
        static operationType: OperationType = "read";
        protected argsShape = {
            ...InspectAccessListArgs,
        };
  • The InspectAccessListTool class definition, including name, description, operationType, argsShape, and execute method, which is instantiated and registered via the AllTools array in src/tools/index.ts.
    export class InspectAccessListTool extends AtlasToolBase {
        public name = "atlas-inspect-access-list";
        protected description = "Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.";
        static operationType: OperationType = "read";
        protected argsShape = {
            ...InspectAccessListArgs,
        };
    
        protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
            const accessList = await this.session.apiClient.listAccessListEntries({
                params: {
                    path: {
                        groupId: projectId,
                    },
                },
            });
    
            const results = accessList.results ?? [];
    
            if (!results.length) {
                return {
                    content: [{ type: "text", text: "No access list entries found." }],
                };
            }
    
            const entries = results.map((entry) => ({
                ipAddress: entry.ipAddress,
                cidrBlock: entry.cidrBlock,
                comment: entry.comment,
            }));
    
            return {
                content: formatUntrustedData(`Found ${results.length} access list entries`, JSON.stringify(entries)),
            };
        }
    }
  • Re-exports the InspectAccessListTool for inclusion in the atlas tools namespace and subsequently in AllTools.
    export { InspectAccessListTool } from "./read/inspectAccessList.js";
  • Collects all tools, including AtlasTools (which includes InspectAccessListTool), into AllTools array passed to the server for instantiation and registration.
    export const AllTools: ToolClass[] = Object.values({
        ...MongoDbTools,
        ...AtlasTools,
        ...AtlasLocalTools,
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mongodb-js/mongodb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server