Meilisearch混合搜索MCP服务器
此MCP(模型控制协议)服务器提供了一种在Meilisearch索引上执行混合搜索的工具。它允许将基于关键字的搜索与语义向量搜索相结合。
环境变量
在运行服务器之前设置以下环境变量:
export MEILI_HOST="http://your-meilisearch-instance:7700" # Meilisearch host URL
export MEILI_API_KEY="your_api_key" # Meilisearch API key (if required)
export MEILI_INDEX="your_index_name" # The name of the index to search in
export MEILI_EMBEDDER="your_embedder_name" # The name of the embedder configured in Meilisearch (e.g., 'default', 'myOpenai')
export MEILI_FILTERABLE_ATTRIBUTES="attr1,attr2" # Comma-separated filterable attributes for AI awareness (from index settings)建立和运行
构建服务器:
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 .
# mac
GOOS=macos 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(字符串,可选):用于筛选结果的属性名称(例如,“流派”、“作者”)。需要filter_word.filter_word(string,可选):筛选指定值的值filterable_attribute通过(例如,“戏剧”,“托尔金”)。需要filterable_attribute.
