setup_atlas_network_access
Configure network access for a MongoDB Atlas project by specifying IP addresses or CIDR blocks to enable secure connections.
Instructions
Sets up network access for an existing Atlas project. Accepts list of IP addresses or CIDR blocks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ipAddresses | Yes | An array of IP addresses or CIDR blocks for network access. | |
| projectId | Yes | The ID of the Atlas project. |
Implementation Reference
- src/index.ts:161-185 (handler)The main handler function that sets up network access for the Atlas project by posting the provided IP addresses to the Atlas API access list endpoint.private async setupAtlasNetworkAccess(input: NetworkAccessInput) { try { const url = `https://cloud.mongodb.com/api/atlas/v1.0/groups/${input.projectId}/accessList`; const body = input.ipAddresses.map(ip => ({ ipAddress: ip, comment: "Added via Atlas Project Manager MCP" })); const result = await this.makeAtlasRequest(url, 'POST', body); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { return { content: [{ type: 'text', text: error.message }], isError: true }; } }
- src/index.ts:20-23 (schema)TypeScript interface defining the input structure for the setupAtlasNetworkAccess tool.interface NetworkAccessInput { projectId: string; ipAddresses: string[]; }
- src/index.ts:413-429 (schema)JSON schema defining the input validation for the tool in the MCP ListTools response.inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'The ID of the Atlas project.', }, ipAddresses: { type: 'array', items: { type: 'string', }, description: 'An array of IP addresses or CIDR blocks for network access.', }, }, required: ['projectId', 'ipAddresses'], },
- src/index.ts:410-430 (registration)Tool registration in the ListTools handler, including name, description, and input schema.{ name: 'setup_atlas_network_access', description: 'Sets up network access for an existing Atlas project. Accepts list of IP addresses or CIDR blocks.', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'The ID of the Atlas project.', }, ipAddresses: { type: 'array', items: { type: 'string', }, description: 'An array of IP addresses or CIDR blocks for network access.', }, }, required: ['projectId', 'ipAddresses'], }, },
- src/index.ts:552-554 (handler)Dispatch case in the main CallToolRequest handler that invokes the specific tool handler.case 'setup_atlas_network_access': result = await this.setupAtlasNetworkAccess(input as unknown as NetworkAccessInput); break;