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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。