这是一个提供与Jina AI神经搜索功能无缝集成的模型上下文协议(MCP)服务器。该服务器通过简单的接口实现了语义搜索、图像搜索和跨模态搜索功能。
git clone <repository-url>
cd jina-ai-mcp
npm install
.env文件:JINA_API_KEY=your_api_key_here
npm run build
在您的MCP设置文件中添加以下配置:
{
"mcpServers": {
"jina-ai": {
"command": "node",
"args": [
"/path/to/jina-ai-mcp/build/index.js"
],
"env": {
"JINA_API_KEY": "your_api_key_here"
}
}
}
}
对文本文档执行语义/神经搜索。
use_mcp_tool({
server_name: "jina-ai",
tool_name: "semantic_search",
arguments: {
query: "search query text",
collection: "your-collection-name",
limit: 10 // 可选,默认值为1 0
}
})
使用图像URL搜索相似的图像。
use_mcp_tool({
server_name: "jina-ai",
tool_name: "image_search",
arguments: {
imageUrl: "https://example.com/image.jpg",
collection: "your-collection-name",
limit: 10 // 可选,默认值为10
}
})
执行文本到图像或图像到文本的搜索。
use_mcp_tool({
server_name: "jina-ai",
tool_name: "cross_modal_search",
arguments: {
query: "a beautiful sunset", // 或用于image2text的图像URL
mode: "text2image", // 或 "image2text"
collection: "your-collection-name",
limit: 10 // 可选,默认值为10
}
})
所有搜索工具返回结果的格式如下:
{
content: [
{
type: "text",
text: JSON.stringify({
results: [
{
id: string,
score: number,
data: Record<string, any>
}
]
}, null, 2)
}
]
}
服务器处理各种错误情况:
所有错误都经过适当格式化,并带有适当的错误代码和消息返回。
欢迎贡献!请随时提交拉取请求。
本项目采用MIT许可证——详情见LICENSE文件。