Skip to main content

Jawafdehi MCP Server

Model Context Protocol (MCP) server providing tools for integrating LLM workflows with Jawafdehi products, including Jawafdehi.org, Nepal Entity Service (NES), Nepal Government Modernization (NGM), and the likhit Markdown conversion tool.

Available MCP Tools

  • Modular tool architecture for easy extension
  • Unified document converter with smart auto-detection (Likhit + MarkItDown)
  • Read-only access with query validation
  • Timeout protection (default 15s)
  • Comprehensive error handling

Jawafdehi.org

  • search_jawafdehi_cases: Search published Jawafdehi accountability cases
  • get_jawafdehi_case: Retrieve detailed case information
  • create_jawafdehi_case: Create a draft Jawafdehi case
  • patch_jawafdehi_case: Patch an existing case with RFC 6902 JSON Patch operations

Nepal Entity Service (NES)

  • submit_nes_change: Submit NES queue changes through Jawafdehi API
  • search_nes_entities: Search Nepal Entity Service for persons and organizations
  • get_nes_entities: Retrieve complete entity profiles
  • get_nes_entity_prefixes: Fetch valid NES entity prefixes for creation/classification
  • get_nes_entity_prefix_schema: Fetch the JSON schema for a specific NES entity prefix
  • get_nes_tags: Fetch all available entity tags

Nepal Government Modernization (NGM)

  • ngm_query_judicial: Execute SELECT queries against NGM court and court case tables
  • ngm_extract_case_data: Extract complete judicial case information to Markdown

Likhit and Document Conversion

  • convert_to_markdown: Convert documents with smart auto-detection (Likhit for Nepal government PDFs, MarkItDown for Office documents/web pages/general PDFs, with automatic fallback)
  • convert_date: Convert dates between AD and BS calendars

Architecture

The server uses a modular tool architecture:

src/jawafdehi_mcp/
├── server.py              # Main MCP server
└── tools/                 # Tool implementations
    ├── __init__.py        # Tool registry
    ├── base.py            # BaseTool abstract class
    ├── ngm_judicial.py    # NGM judicial query tool
    └── example_tool.py    # Example tool template

Adding New Tools

  1. Create a new file in src/jawafdehi_mcp/tools/ (e.g., my_tool.py)
  2. Subclass BaseTool and implement required methods:
    • name: Tool identifier
    • description: Tool description
    • input_schema: JSON schema for inputs
    • execute(): Tool execution logic
  3. Import your tool in tools/__init__.py
  4. Add an instance to the TOOLS list in server.py

See tools/example_tool.py for a template.

Installation

Install via PyPI (recommended):

uv tool install jawafdehi-mcp

If you want the latest unreleased changes, install from GitHub instead:

uv tool install git+https://github.com/NewNepal-org/jawafdehi-mcp.git

Configuration

Set the required environment variables:

export JAWAFDEHI_API_BASE_URL="https://portal.jawafdehi.org"
export JAWAFDEHI_API_TOKEN="your-jawafdehi-api-token"

To request a Jawafdehi API token, contact inquiry@jawafdehi.org or WhatsApp: +1 206-530-9098.

Usage

As MCP Server

Add to your MCP client configuration:

{
  "mcpServers": {
    "jawafdehi": {
      "command": "uvx",
      "args": ["jawafdehi-mcp"],
      "env": {
        "JAWAFDEHI_API_BASE_URL": "https://portal.jawafdehi.org",
        "JAWAFDEHI_API_TOKEN": "your-jawafdehi-api-token"
      }
    }
  }
}

Jawafdehi Case Drafting and Patching

Use create_jawafdehi_case to create draft cases and patch_jawafdehi_case to apply JSON Patch updates to existing cases by case_id.

Both tools require JAWAFDEHI_API_TOKEN.

NES Queue Submissions

The submit_nes_change tool sends authenticated POST requests to Jawafdehi API's NES queue endpoint. Supported action values are:

  • ADD_NAME
  • CREATE_ENTITY
  • UPDATE_ENTITY

The tool uses JAWAFDEHI_API_BASE_URL for the API host and requires JAWAFDEHI_API_TOKEN for authentication.

NES Schema Discovery

Use get_nes_entity_prefixes to fetch the currently valid NES entity prefixes, and get_nes_entity_prefix_schema to fetch the JSON schema for one prefix such as person or organization/political_party. Prefixes containing slashes (e.g. organization/political_party) are automatically URL-encoded by the tool before being sent in the request path.

These tools read from NES_API_BASE_URL, which defaults to https://nes.newnepal.org.

Available Tables

The following NGM judicial tables are accessible through the Jawafdehi API proxy endpoint (/api/ngm/query_judicial):

  • courts - Court master table (district, high, supreme, special courts)
  • court_cases - Court case metadata and registration information
  • court_case_hearings - Hearing records for each case
  • court_case_entities - Plaintiff and defendant information

Note: The scraped_dates table is excluded from queries.

Documentation

Development

Adding New Tools

See docs/ADDING_TOOLS.md for a complete guide on adding new tools to the server.

Running Tests

poetry run pytest

Linting

./scripts/format.sh --check

Formatting

poetry run black src/ tests/
poetry run isort src/ tests/

License

Open source - see LICENSE file for details.

Metadata

Release files for jawafdehi-mcp 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jawafdehi-mcp 0.1.2
File Size Uploaded Provenance
jawafdehi_mcp-0.1.2.tar.gz 20.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jawafdehi-mcp 0.1.2
File Interpreter ABI Platform
jawafdehi_mcp-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 47.1 kB

Release files / jawafdehi_mcp-0.1.2.tar.gz

Download URL jawafdehi_mcp-0.1.2.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
79b7d438707f59fc8c04bb61a1403fc679e3329bb18844b44147f0a553a1f3e7
BLAKE2b-256 checksum
How to use checksums
1272f8f898521eb7dbe16f2dfaf7ce132d97b4e85fc9ba01af10edd052fabd66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release files / jawafdehi_mcp-0.1.2-py3-none-any.whl

Download URL jawafdehi_mcp-0.1.2-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cda259f82bf6c88b6ce26755f98c23156d23905c58701a1da0edd8b610489cc8
BLAKE2b-256 checksum
How to use checksums
a360e41b5dad63f67bcbc1bb93bfa52fcf38c646bc7fb39271a27f754da144bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Security for jawafdehi-mcp 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jawafdehi_mcp-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page