|
| 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). |
0 commit comments