mongodb-search-and-ai
Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when users need to build search functionality for text-based queries (autocomplete, fuzzy matching, faceted search), semantic similarity (embeddings, RAG applications), or combined approaches. Also use when users need text containment, substring matching ('contains', 'includes', 'appears in'), case-insensitive or multi-field text search, or filt
Security Assessment
About mongodb-search-and-ai
A guide for implementing, optimizing, and troubleshooting MongoDB search solutions across Atlas Search (lexical full-text), Vector Search (semantic), and Hybrid Search (combined), driven through the MongoDB MCP server. It is used to build search functionality for text queries such as autocomplete, fuzzy matching, and faceted search, for semantic similarity and RAG applications, for text containment and substring matching, and for filtering across many fields with variable combinations. Its core principles are to understand the use case before building, always inspect existing indexes and schema first, explain indexes and require explicit approval before creating them, optimize configuration for the specific use case, and support read-only mode by providing complete index JSON when create, update, or delete tools are unavailable.
The workflow runs in phases. Discovery uses list-databases, list-collections, collection-schema, collection-indexes, and atlas-inspect-cluster to understand data, fields, existing indexes, and the cluster's MongoDB version, asking clarifying questions when the request is vague. It then chooses a search type: Atlas Search for keyword matching with relevance scoring, fuzzy matching, autocomplete, faceted search, and language-specific analysis; Vector Search for semantic similarity, natural-language understanding, RAG, and cross-modal search; or Hybrid Search for combining approaches using $rankFusion (rank-based) or $scoreFusion (score-based) to merge pipelines.
For hybrid search it performs a version check, since $rankFusion requires MongoDB 8.0+ and $scoreFusion requires 8.2+, and does not proceed or consult the hybrid reference if the requirement is unmet. It then consults the appropriate reference files for lexical indexing and querying, vector search, or hybrid search before recommending indexes or queries. Execution explains the index in plain language, shows the JSON, asks for an index name and explicit approval, creates it via the MCP create-index tool (or hands over JSON in read-only mode), and runs queries with the aggregate tool, validating results. It explicitly warns against using $regex or $text for search use cases because they lack relevance scoring, fuzzy matching, and language-aware tokenization, and covers edge cases such as missing fields, missing indexes, and multiple candidate collections. Use it to map business search requirements to the right MongoDB search implementation.
FAQ
Which search types does this skill cover?
Atlas Search (lexical full-text), Vector Search (semantic), and Hybrid Search (combined), and it helps select the right one for the use case before building.
What MongoDB version is needed for hybrid search?
$rankFusion requires MongoDB 8.0 or later and $scoreFusion requires 8.2 or later. If the version requirement is not met it does not proceed and suggests upgrading.
Will it create indexes without asking?
No. It explains the index in plain language, shows the JSON, asks for a name, and requires explicit approval before using the MCP create-index tool. In read-only mode it provides the JSON for you to create via the Atlas UI.
Why does it avoid $regex and $text for search?
Because they are not designed for full-text search and lack relevance scoring, fuzzy matching, and language-aware tokenization. It shows the Atlas Search equivalent instead.
What does it inspect before recommending anything?
It uses tools like list-databases, list-collections, collection-schema, collection-indexes, and atlas-inspect-cluster to check data, fields, existing indexes, and the cluster version.
Install mongodb-search-and-ai
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
mongodb/agent-skills