Skip to main content
Glama
mongodb-developer

MongoDB Atlas MCP Server

Official

create_atlas_cluster

Deploy a new MongoDB Atlas cluster in an existing project by specifying cloud provider, region, and instance size.

Instructions

Creates a new Atlas cluster in an existing Atlas project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the Atlas project.
clusterNameYesThe name of the cluster to create.
regionYesThe cloud provider region to deploy the cluster in. eg. US_EAST_1
cloudProviderYesThe cloud provider (e.g., AWS, GCP, AZURE).
tierYesThe instance size (e.g., M0, M2, M5).

Implementation Reference

  • The main handler function that implements the logic for creating an Atlas cluster, including special handling for M0 tier and API request to MongoDB Atlas.
    private async createAtlasCluster(input: CreateClusterInput) {
      if (input.tier === 'M0') {
        return {
          content: [{
            type: 'text',
            text: 'M0 (Free Tier) clusters cannot be created via the API. Please use the MongoDB Atlas UI to create an M0 cluster.'
          }],
          isError: true
        };
      }
    
      try {
        const url = `https://cloud.mongodb.com/api/atlas/v1.0/groups/${input.projectId}/clusters?pretty=true`;
        const body = {
          name: input.clusterName,
          providerSettings: {
            providerName: input.cloudProvider,
            instanceSizeName: input.tier,
            regionName: input.region
          }
        };
    
        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
        };
      }
    }
  • TypeScript interface defining the input schema for the create_atlas_cluster tool.
    interface CreateClusterInput {
      projectId: string;
      clusterName: string;
      region: string;
      cloudProvider: string;
      tier: string;
    }
  • src/index.ts:380-408 (registration)
    Registration of the create_atlas_cluster tool in the ListTools response, including name, description, and detailed input schema.
    {
      name: 'create_atlas_cluster',
      description: 'Creates a new Atlas cluster in an existing Atlas project.',
      inputSchema: {
        type: 'object',
        properties: {
          projectId: {
            type: 'string',
            description: 'The ID of the Atlas project.',
          },
          clusterName: {
            type: 'string',
            description: 'The name of the cluster to create.',
          },
          region: {
            type: 'string',
            description: 'The cloud provider region to deploy the cluster in. eg. US_EAST_1',
          },
          cloudProvider: {
            type: 'string',
            description: 'The cloud provider (e.g., AWS, GCP, AZURE).',
          },
          tier: {
            type: 'string',
            description: 'The instance size (e.g., M0, M2, M5).',
          }
        },
        required: ['projectId', 'clusterName', 'region', 'cloudProvider', 'tier'],
      },
  • src/index.ts:503-587 (registration)
    The CallTool request handler that dispatches to createAtlasCluster for 'create_atlas_cluster' tool calls, including input validation.
    this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
      if (!['create_atlas_cluster', 'setup_atlas_network_access', 'create_atlas_user', 'get_atlas_connection_strings', 'list_atlas_projects', 'list_atlas_clusters'].includes(request.params.name)) {
        throw new McpError(
          ErrorCode.MethodNotFound,
          `Unknown tool: ${request.params.name}`
        );
      }
    
      if (!request.params.arguments) {
        throw new McpError(ErrorCode.InvalidParams, 'Missing arguments');
      }
    
      const input = request.params.arguments as Record<string, unknown>;
    
      switch (request.params.name) {
        case 'create_atlas_cluster':
          if (!isValidCreateClusterInput(input)) {
            throw new McpError(ErrorCode.InvalidParams, 'Invalid cluster creation arguments');
          }
          break;
        case 'setup_atlas_network_access':
          if (!input.projectId || !input.ipAddresses || !Array.isArray(input.ipAddresses)) {
            throw new McpError(ErrorCode.InvalidParams, 'Invalid network access arguments');
          }
          break;
        case 'create_atlas_user':
          if (!input.projectId || !input.username || !input.password) {
            throw new McpError(ErrorCode.InvalidParams, 'Invalid user creation arguments');
          }
          break;
        case 'get_atlas_connection_strings':
          if (!input.projectId || !input.clusterName) {
            throw new McpError(ErrorCode.InvalidParams, 'Invalid connection string arguments');
          }
          break;
        case 'list_atlas_clusters':
          if (!input.projectId) {
            throw new McpError(ErrorCode.InvalidParams, 'Invalid list clusters arguments');
          }
          break;
      }
    
      let result;
    
      try {
        switch (request.params.name) {
          case 'create_atlas_cluster':
            result = await this.createAtlasCluster(input as unknown as CreateClusterInput);
            break;
          case 'setup_atlas_network_access':
            result = await this.setupAtlasNetworkAccess(input as unknown as NetworkAccessInput);
            break;
          case 'create_atlas_user':
            result = await this.createAtlasUser(input as unknown as CreateUserInput);
            break;
          case 'get_atlas_connection_strings':
            result = await this.getAtlasConnectionStrings(input as unknown as ConnectionStringsInput);
            break;
          case 'list_atlas_projects':
            result = await this.listAtlasProjects();
            break;
          case 'list_atlas_clusters':
            result = await this.listAtlasClusters(input as unknown as ListClustersInput);
            break;
          default:
            throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`);
        }
    
        // Ensure we return the expected format
        return {
          content: result.content,
          _meta: request.params._meta
        };
      } catch (error: any) {
        // Handle any errors that might occur
        return {
          content: [{
            type: 'text',
            text: `Error: ${error.message}`
          }],
          isError: true,
          _meta: request.params._meta
        };
      }
    });
  • Input validation function specifically for CreateClusterInput used before calling the handler.
    const isValidCreateClusterInput = (args: any): args is CreateClusterInput =>
      typeof args === 'object' &&
      args !== null &&
      typeof args.projectId === 'string' &&
      typeof args.clusterName === 'string' &&
      typeof args.region === 'string' &&
      typeof args.cloudProvider === 'string' &&
      typeof args.tier === 'string';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Creates', implying a write/mutation operation, but fails to mention critical behavioral aspects such as permissions required, whether this is a long-running operation, potential costs, or what happens on failure. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes essential information, earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of creating a cluster (a significant infrastructure operation) with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, error handling, return values, or operational context, leaving the agent poorly equipped to use this tool effectively in real scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, providing clear documentation for all 5 parameters. The description adds no additional parameter semantics beyond what's in the schema, such as explaining relationships between parameters or providing examples. Given the high schema coverage, a baseline score of 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Creates') and resource ('new Atlas cluster in an existing Atlas project'), making the purpose unambiguous. It distinguishes from siblings like 'list_atlas_clusters' by specifying creation rather than listing. However, it doesn't explicitly differentiate from 'setup_atlas_network_access' or 'create_atlas_user' in terms of resource type, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance by mentioning 'in an existing Atlas project', which implies a prerequisite but doesn't specify when to use this tool versus alternatives. There's no explicit direction on when to choose this over other tools like 'setup_atlas_network_access' or what scenarios warrant cluster creation, leaving the agent with little context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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-developer/mcp-mongodb-atlas'

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