Operate MongoDB with natural language! Try operating a database with an AI assistant using MongoDB MCP Server
This is Kobayashi (@berlinbytes) from the Service Reliability Group (SRG) of the Media Headquarters.
#SRG(Service Reliability Group) mainly provides cross-sectional support for the infrastructure of our media services, improving existing services, launching new ones, contributing to OSS, etc.
This article explains how to set up and use the new tool "MongoDB MCP Server," which uses AI to operate 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. Configuring the MCP ServerTry it outSearching for DataManaging DatabasesManaging Atlas ClustersCode GenerationOther useful featuresRead-only modeDisabling specific toolssummary
Introduction
In recent years, there has been remarkable progress in large-scale language models (LLMs) and AI agents, which is poised to dramatically change the way software is developed.
In this context, MongoDB has announced the public preview of a new tool, the MongoDB Model Context Protocol (MCP) Server, to accelerate AI-driven development.
In this article, we will examine and introduce what MongoDB MCP Server is and what it can do, from setup to 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 enables developers to search MongoDB data and manage their databases using natural language from within a familiar AI-powered editor or chat interface.
It is characterized by its support for all MongoDB deployments, including MongoDB Atlas, Community Edition, and Enterprise Advanced.
What you need
To use an 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
Here, we will explain the setup procedure using an example of linking MongoDB Atlas with Cursor.
The official procedure is here.
1. Create an Atlas service account
A service account with appropriate permissions is required for the MCP server 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. Configuring the MCP Server
Next, configure the server on the MCP client side.
.cursor/mcp.json
After setting it up, launch Cursor and you will be able to operate MongoDB from AI functions such as Chat.
Try it out
Once the setup is complete, try sending out natural language prompts from your AI client.

The "products" collection has been created in the "test" database.
Next, you will be asked for confirmation as shown below. If you allow it, sample data will be inserted.

We were even able to input data using only natural language.
Let's check it on the Atlas UI as well.

It is being operated correctly.
Next, we'll try to run a query using ambiguous expressions.

It seems that they understood our intentions correctly and operated it accordingly.

others,As introduced in the Usage Examples,The following operations were performed:
Searching for Data
You can query the structure of a database or collection, or search for data based on specific criteria.
Example prompt:
sample_mflixデータベースにあるmoviesコレクションのスキーマを説明して。
moviesコレクションの中から、ジャンルが'Thriller'の映画を探して。
Managing Databases
You can perform CRUD operations (Create, Read, Update, Delete) in natural language.
Example prompt:
"products"という名前で新しいコレクションを作成して、サンプルデータをいくつか追加して。
"products"コレクションから、在庫が0のドキュメントを削除して。
Managing Atlas Clusters
If you have configured permissions for the Atlas API, you can also manage your cluster.
Example prompt:
Atlas上のすべてのプロジェクトとクラスターを一覧表示して。
読み取り専用アクセス権を持つ新しいデータベースユーザー'NewUser'を作成して。
Code Generation
By providing database schema information as context, we can generate more accurate application code.
Example prompt:
"products"コレクションのスキーマを参考にして、在庫が少ない商品を検索するJavaScriptの関数を生成して。
Other useful features
While executing queries in natural language is easy, there are risks involved such as accidents due to incorrect operation.
It is of course necessary to limit the privileges of service accounts according to the principle of least privilege, but it is also possible to avoid this by setting the following:
Read-only mode
true
Disabling specific tools
drop-collection
summary
MongoDB MCP Server is a tool that makes it easy for anyone to use the powerful features of MongoDB through an intuitive, natural language interface.
This will be especially helpful for developers without database expertise and teams looking to use AI to streamline their development process.
Although it is still in the public preview stage, there is great potential for it to enhance collaboration between AI and databases, and we are excited to see how it will develop in the future.
MongoDB actively seeks feedback on GitHubSo, if you are interested, why not give it a try?
SRG is looking for people to work with us.
If you are interested, please contact us here.