Skip to content

Commit 8bacf47

Browse files
Merge branch 'main' into mintlify-iso
2 parents 36d6abb + f435e5f commit 8bacf47

File tree

10 files changed

+337
-13
lines changed

10 files changed

+337
-13
lines changed

.code-samples.meilisearch.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,39 @@ search_parameter_reference_retrieve_vectors_1: |-
14231423
"embedder": "EMBEDDER_NAME"
14241424
}
14251425
}'
1426+
related_results_embedder_1: |-
1427+
curl -X PATCH 'MEILISEARCH_URL/indexes/movies/settings'
1428+
-H 'Content-Type: application/json'
1429+
-H 'Authorization: Bearer MEILISEARCH_API_KEY'
1430+
--data-binary '{
1431+
"embedders": {
1432+
"movies-text": {
1433+
"source": "openAi",
1434+
"apiKey": "OPENAI_API_KEY",
1435+
"model": "text-embedding-3-small",
1436+
"documentTemplate": "A movie titled '{{doc.title}}' released in {{ doc.release_date }}. The movie genres are: {{doc.genres}}. The story is about: {{doc.overview|truncatewords: 20}}"
1437+
}
1438+
}
1439+
}'
1440+
related_results_search_1: |-
1441+
curl -X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/search' \
1442+
-H 'content-type: application/json' \
1443+
-H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \
1444+
--data-binary '{
1445+
"q": "batman",
1446+
"hybrid": {
1447+
"embedder": "EMBEDDER_NAME"
1448+
}
1449+
}'
1450+
related_results_similar_1: |-
1451+
curl \
1452+
-X POST 'MEILISEARCH_URL/indexes/movies/similar' \
1453+
-H 'Content-Type: application/json' \
1454+
-H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \
1455+
--data-binary '{
1456+
"id": 192,
1457+
"embedder": "EMBEDDER_NAME"
1458+
}'
14261459
14271460
### Code samples for experimental features
14281461
experimental_get_metrics_1: |-
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Add PR to Code Samples Changes project
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, synchronize]
6+
paths:
7+
- '.code-samples.meilisearch.yaml'
8+
9+
jobs:
10+
add-pr-to-project:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/add-to-project@280af8ae1f83a494cfad2cb10f02f6d13529caa9
14+
with:
15+
project-url: https://github.com/orgs/meilisearch/projects/44
16+
github-token: ${{ secrets.GH_TOKEN }}
379 KB
Loading

