Back to MCP directory
publicPublicdnsLocal runtime

Meilisearch Hybrid Search

Meilisearch混合搜索MCP服务,提供关键词与语义向量结合的混合搜索功能。

article

README

🚀 Meilisearch 混合搜索 MCP 服务器

本 MCP(模型控制协议)服务器提供了一个实用工具,可在 Meilisearch 索引上执行混合搜索。它支持将基于关键词的搜索与语义向量搜索相结合,为用户带来更精准、更全面的搜索体验。

🚀 快速开始

📦 安装指南

在运行服务器之前,你需要设置以下环境变量:

export MEILI_HOST="http://your-meilisearch-instance:7700" # Meilisearch 服务 URL
export MEILI_API_KEY="your_api_key"                     # Meilisearch API 密钥(如果需要)
export MEILI_INDEX="your_index_name"                    # 要搜索的索引名称
export MEILI_EMBEDDER="your_embedder_name"              # 在 Meilisearch 中配置的嵌入器名称(例如,'default', 'myOpenai')
export MEILI_FILTERABLE_ATTRIBUTES="attr1,attr2"        # 索引设置中的可过滤属性(以逗号分隔)

🔨 构建服务器

你可以根据不同的操作系统,使用以下命令构建服务器:

go build -o meilisearch-hybrid-search-mcp .

# Windows
GOOS=windows GOARCH=amd64 go build -o meilisearch-hybrid-search-mcp.exe .
# Linux
GOOS=linux GOARCH=amd64 go build -o meilisearch-hybrid-search-mcp .
# macOS
GOOS=darwin GOARCH=amd64 go build -o meilisearch-hybrid-search-mcp .

▶️ 运行服务器

构建完成后,使用以下命令运行服务器:

./meilisearch-hybrid-search-mcp

服务器将监听标准输入/输出。

💻 使用示例

可用工具:hybrid_search

此工具可对配置的 Meilisearch 索引执行混合搜索。

描述:在 Meilisearch 索引中混合搜索文档。

参数: | 参数 | 类型 | 是否必需 | 默认值 | 描述 | | ---- | ---- | ---- | ---- | ---- | | keywords | 字符串 | 是 | 无 | 搜索查询关键词。 | | semantic_ratio | 数字 | 否 | 0.5 | 控制关键词搜索与语义搜索的平衡。
- 0.0:纯粹的关键词搜索。
- 1.0:纯粹的语义搜索。
- 0.5:平衡的关键词和语义搜索。 | | filterable_attribute | 字符串 | 否 | 无 | 过滤结果使用的属性名称(例如,“genre”,“author”)。需要 filter_word。 | | filter_word | 字符串 | 否 | 无 | 用于过滤指定 filterable_attribute 的值(例如,“Drama”,“Tolkien”)。需要 filterable_attribute。 |

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client