Meilisearch MCP
Prerequisites
Section titled “Prerequisites”- A running Meilisearch instance (e.g. via Podman, Docker, or the binary)
MEILI_MASTER_KEYenvironment variable setMEILI_HOSTenvironment variable set (defaults tohttp://localhost:7700)
Indexing documentation
Section titled “Indexing documentation”From the scripts/docs-mcp directory, run:
bun run dev index-docs -d ../../src/content/docs -i docsThis walks the directory, strips frontmatter and markup, chunks each file with chonkiejs, and pushes the chunks to the docs index.
| Flag | Short | Default | Description |
|---|---|---|---|
--dir | -d | — | Directory containing docs to index (required) |
--index | -i | docs | Target Meilisearch index name |
--host | -h | $MEILI_HOST or http://localhost:7700 | Meilisearch host URL |
--apiKey | -k | $MEILI_MASTER_KEY | API key |
--chunkSize | -s | 512 | Chunk size in tokens |
--extensions | -e | .mdx,.md | File extensions to include |
What gets indexed
Section titled “What gets indexed”Each chunk is stored as a document with these fields:
text— the plain-text chunk contenttitle— extracted from frontmatterdocument_name— filenamedocument_path— path relative to the input directorydirectory_path— parent directorychunk_index/total_chunks— position within the source file
The index is configured with text, title, and document_name as searchable attributes, and directory_path, document_name, and title as filterable.
Registering the MCP server
Section titled “Registering the MCP server”The Meilisearch MCP server connects to your instance and exposes search tools to Claude Code. It operates at the instance level — all indexes are accessible through a single server.
Add it to your project’s .mcp.json:
{ "mcpServers": { "meilisearch": { "command": "uvx", "args": ["-n", "meilisearch-mcp"], "env": { "MEILI_HTTP_ADDR": "http://localhost:7700", "MEILI_MASTER_KEY": "${MEILI_MASTER_KEY}" } } }}uvx handles installation automatically — no separate uv pip install step needed.
Restart Claude Code to pick up the new server. You can verify it’s connected by asking Claude to search your docs index.
Using with Open WebUI and Ollama
Section titled “Using with Open WebUI and Ollama”You can also expose the Meilisearch MCP server to Open WebUI using mcpo, which bridges MCP servers to OpenAPI-compatible endpoints.
Create a mcpo-config.json with the same MCP server configuration:
{ "mcpServers": { "meilisearch": { "command": "uvx", "args": ["-n", "meilisearch-mcp"], "env": { "MEILI_HTTP_ADDR": "http://localhost:7700", "MEILI_MASTER_KEY": "${MEILI_MASTER_KEY}" } } }}Then add mcpo and open-webui alongside Ollama in a docker-compose.yml:
services: ollama: image: ollama/ollama restart: unless-stopped ports: - "11434:11434" volumes: - ollama_data:/root/.ollama networks: - ollama healthcheck: test: ["CMD", "curl", "-sf", "http://localhost:11434/"] interval: 30s timeout: 10s retries: 3 start_period: 30s
mcpo: image: ghcr.io/open-webui/mcpo:latest restart: unless-stopped volumes: - ./mcpo-config.json:/app/config.json:ro command: ["--host", "0.0.0.0", "--port", "8000", "--config", "/app/config.json"] networks: - ollama secrets: - source: meilisearch_MEILI_MASTER_KEY target: MEILI_MASTER_KEY type: env security_opt: - no-new-privileges:true
open-webui: image: ghcr.io/open-webui/open-webui:main restart: unless-stopped ports: - "3001:8080" volumes: - open_webui_data:/app/backend/data environment: - OLLAMA_BASE_URL=http://ollama:11434 - WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY} depends_on: - ollama networks: - ollama security_opt: - no-new-privileges:true
volumes: ollama_data: open_webui_data:
networks: ollama:
secrets: meilisearch_MEILI_MASTER_KEY: external: trueThe MEILI_MASTER_KEY is injected into the mcpo container as an environment variable via a Podman/Docker secret. Create it with:
printf '%s' 'your-key-here' | podman secret create meilisearch_MEILI_MASTER_KEY -Once running, add http://mcpo:8000 as a tool connection in Open WebUI’s admin settings. Ollama models can then search your Meilisearch indexes as tool calls.
Testing the connection
Section titled “Testing the connection”You can test the MCP server independently using the inspector:
npx @modelcontextprotocol/inspector uvx -n meilisearch-mcpOr verify your index from the CLI:
curl -s "$MEILI_HOST/indexes/docs/stats" -H "Authorization: Bearer $MEILI_MASTER_KEY" | jq .