Skip to content

Meilisearch MCP

  • A running Meilisearch instance (e.g. via Podman, Docker, or the binary)
  • MEILI_MASTER_KEY environment variable set
  • MEILI_HOST environment variable set (defaults to http://localhost:7700)

From the scripts/docs-mcp directory, run:

Terminal window
bun run dev index-docs -d ../../src/content/docs -i docs

This walks the directory, strips frontmatter and markup, chunks each file with chonkiejs, and pushes the chunks to the docs index.

FlagShortDefaultDescription
--dir-dDirectory containing docs to index (required)
--index-idocsTarget Meilisearch index name
--host-h$MEILI_HOST or http://localhost:7700Meilisearch host URL
--apiKey-k$MEILI_MASTER_KEYAPI key
--chunkSize-s512Chunk size in tokens
--extensions-e.mdx,.mdFile extensions to include

Each chunk is stored as a document with these fields:

  • text — the plain-text chunk content
  • title — extracted from frontmatter
  • document_name — filename
  • document_path — path relative to the input directory
  • directory_path — parent directory
  • chunk_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.

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.

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: true

The MEILI_MASTER_KEY is injected into the mcpo container as an environment variable via a Podman/Docker secret. Create it with:

Terminal window
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.

You can test the MCP server independently using the inspector:

Terminal window
npx @modelcontextprotocol/inspector uvx -n meilisearch-mcp

Or verify your index from the CLI:

Terminal window
curl -s "$MEILI_HOST/indexes/docs/stats" -H "Authorization: Bearer $MEILI_MASTER_KEY" | jq .