mcp-quran

FarabiInnovations/mcp-quran

3.2

If you are the rightful owner of mcp-quran and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Quran Server is a Model Context Protocol server that provides comprehensive access to the Quran through the QuranJS API, enabling AI assistants and applications to retrieve Quranic content.

Tools
  1. all_chapters

    Get all chapters

  2. verses_by_chapter

    Get verses by chapter ID

  3. search_quran

    Search the Quran

  4. all_juzs

    Get all juzs

MCP Quran Server

License: ISC TypeScript Docker

A Model Context Protocol (MCP) server that provides comprehensive access to the Quran through the QuranJS API. This server enables AI assistants and applications to retrieve Quranic content including chapters, verses, translations, tafsirs, and more.

๐ŸŒŸ Features

  • Complete Quran Access: All 114 chapters and 6,236 verses
  • Multiple Retrieval Methods: By chapter, verse key, page, juz, hizb, rub
  • Rich Content: Arabic text, translations, tafsirs, word-by-word breakdown
  • Search Functionality: Full-text search across the Quran
  • Audio Support: Recitation options and audio files
  • Type Safety: Full TypeScript support with proper SDK types
  • MCP Compliance: Standard Model Context Protocol implementation
  • Docker Support: Easy containerized deployment

๐Ÿ“ฆ Installation

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm
  • Docker (optional, for containerized deployment)

Setup

Local Development
# Clone the repository
git clone https://github.com/your-username/mcp-quran.git
cd mcp-quran

# Install dependencies
pnpm install

# Build the project
pnpm build

# Run in debug mode with MCP Inspector
pnpm debug
Docker Deployment
# Build and run with Docker Compose
docker-compose up -d

# For development with hot reload
docker-compose --profile dev up -d

# Build Docker image manually
docker build -t mcp-quran .

# Run container
docker run -d --name mcp-quran-server mcp-quran

๐Ÿš€ Quick Start

Basic Usage

The MCP Quran server provides tools for accessing Quranic content. Here are some examples:

Get All Chapters
{
  "name": "all_chapters",
  "arguments": {}
}
Get Verses by Chapter
{
  "name": "verses_by_chapter",
  "arguments": {
    "chapterId": 1,
    "options": {
      "language": "en",
      "translations": [131, 85],
      "words": true
    }
  }
}
Search the Quran
{
  "name": "search_quran",
  "arguments": {
    "query": "mercy",
    "options": {
      "language": "en",
      "size": 10,
      "page": 1
    }
  }
}

๐Ÿ› ๏ธ Available Tools

This MCP server exposes the following tools that correspond to the QuranJS API endpoints:

๐Ÿ“– Chapters

  • all_chapters - Get all chapters
  • chapter_by_id - Get chapter by ID

๐Ÿ“œ Verses

  • verse_by_key - Get verse by chapter:verse key
  • verses_by_chapter - Get verses by chapter ID
  • verses_by_page - Get verses by page number
  • verses_by_juz - Get verses by juz number
  • verses_by_hizb - Get verses by hizb number
  • verses_by_rub - Get verses by rub number
  • random_verse - Get a random verse

๐Ÿ” Search

  • search_quran - Search the Quran

๐Ÿ“š Juzs

  • all_juzs - Get all juzs

๐Ÿ“š API Documentation

For detailed information about the available parameters, options, and response formats, please refer to the official QuranJS API documentation:

The MCP tools follow the same parameter structure and options as the QuranJS API.

๐ŸŒ Supported Languages

The server supports multiple languages through the Language enum. See the QuranJS Language documentation for the complete list of supported languages.

๐Ÿ”ง Configuration

MCP Client Configuration

Add this to your MCP client configuration:

{
  "mcpServers": {
    "quran": {
      "command": "node",
      "args": ["/path/to/your/mcp-quran/build/index.js"],
      "env": {}
    }
  }
}

Docker Configuration

For Docker deployments, use the containerized version:

{
  "mcpServers": {
    "quran": {
      "command": "docker",
      "args": ["run", "--rm", "mcp-quran"],
      "env": {}
    }
  }
}

๐Ÿ—๏ธ Architecture

The server is built with:

  • TypeScript: For type safety and better development experience
  • Model Context Protocol SDK: For MCP compliance
  • QuranJS API: For Quranic data access
  • Zod: For runtime validation
  • pnpm: For package management
  • Docker: For containerized deployment

Project Structure

mcp-quran/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts          # Main server entry point
โ”‚   โ”œโ”€โ”€ tools/            # MCP tools implementation
โ”‚   โ”‚   โ”œโ”€โ”€ chapters.ts   # Chapter-related tools
โ”‚   โ”‚   โ”œโ”€โ”€ verses.ts     # Verse-related tools
โ”‚   โ”‚   โ”œโ”€โ”€ search.ts     # Search functionality
โ”‚   โ”‚   โ””โ”€โ”€ juzs.ts       # Juz-related tools
โ”‚   โ””โ”€โ”€ helper/           # Helper functions
โ”œโ”€โ”€ media/
โ”‚   โ””โ”€โ”€ logo.png          # Project logo
โ”œโ”€โ”€ build/                # Compiled JavaScript
โ”œโ”€โ”€ Dockerfile            # Docker configuration
โ”œโ”€โ”€ docker-compose.yml    # Docker Compose setup
โ”œโ”€โ”€ .dockerignore         # Docker ignore rules
โ””โ”€โ”€ package.json          # Project configuration

๐Ÿงช Development

Setup Development Environment

# Install dependencies
pnpm install

# Build the project
pnpm build

# Run in debug mode with MCP Inspector
pnpm debug

Docker Development

# Start development environment with hot reload
docker-compose --profile dev up -d

# View logs
docker-compose logs -f mcp-quran-dev

# Stop development environment
docker-compose --profile dev down

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Guidelines

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support

If you encounter any issues or have questions:


Made with โค๏ธ for the Quranic community