ecourts-mcp-server
Connects LLMs to the EcourtsIndia Partner API for searching Indian court cases, retrieving orders, reading cause lists, and accessing AI summaries.
README
ecourts-mcp-server v1.2.0
An MCP (Model Context Protocol) server that connects LLMs to the EcourtsIndia Partner API v1.3, enabling AI agents to search Indian court cases, retrieve orders, read cause lists, and access AI-generated summaries.
Tools (9 total)
| Tool | Description | Billing |
|---|---|---|
ecourts_get_case |
Full case detail by CNR — parties, orders, IAs, notices, documents, hearings, FIR, linked cases, file AI status, case AI analysis | Per-request |
ecourts_lookup_case |
Workflow tool — find a case by human-readable number (e.g. "CS(OS) 123/2024") instead of CNR, returns full details | Per-request |
ecourts_search_cases |
Rich search with 30+ filter params, year filters, date ranges, faceted aggregations | Per-request |
ecourts_get_order |
Download order PDF with metadata (certified true copies) | Per-request |
ecourts_get_order_ai |
Extracted order text + pre-computed AI analysis (summary, outcome, key points) | Per-request |
ecourts_get_court_structure |
Browse state → district → complex → court hierarchy | Free |
ecourts_search_causelist |
Search cause list entries across all courts | ₹1/request |
ecourts_get_causelist_dates |
Available cause list dates | Free |
ecourts_refresh_case |
Queue a fresh scrape of case data | Per-request |
Quick Start
npm install
npm run build
export ECOURTS_API_TOKEN="eci_live_your_token_here"
npm start
Deployment
Docker
# Build
docker build -t ecourts-mcp-server .
# Run
docker run -d \
-e ECOURTS_API_TOKEN=eci_live_your_token_here \
-p 3000:3000 \
ecourts-mcp-server
# Health check
curl http://localhost:3000/health
Docker Compose
# Set your token
export ECOURTS_API_TOKEN=eci_live_your_token_here
# Start
docker compose up -d
# Verify
curl http://localhost:3000/health
Cloud Deployment
The Docker image works with any container platform:
- AWS ECS / Fargate — Use the health check endpoint at
/health - Google Cloud Run — Set
PORT=8080(Cloud Run default), server auto-adapts - Azure Container Apps — Standard HTTP container deployment
- Railway / Render / Fly.io — Push the Dockerfile, set
ECOURTS_API_TOKENin secrets
The image runs as a non-root user, includes a HEALTHCHECK, and defaults to HTTP transport on port 3000.
Claude Desktop (stdio)
{
"mcpServers": {
"ecourts": {
"command": "node",
"args": ["/path/to/ecourts-mcp-server/dist/index.js"],
"env": {
"ECOURTS_API_TOKEN": "eci_live_your_token_here"
}
}
}
}
Claude Code (stdio)
claude mcp add ecourts -- node /path/to/ecourts-mcp-server/dist/index.js
Running Tests
npm test # 110 unit tests via vitest
npm run test:integration # 24 integration tests (requires ECOURTS_API_TOKEN)
npm run test:all # both
Tests cover: query parameter serialization, all formatting functions, facet rendering, all 14 API error code branches, schema boundary validation, safeHandler wrapper, truncation, date validation, and typed fields. Integration tests cover court structure hierarchy, case search with filters/sort/years, case detail, order metadata, cause list search by date, case refresh, and error scenarios.
CI/CD
The .github/workflows/ci.yml pipeline:
- Build & test on Node 20 and 22 (on push/PR to main)
- Docker build + health check on push to main
Architecture
src/
├── index.ts # Entry point, transport (stdio/HTTP), health endpoint
├── constants.ts # Base URLs, character limits
├── types.ts # Full TypeScript interfaces for all API responses
├── schemas/index.ts # Zod input validation with date regex enforcement
├── services/
│ ├── api-client.ts # HTTP client, binary download, repeated-key array serializer, error handling
│ └── formatting.ts # Markdown formatters for case, search, causelist, order
└── tools/index.ts # 9 tool registrations with MCP annotations
Environment Variables
| Variable | Required | Description |
|---|---|---|
ECOURTS_API_TOKEN |
Yes | EcourtsIndia Partner API bearer token |
TRANSPORT |
No | stdio (default) or http |
PORT |
No | HTTP port (default 3000, only for http transport) |
Changelog
v1.2.0 (current)
Code Quality:
- Eliminated all unsafe type casts —
linkCases,subordinateCourt, andfirDetailsare now proper typed fields onCourtCaseData CauseListEntryexpanded withpetitionerAdvocates,respondentAdvocates,internalCaseNo,dateCreated,dateModified- Proper
AvailableDatesResponseandCaseFileSummarytypes replace inline anonymous types - All date parameters validated with
YYYY-MM-DDregex at schema level
New Features:
ecourts_lookup_case— workflow tool that finds cases by human-readable number (e.g. "CS(OS) 123/2024") instead of CNR- Order file status in case detail —
ecourts_get_casenow shows which orders have AI analysis available with summary previews - Health check endpoint —
GET /healthfor load balancers and container orchestrators - Error-safe HTTP transport — Express handler now catches errors instead of hanging
ecourts_get_orderPDF download — returns order PDF as embedded resource with metadata (filename, file size) extracted from HTTP headers
Deployment:
- Multi-stage Dockerfile (22MB Alpine image, non-root user, HEALTHCHECK)
- docker-compose.yml with health check and token validation
- GitHub Actions CI (Node 20/22 matrix, Docker build verification)
- Test suite expanded to 110 unit tests + 24 integration tests
v1.1.0
- Fixed array parameter serialization (courtCodes, caseTypes, etc.)
- Added
isErrorflag on MCP error responses - Complete error code handling (11 API error codes)
- 15+ new search parameters (year filters, date ranges, categories, bench types)
- Facet counts in search output
- Comprehensive case detail formatting (all sections)
v1.0.0
- Initial release with 8 tools covering all EcourtsIndia Partner API endpoints
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.