Islamic-Inheritance-pdf-report-generator-MCP-Server

MSMuneerIqbal/Islamic-Inheritance-pdf-report-generator-MCP-Server

3.2

If you are the rightful owner of Islamic-Inheritance-pdf-report-generator-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

InheritanceService MCP Server is a FastMCP-based server designed to calculate Islamic inheritance shares according to Hanafi law, specifically for cash and land, and generates a detailed PDF report.

Tools
1
Resources
0
Prompts
0

InheritanceService MCP Server

A FastMCP-based server that calculates Islamic inheritance shares (Hanafi) for cash and land, generating a PDF report with precise land distribution, including fractional Marla in square feet.


Features

  • Calculate inheritance shares for:
    • Spouse
    • Sons (2:1 ratio with daughters)
    • Daughters
  • Support for cash and land (in Kanals and Marlas).
  • Converts fractional Marla to square feet for precise measurement.
  • Generates a PDF report with full distribution breakdown.
  • Designed to be used with Gemini CLI or any HTTP client.

Land Conversion Constants

  • 1 Kanal = 20 Marlas
  • 1 Marla = 272.25 sq ft
  • Fractional Marla is converted to square feet for accurate land distribution.

Setup

  1. Install dependencies
pip install fastmcp reportlab uvicorn httpx
  1. Save the server code to server.py.

Run the Server Locally

To start the MCP server on your local machine:

fastmcp run inheritance_distribution_mcp_server.py --transport="http" --port="8080"
  • The server will expose the tool calculate_inheritance over HTTP.
  • You can now send requests to http://127.0.0.1:8080/mcp/calculate_inheritance.

Configure Client to Connect

For example, in a Gemini CLI or any compatible client, configure the MCP server like this:

{
  "mcpServers": {
    "my-mcp-server": {
      "httpUrl": "http://127.0.0.1:8080/mcp/"
    }
  }
}
  • Replace my-mcp-server with any descriptive name for your server.
  • The client will now be able to call the calculate_inheritance tool.

MCP Tool: calculate_inheritance

Parameters

ParameterTypeDescription
estate_cashfloatTotal cash estate in currency units (e.g., Rs).
land_kanalsfloatTotal land in Kanals (can be fractional).
has_spousebooltrue if spouse is alive, otherwise false.
num_sonsintNumber of surviving sons.
num_daughtersintNumber of surviving daughters.

Returns

{
  "distribution": {
    "cash": {
      "wife": float,
      "sons": [float, ...],
      "daughters": [float, ...]
    },
    "land": {
      "wife": {
        "kanals": int,
        "marlas": int,
        "fractional_marla": float,
        "square_feet_total": float,
        "square_feet_fractional_marla": float
      },
      "sons": [...],
      "daughters": [...],
      "total": { ... }
    }
  },
  "pdf_file": "inheritance_report.pdf"
}
  • Cash and land shares are divided according to Hanafi inheritance rules:
    • Wife: 1/8 with children, 1/4 without children.
    • Children: Sons receive twice the share of daughters.
  • Land shares include fractional Marla and total square feet for precise measurement.

Example Usage (HTTP)

curl -X POST http://127.0.0.1:8080/mcp/calculate_inheritance \
  -H "Content-Type: application/json" \
  -d '{
        "estate_cash": 500000,
        "land_kanals": 16,
        "has_spouse": true,
        "num_sons": 2,
        "num_daughters": 1
      }'

Response:

{
  "distribution": { ... },
  "pdf_file": "inheritance_report.pdf"
}
  • A PDF file inheritance_report.pdf will be generated in the same directory with a detailed report.

Notes

  • This tool focuses on Sunni/Hanafi law and only supports primary heirs (spouse and children).
  • Fractional Marla is represented both as a decimal Marla and in square feet for exact land measurements.
  • Compatible with Gemini CLI or any REST client supporting POST requests.

License

MIT License