MCP类型感知服务器
一种MCP服务器实现,它使AI模型能够通过查询文档、检索特定项目和访问集合统计信息的工具,来发现、搜索和分析存储在Typesense集合中的数据。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"typesense": {
"args": [
"-y",
"typesense-mcp-server",
"--host",
"your-typesense-host",
"--port",
"8108",
"--protocol",
"http",
"--api-key",
"your-api-key"
],
"command": "npx"
}
}
}
该服务需要配置环境变量:api-key、host、port、protocol
服务介绍
Typesense MCP 服务器
这是一个 模型上下文协议 (MCP) 服务器实现,它为 AI 模型提供了访问 Typesense 搜索功能的能力。该服务器使大语言模型能够发现、搜索和分析存储在 Typesense 集合中的数据。
演示
功能
资源
- 通过
typesense://URI 列出和访问集合 - 每个集合都有名称、描述和文档数量
- 使用 JSON MIME 类型访问模式
工具
-
typesense_query
- 在 Typesense 集合中使用强大的过滤器搜索文档
- 输入:查询文本、集合名称、搜索字段、过滤器、排序选项、限制
- 返回带有相关性评分的匹配文档
-
typesense_get_document
- 从集合中按 ID 检索特定文档
- 输入:集合名称、文档 ID
- 返回完整的文档数据
-
typesense_collection_stats
- 获取关于 Typesense 集合的统计信息
- 输入:集合名称
- 返回集合元数据、文档数量和模式信息
提示
-
analyze_collection
- 分析集合结构和内容
- 输入:集合名称
- 输出:关于模式、数据类型和统计信息的见解
-
search_suggestions
- 为集合获取有效的搜索查询建议
- 输入:集合名称
- 输出:基于集合模式的推荐搜索策略
安装
通过 npm
# Global installation
npm install -g typesense-mcp-server
# Local installation
npm install typesense-mcp-server
通过 mcp-get
npx @michaellatman/mcp-get@latest install typesense-mcp-server
开发
安装依赖项:
npm install
构建服务器:
npm run build
对于带自动重建的开发:
npm run watch
开发环境下的安装
使用 Claude 桌面版
要与 Claude 桌面版一起使用,请添加服务器配置:
在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"typesense": {
"command": "node",
"args": [
"~/typesense-mcp-server/dist/index.js",
"--host", "your-typesense-host",
"--port", "8108",
"--protocol", "http",
"--api-key", "your-api-key"
]
},
}
}
调试
由于 MCP 服务器通过 stdio 进行通信,调试可能会比较困难。我们建议使用 MCP Inspector,它作为包脚本提供:
npm run inspector
Inspector 将提供一个 URL,以便您在浏览器中访问调试工具。
组件
资源
服务器提供有关 Typesense 集合的信息:
- 集合模式 (
typesense://collections/<collection>)- 每个集合的 JSON 模式信息
- 包括字段名称和数据类型
- 样例文档以帮助理解数据结构
资源模板
服务器提供以下模板:
- typesense_search - 用于构建 Typesense 搜索查询的模板
- typesense_collection - 用于查看 Typesense 集合详情的模板
与 Claude Desktop 一起使用
要将此服务器与 Claude Desktop 应用程序一起使用,请在 claude_desktop_config.json 文件的 "mcpServers" 部分添加以下配置:
{
"mcpServers": {
"typesense": {
"command": "npx",
"args": [
"-y",
"typesense-mcp-server",
"--host", "your-typesense-host",
"--port", "8108",
"--protocol", "http",
"--api-key", "your-api-key"
]
}
}
}
日志记录
服务器将信息记录到位于以下位置的日志文件中:
/tmp/typesense-mcp.log
该日志包含有关服务器操作、请求和发生的任何错误的详细信息。
许可证
此 MCP 服务器根据 MIT 许可证许可。这意味着您可以在遵守 MIT 许可证条款和条件的前提下自由使用、修改和分发该软件。有关更多详细信息,请参阅项目仓库中的 LICENSE 文件。
