一个用于通过Claude等LLM接口与Meilisearch交互的模型上下文协议(MCP)服务器。
# 克隆仓库
git clone <repository_url>
cd meilisearch-mcp
# 创建虚拟环境并安装
uv venv
source .venv/bin/activate # Windows系统使用:.venv\Scripts\activate
uv pip install -e .

MEILI_HTTP_ADDR=http://localhost:7700 # 默认Meilisearch URL
MEILI_MASTER_KEY=your_master_key # 可选:默认Meilisearch API密钥

服务器提供工具可在运行时查看和更新连接设置:
get-connection-settings
:查看当前连接URL和API密钥状态update-connection-settings
:更新URL和/或API密钥以连接到不同的Meilisearch实例通过MCP的示例用法:
// 获取当前设置
{
"name": "get-connection-settings"
}
// 更新连接设置
{
"name": "update-connection-settings",
"arguments": {
"url": "http://new-host:7700",
"api_key": "new-api-key"
}
}

服务器提供一个灵活的搜索工具,可以跨一个或所有索引进行搜索:
search
:使用可选参数在Meilisearch索引中搜索通过MCP的示例用法:
// 在特定索引中搜索
{
"name": "search",
"arguments": {
"query": "搜索词",
"indexUid": "movies",
"limit": 10
}
}
// 跨所有索引搜索
{
"name": "search",
"arguments": {
"query": "搜索词",
"limit": 5,
"sort": ["releaseDate:desc"]
}
}

可用搜索参数:
query
:搜索查询(必需)indexUid
:要搜索的特定索引(可选)limit
:每个索引的最大结果数(可选,默认:20)offset
:要跳过的结果数(可选,默认:0)filter
:过滤表达式(可选)sort
:排序规则(可选)python -m src.meilisearch_mcp
要在Claude Desktop中使用此功能,请将以下内容添加到您的claude_desktop_config.json
中:
{
"mcpServers": {
"meilisearch": {
"command": "uvx",
"args": ["-n", "meilisearch-mcp"]
}
}
}

npx @modelcontextprotocol/inspector python -m src.meilisearch_mcp
get-connection-settings
:查看当前Meilisearch连接URL和API密钥状态update-connection-settings
:更新URL和/或API密钥以连接到不同实例create-index
:创建带有可选主键的新索引list-indexes
:列出所有可用索引get-index-metrics
:获取特定索引的详细指标get-documents
:从索引中检索文档(支持分页)add-documents
:在索引中添加或更新文档search
:跨单个或多个索引进行灵活搜索,支持过滤和排序选项get-settings
:查看索引的当前设置update-settings
:更新索引设置(排名、分面等)get-keys
:列出所有API密钥create-key
:创建具有特定权限的新API密钥delete-key
:删除现有API密钥get-task
:获取特定任务的信息get-tasks
:列出任务(支持可选过滤器):
limit
:要返回的最大任务数from
:要跳过的任务数reverse
:任务的排序顺序batchUids
:按批次UID过滤uids
:按任务UID过滤canceledBy
:按取消来源过滤types
:按任务类型过滤statuses
:按任务状态过滤indexUids
:按索引UID过滤afterEnqueuedAt
/beforeEnqueuedAt
:按入队时间过滤afterStartedAt
/beforeStartedAt
:按开始时间过滤afterFinishedAt
/beforeFinishedAt
:按完成时间过滤cancel-tasks
:取消挂起或已排队的任务delete-tasks
:删除已完成的任务health-check
:基本健康检查get-health-status
:全面的健康状态get-version
:获取Meilisearch版本信息get-stats
:获取数据库统计信息get-system-info
:获取系统级信息MIT