A Gemini CLI extension for the MongoDB MCP Server, enabling MongoDB database and Atlas operations directly through the Gemini CLI.
- π Getting Started
- π οΈ Supported Tools
- π Supported Resources
- βοΈ Advanced Configuration
- π§ Development
- π€ Contributing
-
Node.js - Version requirements:
- At least 20.19.0
- When using v22 then at least v22.12.0
- Otherwise any version 23+
node -v
-
Gemini CLI - Ensure you have the Gemini CLI installed and configured
-
MongoDB Connection String or Atlas API Credentials - Required for the extension to connect to your MongoDB instance
gemini extensions install https://github.com/mongodb-partners/mdb-gemini-cli-ext.git- Clone the repository:
git clone https://github.com/mongodb-partners/mdb-gemini-cli-ext.git cd mdb-gemini-cli-ext- Build the extension:
npm install npm run build- Copy to Gemini extensions directory:
mkdir -p ~/.gemini/extensions cp -R . ~/.gemini/extensions/mongodb-gemini-extensionAfter installation, you need to configure your MongoDB connection:
- Navigate to the extension directory:
cd ~/.gemini/extensions/mongodb-gemini-extension- Create the configuration file from the template:
cp mongo.config.json.example mongo.config.json- Edit
mongo.config.jsonwith your MongoDB connection string:
{ "MONGODB_URI": "mongodb+srv://username:password@cluster.mongodb.net/myDatabase?retryWrites=true&w=majority" }π Security Note: The
mongo.config.jsonfile contains sensitive credentials. It is automatically excluded from version control via.gitignore.
-
Restart the Gemini CLI to load the extension
-
Verify the installation:
/mcp /tools You should see the mongodb server listed as active and its tools available.
find- Run a find query against a MongoDB collectionaggregate- Run an aggregation against a MongoDB collectioncount- Get the number of documents in a MongoDB collectioninsert-one- Insert a single document into a MongoDB collectioninsert-many- Insert multiple documents into a MongoDB collectioncreate-index- Create an index for a MongoDB collectionupdate-one- Update a single document in a MongoDB collectionupdate-many- Update multiple documents in a MongoDB collectionrename-collection- Rename a MongoDB collectiondelete-one- Delete a single document from a MongoDB collectiondelete-many- Delete multiple documents from a MongoDB collectiondrop-collection- Remove a collection from a MongoDB databasedrop-database- Remove a MongoDB databaselist-databases- List all databases for a MongoDB connectionlist-collections- List all collections for a given databasecollection-indexes- Describe the indexes for a collectioncollection-schema- Describe the schema for a collectioncollection-storage-size- Get the size of a collection in MBdb-stats- Return statistics about a MongoDB databaseexport- Export query or aggregation results to EJSON format
atlas-list-orgs- Lists MongoDB Atlas organizationsatlas-list-projects- Lists MongoDB Atlas projectsatlas-create-project- Creates a new MongoDB Atlas projectatlas-list-clusters- Lists MongoDB Atlas clustersatlas-inspect-cluster- Inspect a specific MongoDB Atlas clusteratlas-create-free-cluster- Create a free MongoDB Atlas clusteratlas-connect-cluster- Connects to MongoDB Atlas clusteratlas-inspect-access-list- Inspect IP/CIDR ranges with accessatlas-create-access-list- Configure IP/CIDR access listatlas-list-db-users- List MongoDB Atlas database usersatlas-create-db-user- Creates a MongoDB Atlas database useratlas-list-alerts- List MongoDB Atlas Alerts for a Project
config- Server configuration with sensitive parameters redacteddebug- Debugging information for MongoDB connectivity issuesexported-data- Access to data exported using the export tool
The extension supports additional configuration options through the mongo.config.json file:
{ "MONGODB_URI": "mongodb+srv://...", "MDB_MCP_READ_ONLY": "true", "MDB_MCP_INDEX_CHECK": "true", "MDB_MCP_MAX_DOCUMENTS_PER_QUERY": "100", "MDB_MCP_MAX_BYTES_PER_QUERY": "16777216", "MDB_MCP_DISABLED_TOOLS": "drop-database,drop-collection", "MDB_MCP_API_CLIENT_ID": "your-atlas-client-id", "MDB_MCP_API_CLIENT_SECRET": "your-atlas-client-secret" }- MONGODB_URI - MongoDB connection string (required)
- MDB_MCP_READ_ONLY - Enable read-only mode (prevents write operations)
- MDB_MCP_INDEX_CHECK - Enforce that queries must use an index
- MDB_MCP_MAX_DOCUMENTS_PER_QUERY - Maximum documents returned per query
- MDB_MCP_MAX_BYTES_PER_QUERY - Maximum size in bytes for query results
- MDB_MCP_DISABLED_TOOLS - Comma-separated list of tools to disable
- MDB_MCP_API_CLIENT_ID - Atlas API client ID (for Atlas tools)
- MDB_MCP_API_CLIENT_SECRET - Atlas API client secret (for Atlas tools)
- Clone and set up the development environment:
git clone https://github.com/mongodb-partners/mdb-gemini-cli-ext.git cd mdb-gemini-cli-ext npm install- Build the extension:
npm run build- Test locally:
npm startmdb-gemini-cli-ext/ βββ dist/ # Compiled JavaScript output βββ src/ # Original TypeScript source βββ gemini-extension.json # Gemini extension manifest βββ run.js # Extension entry point βββ mongo.config.json.example # Configuration template βββ package.json # Node.js package configuration This extension is based on the original MongoDB MCP Server. Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
For major changes, please open an issue first to discuss what you would like to change.
Apache-2.0 License - See the original MongoDB MCP Server for licensing details.