config/sidebar-guides.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"title": "Artificial Intelligence",
5656
"slug": "ai",
5757
"routes": [
58+
{
59+
"source": "guides/ai/mcp.mdx",
60+
"label": "Model Context Protocol - Talk to Meilisearch with Claude desktop",
61+
"slug": "mcp"
62+
},
5863
{
5964
"source": "guides/embedders/openai.mdx",
6065
"label": "Semantic search with OpenAI embeddings",

config/sidebar-learn.json

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
"label": "Getting started with AI-powered search",
4545
"slug": "getting_started_with_ai_search"
4646
},
47-
{
48-
"source": "learn/ai_powered_search/search_with_user_provided_embeddings.mdx",
49-
"label": "Use AI-powered search with user-provided embeddings",
50-
"slug": "search_with_user_provided_embeddings"
51-
},
5247
{
5348
"source": "learn/ai_powered_search/configure_rest_embedder.mdx",
5449
"label": "Configure a REST embedder",
@@ -59,16 +54,26 @@
5954
"label": "Document template best practices",
6055
"slug": "document_template_best_practices"
6156
},
62-
{
63-
"source": "learn/ai_powered_search/choose_an_embedder.mdx",
64-
"label": "Which embedder should I choose?",
65-
"slug": "choose_an_embedder"
66-
},
6757
{
6858
"source": "learn/ai_powered_search/image_search_with_user_provided_embeddings.mdx",
6959
"label": "Image search with user-provided embeddings",
7060
"slug": "image_search_with_user_provided_embeddings"
7161
},
62+
{
63+
"source": "learn/ai_powered_search/search_with_user_provided_embeddings.mdx",
64+
"label": "Use AI-powered search with user-provided embeddings",
65+
"slug": "search_with_user_provided_embeddings"
66+
},
67+
{
68+
"source": "learn/ai_powered_search/retrieve_related_search_results.mdx",
69+
"label": "Retrieve related search results",
70+
"slug": "retrieve_related_search_results"
71+
},
72+
{
73+
"source": "learn/ai_powered_search/choose_an_embedder.mdx",
74+
"label": "Which embedder should I choose?",
75+
"slug": "choose_an_embedder"
76+
},
7277
{
7378
"source": "learn/ai_powered_search/difference_full_text_ai_search.mdx",
7479
"label": "Differences between full-text and AI-powered search",

guides/ai/mcp.mdx

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
---
2+
title: Meilisearch & Model Context Protocol - Talk to Meilisearch with Claude desktop
3+
description: This guide walks Meilisearch users through setting up the MCP server with Claude desktop to talk to the Meilisearch API
4+
---
5+
6+
# Model Context Protocol - Talk to Meilisearch with Claude desktop
7+
8+
## Introduction
9+
10+
This guide will walk you through setting up and using Meilisearch through natural language interactions with Claude AI via Model Context Protocol (MCP).
11+
12+
## Requirements
13+
14+
To follow this guide, you'll need:
15+
16+
- [Claude Desktop](https://claude.ai/download) (free)
17+
- [A Meilisearch Cloud project](https://www.meilisearch.com/cloud) (14 days free-trial)
18+
- Python ≥ 3.9
19+
- From the Meilisearch Cloud dashboard, your Meilisearch host & api key
20+
21+
## Setting up Claude Desktop with the Meilisearch MCP Server
22+
23+
### 1. Install Claude Desktop
24+
25+
Download and install [Claude Desktop](https://claude.ai/download).
26+
27+
### 2. Install the Meilisearch MCP Server
28+
29+
You can install the Meilisearch MCP server using `uv` or `pip`:
30+
31+
```bash
32+
# Using uv (recommended)
33+
uv pip install meilisearch-mcp
34+
35+
# Using pip
36+
pip install meilisearch-mcp
37+
```
38+
39+
### 3. Configure Claude Desktop
40+
41+
Open Claude Desktop, click on the Claude menu in the top bar, and select "Settings". In the Settings window, click on "Developer" in the left sidebar, then click "Edit Config". This will open your `claude_desktop_config.json` file.
42+
43+
Add the Meilisearch MCP server to your configuration:
44+
45+
```json
46+
{
47+
"mcpServers": {
48+
"meilisearch": {
49+
"command": "uvx",
50+
"args": ["-n", "meilisearch-mcp"]
51+
}
52+
}
53+
```
54+
55+
Save the file and restart Claude.
56+
57+
## Connecting to Your Meilisearch Instance
58+
59+
Once Claude Desktop is set up with the Meilisearch MCP server, you can connect to your Meilisearch instance by asking Claude to update the connection settings.
60+
61+
Open Claude Desktop and start a new conversation.
62+
63+
Next, connect to your Meilisearch instance by asking Claude to update the connection settings, replacing `MEILISEARCH_URL` with your project URL and `API_KEY` with your project's API key:
64+
65+
```
66+
Please connect to my Meilisearch instance at MEILISEARCH_URL using the API key API_KEY
67+
```
68+
69+
Claude will use the MCP server's `update-connection-settings` tool to establish a connection to your Meilisearch instance.
70+
71+
Finally, verify the connection by asking:
72+
73+
```
74+
Can you check the connection to my Meilisearch instance and tell me what version it's running?
75+
```
76+
77+
Claude will use the `get-version` and `health-check` tools to verify the connection and provide information about your instance.
78+
79+
80+
## Create an e-commerce index
81+
82+
Now you have configured the MCP to work with Meilisearch, you can use it to manage your indexes.
83+
84+
First, verify what indexes you have in your project:
85+
86+
```
87+
What indexes do I have in my Meilisearch instance?
88+
```
89+
90+
Next, ask Claude to create an index optimized for e-commerce:
91+
92+
```
93+
Create a new index called "products" for our e-commerce site with the primary key "product_id"
94+
```
95+
96+
Finally, check the index has been created successfully and is completely empty:
97+
98+
```
99+
How many documents are in my "products" index and what's its size?
100+
```
101+
102+
## Add documents to your new index
103+
104+
Ask Calude to add a couple of test documents to your "products" index:
105+
106+
```
107+
Add these products to my "products" index:
108+
[
109+
{"product_id": 1, "name": "Ergonomic Chair", "description": "Comfortable office chair", "price": 299.99, "category": "Furniture"},
110+
{"product_id": 2, "name": "Standing Desk", "description": "Adjustable height desk", "price": 499.99, "category": "Furniture"}
111+
]
112+
```
113+
114+
Since you are only using "products" for testing, you can also ask Claude to automatically populate it with placeholder data:
115+
116+
```
117+
Add 10 documents in the index "products" with a name, category, price, and description of your choice
118+
```
119+
120+
To verify data insertion worked as expected, retrieve the first few documents in your index:
121+
122+
```
123+
Show me the first 5 products in my "products" index
124+
```
125+
126+
## Configure your index
127+
128+
Before performing your first search, set a few index settings to ensure relevant results.
129+
130+
Ask Claude to prioritize exact word matches over multiple partial matches:
131+
132+
```
133+
Update the ranking rules for the "products" index to prioritize word matches and handle typos, but make exact matches more important than proximity
134+
```
135+
136+
It's also a good practice to limit searchable attributes only to highly-relevant fields, and only return attributes you are going to display in your search interface:
137+
138+
```
139+
Configure my "products" index to make the "name" and "description" fields searchable, but only "name", "price", and "category" should be displayed in results
140+
```
141+
142+
## Perform searches with MCP
143+
144+
Perform your first search with the following prompt:
145+
146+
```
147+
Search the "products" index for "desk" and return the top 3 results
148+
```
149+
150+
You can also request your search uses other Meilisearch features such as filters and sorting:
151+
152+
```
153+
Search the "products" index for "chair" where the price is less than 200 and the category is "Furniture". Sort results by price in ascending order.
154+
```
155+
156+
<Capsule intent="warning" title="Important note about LLM limitation">
157+
Large Language Models like Claude tend to say "yes" to most requests, even if they can't actually perform them.
158+
159+
Claude can only perform actions that are exposed through the Meilisearch API and implemented in the MCP server. If you're unsure whether a particular operation is possible, refer to the [Meilisearch documentation](https://docs.meilisearch.com) and the [MCP server README](https://github.com/meilisearch/meilisearch-mcp).
160+
</Capsule>
161+
162+
## Troubleshooting
163+
164+
If you encounter issues with the Meilisearch MCP integration, try these steps
165+
166+
### 1. Ask Claude to verify your connection settings
167+
168+
```
169+
What are the current Meilisearch connection settings?
170+
```
171+
172+
### 2. Ask Claude to check your Meilisearch instance health
173+
174+
```
175+
Run a health check on my Meilisearch instance
176+
```
177+
178+
### 3. Review Claude's logs
179+
180+
Open the logs file in your text editor or log viewer:
181+
182+
- On macOS: `~/Library/Logs/Claude/mcp*.log`
183+
- On Windows: `%APPDATA%\Claude\logs\mcp*.log`
184+
185+
### 4. Test the MCP server independently
186+
187+
Open your terminal and query the MCP Inspector with `npx`:
188+
189+
```bash
190+
npx @modelcontextprotocol/inspector uvx -n meilisearch-mcp
191+
```
192+
193+
## Conclusion
194+
195+
The Meilisearch MCP integration with Claude can transform multiple API calls and configuration tasks into conversational requests. This can help you focus more on building your application and less on implementation details.
196+
197+
For more information about advanced configurations and capabilities, refer to the [Meilisearch documentation](https://docs.meilisearch.com) and the [Meilisearch MCP server repository](https://github.com/meilisearch/meilisearch-mcp).
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Retrieve related search results
3+
description: This guide shows you how to use the similar documents endpoint to create an AI-powered movie recommendation workflow.
4+
---
5+
6+
# Retrieve related search results
7+
8+
This guide shows you how to use the [similar documents endpoint](/reference/api/similar) to create an AI-powered movie recommendation workflow.
9+
10+
First, you will create an embedder and add documents to your index. You will then perform a search, and use the top result's primary key to retrieve similar movies in your database.
11+
12+
## Prerequisites
13+
14+
- A running Meilisearch project
15+
- A [tier >=2](https://platform.openai.com/docs/guides/rate-limits#usage-tiers) OpenAI API key
16+
17+
## Create a new index
18+
19+
Create an index called `movies` and add this <ButtonLink as="a" id="downloadMovie" href="/movies.json" download="movies.json">`movies.json`</ButtonLink> dataset to it. If necessary, consult the [getting started](/learn/getting_started/cloud_quick_start) for more instructions on index creation.
20+
21+
Each document in the dataset represents a single movie and has the following structure:
22+
23+
- `id`: a unique identifier for each document in the database
24+
- `title`: the title of the movie
25+
- `overview`: a brief summary of the movie's plot
26+
- `genres`: an array of genres associated with the movie
27+
- `poster`: a URL to the movie's poster image
28+
- `release_date`: the release date of the movie, represented as a Unix timestamp
29+
30+
## Configure an embedder
31+
32+
Next, use the Cloud UI to configure an OpenAI embedder:
33+
34+
![Animated image of the Meilisearch Cloud UI showing a user clicking on "add embedder". This opens up a modal window, where the user fills in the name of the embedder, chooses OpenAI as its source. They then select a model, input their API key, and type out a document template.](/assets/images/similar-guide/01-add-embedder-ui.gif)
35+
36+
You may also use the `/settings/embedders` API subroute to configure your embedder:
37+
38+
<CodeSamples id="related_results_embedder_1" />
39+
40+
Replace `MEILISEARCH_URL`, `MEILISEARCH_API_KEY`, and `OPENAI_API_KEY` with the corresponding values in your application.
41+
42+
Meilisearch will start generating the embeddings for all movies in your dataset. Use the returned `taskUid` to [track the progress of this task](/learn/async/asynchronous_operations). Once it is finished, you are ready to start searching.
43+
44+
## Perform a hybrid search
45+
46+
With your documents added and all embeddings generated, you can perform a search:
47+
48+
<CodeSamples id="related_results_search_1" />
49+
50+
This request returns a list of movies. Pick the top result and take note of its primary key in the `id` field. In this case, it's the movie "Batman" with `id` 192.
51+
52+
## Return similar documents
53+
54+
Pass "Batman"'s `id` to your index's [`/similar` route](/reference/api/similar), specifying `movies-text` as your embedder:
55+
56+
<CodeSamples id="related_results_similar_1" />
57+
58+
Meilisearch will return a list of the 20 documents most similar to the movie you chose. You may then choose to display some of these similar results to your users, pointing them to other movies that may also interest them.
59+
60+
## Conclusion
61+
62+
Congratulations! You have successfully built an AI-powered movie search and recommendation system using Meilisearch by:
63+
64+
- Setting up a Meilisearch project and configured it for AI-powered search
65+
- Implementing hybrid search combining keyword and semantic search capabilities
66+
- Integrating Meilisearch's similarity search for movie recommendations
67+
68+
In a real-life application, you would now start integrating this workflow into a front end, like the one in this [official Meilisearch blog post](https://www.meilisearch.com/blog/add-ai-powered-search-to-react).

learn/relevancy/attribute_ranking_order.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ In most datasets, some fields are more relevant to search than others. A `title`
88

99
When `searchableAttributes` is using its default value, `[*]`, all fields carry the same weight.
1010

11-
If you manually configure [the searchable attributes list](/learn/relevancy/displayed_searchable_attributes#the-searchableattributes-list), attributes that appear early in the array are more important when claculating search result relevancy.
11+
If you manually configure [the searchable attributes list](/learn/relevancy/displayed_searchable_attributes#the-searchableattributes-list), attributes that appear early in the array are more important when calculating search result relevancy.
1212

1313
## Example
1414

learn/self_hosted/configure_meilisearch_at_launch.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Meilisearch currently supports five log levels, listed in order of increasing ve
325325

326326
<Note>Experimental feature</Note>
327327

328-
**Environment variable**: `MEILI_LOGS_MODE`<br />
328+
**Environment variable**: `MEILI_EXPERIMENTAL_LOGS_MODE`<br />
329329
**CLI option**: `--experimental-logs-mode`<br />
330330
**Default value**: `'human'`<br />
331331
**Expected value**: one of `human` or `json`

0 commit comments

Comments
 (0)