database
MongoDB Atlas CLI for Headless Automation
Use the MongoDB Atlas CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
9 functions 5 read 4 write API key auth
MongoDB Atlas CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The MongoDB Atlas CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# MongoDB Atlas CLI for Headless Automation
kosmokrator integrations:configure mongodb --set api_key="$MONGODB_API_KEY" --set cluster_url="$MONGODB_CLUSTER_URL" --enable --read allow --write ask --json
kosmo integrations:call mongodb.mongodb_find '{"database":"example_database","collection":"example_collection","filter":"example_filter","projection":"example_projection","sort":"example_sort","limit":1,"skip":1}' --json Discovery Before Execution
Agents and scripts can inspect MongoDB Atlas docs and schemas before choosing a function.
kosmo integrations:docs mongodb --json
kosmo integrations:docs mongodb.mongodb_find --json
kosmo integrations:schema mongodb.mongodb_find --json
kosmo integrations:search "MongoDB Atlas" --json
kosmo integrations:list --json Useful MongoDB Atlas CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
mongodb.mongodb_find | Read | database, collection, filter, projection, sort, limit, skip | Query documents from a MongoDB Atlas collection. Supports filtering, projection, sorting, pagination (limit/skip). Returns an array of matching documents. |
mongodb.mongodb_find_one | Read | database, collection, filter, projection | Find a single document in a MongoDB Atlas collection. Returns the first matching document or null if no match is found. |
mongodb.mongodb_insert_one | Write | database, collection, document | Insert a single document into a MongoDB Atlas collection. Returns the inserted document ID. |
mongodb.mongodb_insert_many | Write | database, collection, documents | Insert multiple documents into a MongoDB Atlas collection in a single operation. Returns the inserted document IDs. |
mongodb.mongodb_update_one | Write | database, collection, filter, update | Update a single document in a MongoDB Atlas collection. Uses a filter to match the document and an update operations object (e.g., {"$set": {"field": "value"}}). |
mongodb.mongodb_delete_one | Write | database, collection, filter | Delete a single document from a MongoDB Atlas collection. Uses a filter to match the document to delete. |
mongodb.mongodb_aggregate | Read | database, collection, pipeline | Run an aggregation pipeline on a MongoDB Atlas collection. Supports all pipeline stages ($match, $group, $sort, $project, $limit, $lookup, etc.). |
mongodb.mongodb_list_collections | Read | database | List all collections in a MongoDB Atlas database. Useful for discovering what data is available before running queries. |
mongodb.mongodb_get_current_user | Read | none | Verify connectivity to MongoDB Atlas and get current user/session information. Useful for testing that credentials are working. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.