MCP server for Jawafdehi corruption cases, NES entities and NGM judicial data
Project description
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 casesget_jawafdehi_case: Retrieve detailed case informationcreate_jawafdehi_case: Create a draft Jawafdehi casepatch_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 APIsearch_nes_entities: Search Nepal Entity Service for persons and organizationsget_nes_entities: Retrieve complete entity profilesget_nes_entity_prefixes: Fetch valid NES entity prefixes for creation/classificationget_nes_entity_prefix_schema: Fetch the JSON schema for a specific NES entity prefixget_nes_tags: Fetch all available entity tags
Nepal Government Modernization (NGM)
ngm_query_judicial: Execute SELECT queries against NGM court and court case tablesngm_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
- Create a new file in
src/jawafdehi_mcp/tools/(e.g.,my_tool.py) - Subclass
BaseTooland implement required methods:name: Tool identifierdescription: Tool descriptioninput_schema: JSON schema for inputsexecute(): Tool execution logic
- Import your tool in
tools/__init__.py - Add an instance to the
TOOLSlist inserver.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_NAMECREATE_ENTITYUPDATE_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 informationcourt_case_hearings- Hearing records for each casecourt_case_entities- Plaintiff and defendant information
Note: The scraped_dates table is excluded from queries.
Documentation
- Architecture Overview - System design and structure
- Adding Tools Guide - How to add new tools
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jawafdehi_mcp-0.1.2.tar.gz.
File metadata
- Download URL: jawafdehi_mcp-0.1.2.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79b7d438707f59fc8c04bb61a1403fc679e3329bb18844b44147f0a553a1f3e7
|
|
| MD5 |
1fd67bcec5aef85ea027496a78a173e3
|
|
| BLAKE2b-256 |
1272f8f898521eb7dbe16f2dfaf7ce132d97b4e85fc9ba01af10edd052fabd66
|
Provenance
The following attestation bundles were made for jawafdehi_mcp-0.1.2.tar.gz:
Publisher:
pypi-publish.yml on NewNepal-org/jawafdehi-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jawafdehi_mcp-0.1.2.tar.gz -
Subject digest:
79b7d438707f59fc8c04bb61a1403fc679e3329bb18844b44147f0a553a1f3e7 - Sigstore transparency entry: 1188983217
- Sigstore integration time:
-
Permalink:
NewNepal-org/jawafdehi-mcp@f6ffb2ab7420f31672979b2fe79965029a071e69 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/NewNepal-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f6ffb2ab7420f31672979b2fe79965029a071e69 -
Trigger Event:
push
-
Statement type:
File details
Details for the file jawafdehi_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: jawafdehi_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cda259f82bf6c88b6ce26755f98c23156d23905c58701a1da0edd8b610489cc8
|
|
| MD5 |
0085fa47b75180944742611672f1bb56
|
|
| BLAKE2b-256 |
a360e41b5dad63f67bcbc1bb93bfa52fcf38c646bc7fb39271a27f754da144bd
|
Provenance
The following attestation bundles were made for jawafdehi_mcp-0.1.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on NewNepal-org/jawafdehi-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jawafdehi_mcp-0.1.2-py3-none-any.whl -
Subject digest:
cda259f82bf6c88b6ce26755f98c23156d23905c58701a1da0edd8b610489cc8 - Sigstore transparency entry: 1188983221
- Sigstore integration time:
-
Permalink:
NewNepal-org/jawafdehi-mcp@f6ffb2ab7420f31672979b2fe79965029a071e69 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/NewNepal-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f6ffb2ab7420f31672979b2fe79965029a071e69 -
Trigger Event:
push
-
Statement type: