米利搜索MCP
用于通过 Claude 等 LLM 接口与 [Meilisearch](https://www.meilisearch.com/) 交互的服务器。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"meilisearch": {
"args": [
"-n",
"meilisearch-mcp"
],
"command": "uvx"
}
}
}
该服务需要配置环境变量:MEILI_HTTP_ADDR、MEILI_MASTER_KEY
可用工具 (21 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
get-connection-settings
Get current Meilisearch connection settings
该工具无需必填参数,直接调用即可
update-connection-settings 2 个参数
Update Meilisearch connection settings
该工具无需必填参数,直接调用即可
health-check
Check Meilisearch server health
该工具无需必填参数,直接调用即可
get-version
Get Meilisearch version information
该工具无需必填参数,直接调用即可
get-stats
Get database statistics
该工具无需必填参数,直接调用即可
create-index 2 个参数 需填 1 项
Create a new Meilisearch index
必填参数:uid
list-indexes
List all Meilisearch indexes
该工具无需必填参数,直接调用即可
get-documents 3 个参数 需填 1 项
Get documents from an index
必填参数:indexUid
add-documents 3 个参数 需填 2 项
Add documents to an index
必填参数:indexUid、documents
get-settings 1 个参数 需填 1 项
Get current settings for an index
必填参数:indexUid
update-settings 2 个参数 需填 2 项
Update settings for an index
必填参数:indexUid、settings
search 6 个参数 需填 1 项
Search through Meilisearch indices. If indexUid is not provided, it will search across all indices.
必填参数:query
get-task 1 个参数 需填 1 项
Get information about a specific task
必填参数:taskUid
get-tasks 15 个参数
Get list of tasks with optional filters
该工具无需必填参数,直接调用即可
cancel-tasks 4 个参数
Cancel tasks based on filters
该工具无需必填参数,直接调用即可
get-keys 2 个参数
Get list of API keys
该工具无需必填参数,直接调用即可
create-key 4 个参数 需填 2 项
Create a new API key
必填参数:actions、indexes
delete-key 1 个参数 需填 1 项
Delete an API key
必填参数:key
get-health-status
Get comprehensive health status of Meilisearch
该工具无需必填参数,直接调用即可
get-index-metrics 1 个参数 需填 1 项
Get detailed metrics for an index
必填参数:indexUid
get-system-info
Get system-level information
该工具无需必填参数,直接调用即可
服务介绍
Meilisearch MCP 服务器
一个用于通过像 Claude 这样的 LLM 接口与 Meilisearch 交互的 Model Context Protocol (MCP) 服务器。
特性
- 索引和文档管理
- 设置配置和管理
- 任务监控和 API 密钥管理
- 内置的日志和监控工具
- 动态连接配置,以便在不同的 Meilisearch 实例之间切换
- 智能搜索单个或多个索引
- 这是一个 Python 实现,如果你需要在浏览器中使用 Meilisearch MCP 服务器,可以查看 Typescript 集成
安装
# Clone repository
git clone <repository_url>
cd meilisearch-mcp
# Create virtual environment and install
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .
要求
- Python ≥ 3.9
- 正在运行的 Meilisearch 实例
- Node.js(用于使用 MCP Inspector 测试)
使用方法
环境变量
MEILI_HTTP_ADDR=http://localhost:7700 # Default Meilisearch URL
MEILI_MASTER_KEY=your_master_key # Optional: Default Meilisearch API key
动态连接配置
服务器提供了工具来查看和更新运行时的连接设置:
get-connection-settings:查看当前连接 URL 和 API 密钥状态update-connection-settings:更新 URL 和/或 API 密钥以连接到不同的 Meilisearch 实例
通过 MCP 的示例用法:
// Get current settings
{
"name": "get-connection-settings"
}
// Update connection settings
{
"name": "update-connection-settings",
"arguments": {
"url": "http://new-host:7700",
"api_key": "new-api-key"
}
}
搜索功能
服务器提供了一个灵活的搜索工具,可以在一个或所有索引中进行搜索:
search:使用可选参数通过 Meilisearch 索引进行搜索
通过 MCP 的示例用法:
// Search in a specific index
{
"name": "search",
"arguments": {
"query": "search term",
"indexUid": "movies",
"limit": 10
}
}
// Search across all indices
{
"name": "search",
"arguments": {
"query": "search term",
"limit": 5,
"sort": ["releaseDate:desc"]
}
}
可用的搜索参数:
query:搜索查询(必需)indexUid:要搜索的具体索引(可选)limit:每个索引的最大结果数(可选,默认为 20)offset:跳过的结果数量(可选,默认为 0)filter:过滤表达式(可选)sort:排序规则(可选)
运行服务器
python -m src.meilisearch_mcp
与 Claude Desktop 一起使用
要与 Claude Desktop 一起使用,请将以下内容添加到你的 claude_desktop_config.json 中:
{
"mcpServers": {
"meilisearch": {
"command": "uvx",
"args": ["-n", "meilisearch-mcp"]
}
}
}
使用 MCP Inspector 测试
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:更新索引设置(排名、分类等)
API 密钥管理
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: 获取系统级信息
贡献
- Fork 仓库
- 创建功能分支
- 提交更改
- 创建拉取请求
许可证
MIT