Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/

Build with AI

MongoDB provides tools and integrations to help you build effective AI-powered applications. Use the resources on this page to connect LLMs and AI agents with context about MongoDB features and best practices.

Give your LLM or AI agent context to leverage MongoDB features more effectively.

  • MongoDB MCP Server: The MongoDB MCP Server connects your AI application to MongoDB features and documentation. You can also query MongoDB clusters using natural language from AI clients that support MCP.

  • MongoDB Agent Skills: MongoDB Agent Skills are pre-built, reusable instructions that teach AI coding agents how to perform common MongoDB tasks—from setting up connections and designing schemas to writing queries and optimizing performance. The following skills are available when you use the MongoDB plugins for Claude, Cursor, and Gemini.

Use the MongoDB MCP Server to access documentation and ask questions.

The MongoDB MCP Server includes tools to search MongoDB documentation using natural language:

  • list-knowledge-sources: Lists available MongoDB documentation sources and their versions. For example, manual, drivers, Atlas.

  • search-knowledge: Searches the MongoDB documentation knowledge base with a natural language query and returns relevant content chunks with links.

Example

Ask your AI agent:

"How do I create a compound index in MongoDB?"

The agent uses the search-knowledge tool to find relevant documentation and returns text excerpts with URLs to the full pages.

You can optionally filter searches by specific documentation sources or versions.

Interact with any page in MongoDB documentation as markdown to use as context for your LLM. You can copy a page as markdown using the documentation UI, or have your agent access the markdown directly from the page URL.

To copy a page as markdown using the documentation UI:

  1. Open the page in your browser.

  2. Press the Copy page button in the top right corner of the page.

You can then paste the markdown into a file for your agent to use or into a chat with your LLM.

To derive the markdown version of the page from the page URL:

  1. Remove the trailing slash from the end of the page URL.

  2. Append .md to the trimmed URL.

You can have your agent access the markdown directly from the resulting URL.

Example

The current documentation page URL is:

https://www.mongodb.com/docs/build-with-ai/

The markdown version of this page is available at:

https://www.mongodb.com/docs/build-with-ai.md

You can chat with the page directly from the documentation UI using our MongoDB AI Assistant. This feature is available on most pages in the documentation.

To chat with the page:

  1. Open the page in your browser.

  2. Press the button in the top right corner of the page next to the Copy page button.

  3. Select Ask a Question from the drop-down menu.

This opens a chat window where you can ask questions about the page. The LLM uses the page content as context to generate a response.

The MongoDB documentation provides an llms.txt file at:

https://www.mongodb.com/docs/llms.txt

This file contains a list of MongoDB documentation pages that are relevant to LLMs. You can use this file to provide your LLM with context about MongoDB concepts and use cases.

On this page