Connect with LDAP

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

Connect with LDAP

Note:

Starting in MongoDB 8.0, LDAP authentication and authorization is deprecated. LDAP is available and will continue to operate without changes throughout the lifetime of MongoDB 8. LDAP will be removed in a future major release.

You can connect to your MongoDB Enterprise deployment or MongoDB Atlas cluster using Lightweight Directory Access Protocol (LDAP) authentication with the MongoDB MCP Server.

To learn more, see the following resources:

  • [LDAP on MongoDB Enterprise.](https://www.mongodb.com/docs/manual/core/security-ldap.md#std-label-security-ldap

  • [LDAP on MongoDB Atlas](https://www.mongodb.com/docs/atlas/security-ldaps.md#std-label-security-ldaps

Configuration Options

To connect to a MongoDB deployment with LDAP, configure the following options in your [MCP server configuration:](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration.md#std-label-mcp-server-configuration

CLI Option Name OS Environment Variable Name Type Necessity Description
username MDB_MCP_USERNAME string Required Set the username to a username that respects the [security.ldap.authz.queryTemplate](https://www.mongodb.com/docs/manual/reference/configuration-options.md#mongodb-setting-security.ldap.authz.queryTemplate, or any configured [security.ldap.userToDNMapping](https://www.mongodb.com/docs/manual/reference/configuration-options.md#mongodb-setting-security.ldap.userToDNMapping template.
password MDB_MCP_PASSWORD string Required Password for the specified LDAP user.
authenticationDatabase MDB_MCP_AUTHENTICATION_DATABASE string Required Set to $external for LDAP authentication.
authenticationMechanism MDB_MCP_AUTHENTICATION_MECHANISM string Required Set to PLAIN to use LDAP authentication.