Fiqh
FreeNot checkedIslamic Fiqh MCP Server - AI-powered semantic search for Islamic jurisprudence rulings
About
Islamic Fiqh MCP Server - AI-powered semantic search for Islamic jurisprudence rulings
README
A Model Context Protocol (MCP) server that provides access to Islamic fiqh (jurisprudence) rulings from classical texts and all four Sunni madhabs (Hanafi, Maliki, Shafi'i, Hanbali). The system uses AI-powered semantic search to find relevant rulings and returns answers with proper source citations.
Features
- Semantic Search: AI-powered search using OpenAI embeddings and vector similarity
- Comprehensive Coverage: Hadith from the six authentic books (Kutub al-Sittah) and contemporary fatawa
- Madhab Filtering: Filter rulings by specific schools of Islamic jurisprudence
- Source Citations: All rulings include proper source attribution and references
- MCP Integration: Works seamlessly with Claude Code CLI
- REST API: HTTP endpoints for GitHub Actions and other integrations
- Topic Browsing: Browse rulings by categories like prayer, fasting, zakat, etc.
Quick Start
Prerequisites
- Node.js 18+ and npm
- Python 3.10+
- OpenAI API key
Installation
Clone the repository
cd /home/jaeden/Projects/personal/fiqh-mcp-serverInstall Node.js dependencies
npm installSet up Python environment
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txtConfigure environment variables
cp .env.example .env # Edit .env and add your OPENAI_API_KEYCollect and process data
# Scrape hadith from sunnah.com python scripts/scrape_sunnah_com.py # Scrape fatawa (optional) python scripts/scrape_islamqa.py # Process and clean the data python scripts/process_texts.py # Generate embeddings python scripts/generate_embeddings.pyBuild the TypeScript code
npm run build
Usage
As MCP Server (with Claude Code)
Add to your Claude Code MCP settings (usually ~/.config/claude/config.json):
{
"mcpServers": {
"fiqh": {
"command": "node",
"args": ["/home/jaeden/Projects/personal/fiqh-mcp-server/build/index.js"],
"env": {
"OPENAI_API_KEY": "your-key-here"
}
}
}
}
Then use in Claude Code:
Ask Claude: "Use the query_fiqh tool to find the Hanafi ruling on combining prayers"
As REST API Server
Start the API server:
npm run api
Make requests:
curl -X POST http://localhost:3000/api/query \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{"query": "What is the ruling on missed prayers?", "limit": 3}'
Available Tools
MCP Tools
query_fiqh - Semantic search for fiqh rulings
- Parameters:
query(required),madhab(optional),limit(optional) - Example:
{"query": "What is the ruling on wiping over socks?", "madhab": "hanafi"}
- Parameters:
browse_by_topic - Browse rulings by topic
- Parameters:
topic(required),madhab(optional),limit(optional) - Example:
{"topic": "prayer", "madhab": "shafi"}
- Parameters:
get_ruling_by_reference - Get specific hadith/fatwa by reference
- Parameters:
source(required),reference(required) - Example:
{"source": "Sahih Bukhari", "reference": "Book 2, Hadith 123"}
- Parameters:
list_topics - List all available topics
list_scholars - List all scholars in the database
get_database_stats - Get database statistics
API Endpoints
GET /health- Health checkGET /api/stats- Database statisticsPOST /api/query- Search for rulingsGET /api/topic/:topic- Browse by topicGET /api/reference- Get by reference
Data Sources
The server collects data from:
- Sunnah.com API: Authenticated hadith from the six books (Bukhari, Muslim, Abu Dawud, Tirmidhi, Nasai, Ibn Majah)
- IslamQA.info: Contemporary fatawa with madhab classifications
- More sources can be added via additional scraping scripts
See docs/DATA_SOURCES.md for detailed information.
Documentation
- MCP Usage Guide - How to use with Claude Code
- API Documentation - REST API reference
- Data Sources - Information about data sources
Development
# Run in development mode with hot reload
npm run dev
# Run API server in development mode
npm run api
# Build TypeScript
npm run build
# Run tests
npm test
# Lint code
npm run lint
Architecture
┌─────────────────┐
│ Claude Code │
│ MCP Client │
└────────┬────────┘
│ stdio
▼
┌─────────────────┐ ┌──────────────┐
│ MCP Server │────▶│ ChromaDB │
│ (TypeScript) │ │ Vector Store │
└────────┬────────┘ └──────────────┘
│
├─────▶ OpenAI Embeddings API
│
└─────▶ Fiqh Database (JSON)
┌─────────────────┐
│ REST API │
│ (Express.js) │
└─────────────────┘
▲
│ HTTP
│
┌─────────────────┐
│ GitHub Actions │
│ External Apps │
└─────────────────┘
Disclaimer
This is a research and educational tool. Users should:
- Consult qualified scholars for personal religious rulings
- Verify information from authoritative sources
- Understand that AI-powered search may not always return perfectly relevant results
- Use this as a supplementary research tool, not as a replacement for traditional Islamic scholarship
License
MIT License - See LICENSE file for details
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Support
For issues or questions:
- Open an issue on GitHub
- Check the documentation in the
docs/folder
Acknowledgments
- Data sourced from Sunnah.com and IslamQA.info
- Built using the Model Context Protocol by Anthropic
- Powered by OpenAI embeddings
Installing Fiqh
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/JaedenRotondo/fiqh-mcp-serverFAQ
Is Fiqh MCP free?
Yes, Fiqh MCP is free — one-click install via Unyly at no cost.
Does Fiqh need an API key?
No, Fiqh runs without API keys or environment variables.
Is Fiqh hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Fiqh in Claude Desktop, Claude Code or Cursor?
Open Fiqh on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
by lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Fiqh with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
