FarabiInnovations/mcp-quran
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.
all_chapters
Get all chapters
verses_by_chapter
Get verses by chapter ID
search_quran
Search the Quran
all_juzs
Get all juzs
MCP Quran Server
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 chapterschapter_by_id
- Get chapter by ID
๐ Verses
verse_by_key
- Get verse by chapter:verse keyverses_by_chapter
- Get verses by chapter IDverses_by_page
- Get verses by page numberverses_by_juz
- Get verses by juz numberverses_by_hizb
- Get verses by hizb numberverses_by_rub
- Get verses by rub numberrandom_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:
- QuranJS API Documentation - Complete API reference
- Chapters API - Chapter-related endpoints
- Verses API - Verse-related endpoints
- Search API - Search functionality
- Juzs API - Juz-related endpoints
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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
๐ Acknowledgments
- QuranJS API for providing the Quranic data
- Model Context Protocol for the MCP specification
- The open-source community for inspiration and support
๐ Support
If you encounter any issues or have questions:
- Open an issue on GitHub
- Check the QuranJS documentation
- Review the MCP specification