Manipulating MongoDB with natural language! I tried using an AI assistant to operate a database with MongoDB MCP Server.
This is Kobayashi (@berlinbytes) from the Service Reliability Group (SRG) of the Media Division.
#SRGThe Service Reliability Group primarily provides comprehensive support for the infrastructure surrounding our media services, focusing on improving existing services, launching new ones, and contributing to open-source software (OSS).
This article explains how to set up and use "MongoDB MCP Server," a new tool that uses AI to manipulate MongoDB in natural language, and introduces ways to improve development efficiency.
IntroductionWhat is MongoDB MCP Server?What you needSetup Instructions1. Create an Atlas service account2. MCP Server ConfigurationTry using it in practiceData SearchDatabase ManagementAtlas cluster managementCode generationOther useful featuresRead-only modeDisabling specific toolssummary
Introduction
In recent years, the evolution of large-scale language models (LLMs) and AI agents has been remarkable, threatening to fundamentally change the way software is developed.
In this context, MongoDB has announced a public preview of a new tool, "MongoDB Model Context Protocol (MCP) Server," designed to accelerate AI-driven development.
This article will examine and introduce what MongoDB MCP Server is and what it can do, including setup and specific use cases.
What is MongoDB MCP Server?
MongoDB MCP Server is the official implementation for AI tools and assistants to interact with MongoDB.
This allows developers to search MongoDB data and manage their databases using natural language from a familiar AI-powered editor or chat interface.
A key feature is its support for all MongoDB deployments, including MongoDB Atlas, Community Edition, and Enterprise Advanced.
What you need
To use the MCP server, the following preparations are required:
- MongoDB Atlas cluster or self-hosted MongoDB deployment
- Supported MCP clients (e.g., Visual Studio Code, Windsurf, Cursor, Claude Desktop, etc.)
- Node.js (version 20.10.0 or later)
Setup Instructions
This section explains the setup procedure using the example of integrating MongoDB Atlas with Cursor.
The official procedure is as follows.
1. Create an Atlas service account
The MCP server requires a service account with the appropriate permissions to perform Atlas management tasks (such as creating clusters).
- Log in to MongoDB Atlas and select "Organization Access" from "Access Manager".
Organization Owner
Client Secret
- In "Network Access," allow access from the IP address of the machine running the MCP server.
2. MCP Server Configuration
Next, configure the server settings on the MCP client side.
.cursor/mcp.jsonAfter setting it up and starting Cursor, you will be able to operate MongoDB from AI functions such as Chat.
Try using it in practice
Once the setup is complete, try sending prompts in natural language from the AI client.

The "products" collection has been created in the "test" database.
Next, you will be asked to confirm the following. If you grant permission, sample data will be inserted.

I was able to input data using only natural language.
Let's also check it on the Atlas UI.

It's being operated correctly.
Next, we'll try to see if we can execute queries even with ambiguous expressions.

It seems they correctly understood my intentions and performed the operation accordingly.

others,As shown in the Usage Examples,The following operations were successfully performed.
Data Search
You can ask about the structure of databases and collections, or search for data based on specific criteria.
Example prompt:
sample_mflixデータベースにあるmoviesコレクションのスキーマを説明して。moviesコレクションの中から、ジャンルが'Thriller'の映画を探して。Database Management
You can perform CRUD operations (create, read, update, delete) using natural language.
Example prompt:
"products"という名前で新しいコレクションを作成して、サンプルデータをいくつか追加して。"products"コレクションから、在庫が0のドキュメントを削除して。Atlas cluster management
If you have configured the Atlas API permissions, you can also manage the cluster.
Example prompt:
Atlas上のすべてのプロジェクトとクラスターを一覧表示して。読み取り専用アクセス権を持つ新しいデータベースユーザー'NewUser'を作成して。Code generation
By providing database schema information as context, you can generate more accurate application code.
Example prompt:
"products"コレクションのスキーマを参考にして、在庫が少ない商品を検索するJavaScriptの関数を生成して。Other useful features
While executing queries using natural language is straightforward, there are risks such as accidents due to incorrect operation.
While it is necessary to restrict the service account's permissions according to the principle of least privilege, it is also possible to avoid this through the following settings.
Read-only mode
trueDisabling specific tools
drop-collectionsummary
MongoDB MCP Server is a tool that makes the powerful features of MongoDB easily accessible to everyone through an intuitive interface using natural language.
This could be especially helpful for developers without database expertise, and for teams looking to streamline their development process using AI.
Although it's still in public preview, it has the potential to enhance the integration of AI and databases, and I'm very excited about its future development.
MongoDB actively solicits feedback on GitHub.Therefore, if you're interested, why not give it a try?
SRG is looking for new team members.
If you are interested, please contact us here.
