Meilisearch MCP Server

Meilisearch MCP Server

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

Meilisearch Server MCP server

简介

这是一个 Model Context Protocol (MCP) 服务器,让你能通过 Claude 等 LLM 接口直接与 Meilisearch 交互。

安装

git clone <repository_url>
cd meilisearch-mcp
uv venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
uv pip install -e .

基本要求

  • Python ≥ 3.9
  • 运行中的 Meilisearch 实例
  • Node.js (仅测试用)

配置环境

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

运行服务器

python -m src.meilisearch_mcp

核心功能

1. 连接管理

// 获取当前连接设置
{
  "name": "get-connection-settings"
}

// 更新连接设置
{
  "name": "update-connection-settings",
  "arguments": {
    "url": "http://new-host:7700",
    "api_key": "new-api-key"
  }
}

2. 搜索功能

// 在特定索引中搜索
{
  "name": "search",
  "arguments": {
    "query": "搜索词",
    "indexUid": "movies",
    "limit": 10
  }
}

// 搜索所有索引
{
  "name": "search",
  "arguments": {
    "query": "搜索词",
    "limit": 5
  }
}

3. 索引与文档管理

// 创建索引
{
  "name": "create-index",
  "arguments": {
    "uid": "movies",
    "primaryKey": "id"
  }
}

// 添加文档
{
  "name": "add-documents",
  "arguments": {
    "indexUid": "movies",
    "documents": [{"id": 1, "title": "标题名"}]
  }
}

与 Claude Desktop 集成

将以下内容添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "meilisearch": {
      "command": "uvx",
      "args": ["-n", "meilisearch-mcp"]
    }
  }
}

测试

npx @modelcontextprotocol/inspector python -m src.meilisearch_mcp

其他可用工具

  • 任务监控: get-task, get-tasks, cancel-tasks
  • API 密钥管理: get-keys, create-key, delete-key
  • 系统监控: health-check, get-stats, get-version
  • 设置管理: get-settings, update-settings

更多详细用法请参考完整文档。

许可证

MIT