Meilisearch MCP Server

Official

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides a Model Context Protocol (MCP) server for interacting with Meilisearch through LLM interfaces, supporting index and document management, settings configuration, task monitoring, API key management, and search capabilities across single or multiple indices.

美丽搜索 MCP 服务器

模型上下文协议 (MCP) 服务器,用于通过 Claude 等 LLM 接口与 Meilisearch 交互。

特征

安装

# 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
  • 运行美丽搜索实例
  • 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 :获取系统级信息

贡献

  1. Fork 存储库
  2. 创建功能分支
  3. 提交更改
  4. 创建拉取请求

执照

麻省理工学院

ID: tbc3n51jja