古兰经搜索引擎MCP服务器

为AI助手和MCP兼容客户端提供古兰经搜索引擎功能的适配层服务器,支持精确搜索、模糊搜索、前缀搜索和形态分析等功能。

  • by Azizham66
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 Azizham66/quran-search-MCP

使用说明

古兰经搜索引擎MCP服务器

⚠️ 重要通知:这是一个 适配层 为原始版本提供MCP(模型上下文协议)服务器功能 quran搜索引擎 通过 阿德尔·本亚希亚。如果您正在寻找核心搜索引擎库、文档,或者想直接在您的应用程序中使用搜索功能,请访问原始项目。

概述

此MCP服务器公开了强大的古兰经搜索引擎,作为AI助手和MCP兼容客户端可以使用的工具。它充当了原始搜索引擎和MCP兼容AI系统之间的桥梁。

信用与归因

原始项目: quran搜索引擎 通过 阿德尔·本亚希亚

这个MCP服务器是建立在原始古兰经搜索引擎之上的,并且完全依赖于它。所有搜索功能、阿拉伯语文本处理、形态分析和数据结构均由原始库提供。

原始图书馆文档

如果您需要:

  • API核心文档
  • 搜索算法详细信息
  • 直接库使用示例
  • 性能基准
  • 数据源信息

👉 访问: https://github.com/adelpro/quran-search-engine


MCP服务器功能

该适配层提供:

  • 精确搜索:查找阿拉伯语文本的精确匹配项
  • 模糊搜索:查找相似的单词和短语
  • 前缀搜索:查找以特定前缀开头的单词
  • 形态分析:按词目和词根搜索
  • 分页:具有限制和偏移的控制结果集
  • 多语言支持:以阿拉伯语和音译文本搜索
  • 性能优化:数据缓存可实现快速响应时间

安装

npm install quran-search-mcp

快速开始

作为MCP服务器

启动服务器:

npx quran-search-mcp

服务器将在启动期间加载一次古兰经数据,然后通过stdio监听MCP请求。

作为图书馆

导入MCP服务器功能:

import { bootstrap, createServer } from 'quran-search-mcp';

// Create and start server programmatically
const server = await createServer();

// Or use bootstrap directly
await bootstrap();

发展

设置

# Clone the repository
git clone https://github.com/Azizham66/quran-search-MCP.git
cd quran-search-MCP

# Install dependencies for all packages
pnpm install

# Build all packages
pnpm build

# Start development mode
pnpm dev:mcp

项目结构

quran-search-MCP/
├── packages/
│   └── quran-search-engine/     # Original search engine 
├── mcp-server/                  # MCP server adaptation
│   ├── src/                     # Server source code
│   │   ├── data/                # Data caching module
│   │   ├── handlers/            # Search handlers
│   │   ├── tools/               # MCP tools
│   │   ├── types/               # Type definitions
│   │   └── index.ts             # Server entry point
│   ├── dist/                    # Built server files
│   ├── package.json              # Server package config
│   └── tsconfig.json           # TypeScript config
├── README.md                    # This documentation
├── CHANGELOG.md                 # Version history
└── package.json                 # Workspace configuration

测试

# Run tests for the engine
pnpm test

# Test the MCP server manually
echo '{"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 1}' | pnpm start

# Test search functionality
echo '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "search", "arguments": {"query": "الرحمن"}}, "id": 2}' | pnpm start

建筑

MCP服务器在构建时考虑了性能:

  • 数据缓存:在服务器引导过程中加载一次三个关键数据集:
    • 古兰经文本:完整的古兰经经文,配以乌思马尼和标准阿拉伯语文本
    • 形态图:每首诗的形态分析数据(根、引理、形式)
    • 词汇地图:全面的逐字映射,实现快速查找
  • 类型安全:通过Zod模式验证完全支持TypeScript
  • 错误处理:全面的错误处理和记录
  • 内存效率高:优化数据结构,实现快速搜索操作

可用工具

搜索工具

在古兰经中搜索特定的文本或概念。

参数:

  • query (字符串,必填):搜索词
  • options (对象,可选):
    • limit (number):最大结果数(默认值:20)
    • offset (number):要跳过的结果数
    • matchType (string):搜索模式-“精确”、“模糊”或“前缀”
    • includeMorphology (布尔值):包括形态分析
    • includeWordMap (boolean):包含单词映射数据

请求示例:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "الرحمن",
      "options": {
        "limit": 5,
        "matchType": "exact"
      }
    }
  },
  "id": 1
}

API 参考

搜索结果架构

每个搜索结果包含:

  • sura_id:章节号
  • aya_id_display:阿拉伯数字的韵文编号
  • uthmani:乌萨马尼剧本文本
  • standard:标准阿拉伯语文本
  • sura_name:阿拉伯语章节名称
  • sura_name_en:英文章节名称
  • matchScore:相关性得分
  • matchType:找到的匹配类型
  • matchedTokens:匹配的令牌数组

响应结构

  • results:匹配的诗句数组
  • counts:按匹配类型搜索统计信息
  • pagination:分页信息

贡献

欢迎投稿!请阅读我们的投稿指南并提交pull请求。

开发工作流程

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 如果适用,添加测试
  5. 提交拉取请求

许可证

MIT许可证-有关详细信息,请参阅许可证文件。


确认与许可

原始项目信用

此MCP服务器是建立在优秀基础上的适配层 quran搜索引擎 通过 阿德尔·本亚希亚.

  • 原发动机作者:阿德尔·本亚希亚 contact@adelpro.us.kg
  • 原发动机项目: https://github.com/adelpro/quran-search-engine
  • 原始发动机许可证:MIT

适配层

此MCP服务器适配也在MIT下获得许可,并保持与原始项目许可条款的兼容性。

  • MCP服务器作者阿齐兹·哈姆丹 azizham66@gmail.com
  • MCP服务器项目: https://github.com/Azizham66/quran-search-MCP
  • MCP服务器许可证:MIT

数据源

此MCP服务器使用的古兰经数据、形态和单词映射与原始古兰经搜索引擎项目提供的相同,这些搜索引擎项目来源于古兰经阿拉伯语语料库v4.0。


感谢Adel Benyahia创建和维护优秀的quran搜索引擎库,使这种MCP适应成为可能!


仓库

  • GitHub: https://github.com/Azizham66/quran-search-MCP
  • 问题: https://github.com/Azizham66/quran-search-MCP/issues
  • npm: https://www.npmjs.com/package/quran-search-mcp