Skip to main content
Glama
mongodb-developer

MongoDB Atlas MCP Server

Official

list_atlas_clusters

Retrieve all MongoDB Atlas clusters within a specified project to view and manage your database deployments.

Instructions

Lists all clusters in an Atlas project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the Atlas project.

Implementation Reference

  • The handler function that executes the list_atlas_clusters tool. It makes an API request to fetch clusters for the given projectId, enhances connection strings, and returns the formatted result.
    private async listAtlasClusters(input: ListClustersInput) { try { const url = `https://cloud.mongodb.com/api/atlas/v1.0/groups/${input.projectId}/clusters`; const result = await this.makeAtlasRequest(url, 'GET'); // Add appName to connection strings in all clusters this.addAppNameToConnectionStrings(result); 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 listAtlasClusters: requires projectId.
    interface ListClustersInput { projectId: string; }
  • src/index.ts:487-499 (registration)
    Tool registration in the ListTools response, including name, description, and inputSchema.
    name: 'list_atlas_clusters', description: 'Lists all clusters in an Atlas project.', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'The ID of the Atlas project.', }, }, required: ['projectId'], }, }
  • src/index.ts:564-566 (registration)
    Dispatch in CallToolRequest handler that routes to the listAtlasClusters method.
    case 'list_atlas_clusters': result = await this.listAtlasClusters(input as unknown as ListClustersInput); break;
  • Input validation for list_atlas_clusters parameters before execution.
    case 'list_atlas_clusters': if (!input.projectId) { throw new McpError(ErrorCode.InvalidParams, 'Invalid list clusters arguments'); } break;

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