> For the complete documentation index, see [llms.txt](https://docs.aisuru.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aisuru.com/en/advanced-features/integrations/mcp/aisuru-mcp-which-ones-and-how-to-activate/5.-mongodb-mcp-server.md).

# 5. MongoDB MCP Server

The MongoDB MCP Server lets your Agent connect to a MongoDB database and perform read and write operations.

This MCP is useful for:

* Querying MongoDB databases
* Storing and retrieving data during conversations
* Managing structured data in document format

## Configuration parameters

| Parameter           | Required | Description                                                                                          |
| ------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
| `connection_string` | Yes      | MongoDB connection URI. Format: `mongodb://user:password@host:port/database` or `mongodb+srv://...`. |
| `database_name`     | No       | Name of the database to use. If not set, use the one included in the connection string.              |

### Custom parameters

* **timeout**: maximum time to complete an operation (ms)
* **maxPoolSize**: maximum number of simultaneous connections in the pool
* **minPoolSize**: minimum number of always-active connections
* **retryWrites**: automatically retry failed writes
* **readPreference**: which node to read data from (primary/secondary/nearest)
* **maxIdleTimeMS**: maximum idle time before closing a connection (ms)
* **serverSelectionTimeoutMS**: maximum time to find an available server (ms)

```json
{
  "timeout": 30000,
  "maxPoolSize": 10,
  "minPoolSize": 2,
  "retryWrites": true,
  "readPreference": "primary",
  "maxIdleTimeMS": 60000,
  "serverSelectionTimeoutMS": 30000
}
```

## How to get the parameters

1. **After registering**, create a cluster (choose the M0 Free plan)
2. Click **"Connect"** on your cluster
3. Choose **"Connect your application"**
4. Select **Driver**: Node.js or Python
5. Copy the **Connection String**:

   ```
   mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/
   ```
6. Replace `<password>` with your database user's password
7. **Database Name**: choose one (e.g., `test_db`, `aisuru`)<br>
