Docs Menu
Docs Home
/
MongoDB MCP Server

MongoDB MCP Server Prerequisites

The MCP Server can run Atlas tools that perform various Atlas operations. To run the Atlas tools, your Atlas cluster requires a service account with the appropriate permissions. For a list of the tools, see MongoDB MCP Server Tools.

Select the permissions to run the MCP Server Atlas tools and create a service account with those permissions.

Select the minimum permissions for the service account.

Note

Granting the Organization Owner role is rarely necessary and can be a security risk.

The following table shows the operations you can perform with the MCP Server and the required roles for those operations:

Operation
Safest Role to Assign
Level

List organizations and projects

Org Member or Org Read Only

Organization

Create new projects

Org Project Creator

Organization

View clusters and databases in a project

Project Read Only

Project

Create and manage clusters in a project

Project Cluster Manager

Project

Manage project access lists

Project IP Access List Admin

Project

Manage database users

Project Database Access Admin

Project

You should typically use Project level roles for most operations, and assign those roles to the specific projects you need to manage or view. Avoid Organization Owner unless you require full administrative control over all projects and settings in the organization. Write down the permissions you want to use. You'll use them in the next section.

For a full list of roles and privileges, see Atlas User Roles.

Note

The MCP Server doesn't disable or hide tools based on the service account permissions. If the service account doesn't have the permission to access a tool, trying to run the tool may result in an error.

To create an Atlas service account and allow access to your cluster, perform these steps:

1
  1. Log in to Atlas at cloud.mongodb.com.

  2. To access your organization, navigate to Access Manager > Organization Access. The instructions assume you have an organization already created.

  3. Click Add new > Application > Service Account.

  4. Enter a name, description, and set an expiration period.

  5. Select the appropriate permissions you selected in the previous section.

  6. Click Create.

Note

The Atlas user interface is subject to change and the steps may vary.

2

After you create your Atlas service account, you'll see a client ID and client secret. Copy and save the client secret because it won't be displayed again.

You'll use the client ID and client secret to set the apiClientId and apiClientSecret in the Connecting with Atlas API Credentials section later.

3

To allow the MCP Server to connect to your Atlas cluster, add an access list entry for the IP address of the computer on which the MCP Server runs. If you run the MCP Server on your local machine, add your local IP address.

  1. Navigate to Network Access.

  2. Click Add IP Address.

  3. Enter your IP address.

After you create the service account, you can configure the MCP Server to use the Atlas API credentials. For details, see Connecting with Atlas API Credentials.

Back

Get Started

On this page