Legal MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Legal MCP Server
A Model Context Protocol (MCP) server that lets AI assistants and agents (Claude Desktop, Claude Code, IDE assistants or your own agent) search a legal document collection, read articles and cite them. Retrieval is handled by legal-hybrid-search (BM25 + dense + fusion), so the agent gets well-ranked results with ready-made citations instead of guessing.
Tools, resources and prompts
Type | Name | Purpose |
Tool |
| Hybrid search with act/year filters; returns article ids, citations and highlighted snippets |
Tool |
| Full text, citation and previous/next article ids (for reading context) |
Tool |
| Act codes, names, years and article counts (for choosing filters) |
Tool |
|
|
Resource |
| A whole act as Markdown |
Prompt |
| Search, then read, then answer with citations, or say nothing relevant was found |
Design choices:
Typed, validated inputs and outputs. Tools declare JSON Schemas (e.g.
kbetween 1 and 20) and return structured results (Pydantic models), so clients get machine-readable output and bad arguments are rejected before any work runs.All tools are marked read-only (
readOnlyHint,idempotentHint), so clients can allow them without asking for confirmation each time.Errors teach the agent how to recover. An unknown id returns "No article 'XX-9'. IDs look like 'RT-2' ...; act codes: CA, CR, DP, LC, RT" instead of a stack trace.
Passages are merged per article, so long documents chunked for retrieval don't fill the results with duplicates.
Logs go to stderr, because stdout carries the protocol over stdio.
Two transports: stdio for desktop clients, and streamable HTTP (
/mcp) for remote or multi-user deployments.
Related MCP server: korean-law-mcp
Quick start
git clone https://github.com/samSignal/legal-mcp-server.git
cd legal-mcp-server
pip install -e ".[dev]"
python examples/client.py "my landlord will not return my deposit" # scripted MCP client
npx @modelcontextprotocol/inspector legal-mcp # interactive MCP Inspector
legal-mcp --transport streamable-http --port 8000 # HTTP endpoint at /mcpOutput of the example client (a real run):
Tools: search_legislation, get_article, list_acts, cite_article
Top results for: 'my landlord will not return my deposit'
RT-2 Residential Tenancy Act (2017), Article 2 (Security deposit)
The security **deposit** may **not** exceed two months' rent. The **landlord** shall **return** the **deposit** ...
RT-7 Residential Tenancy Act (2017), Article 7 (Termination by the landlord)
RT-4 Residential Tenancy Act (2017), Article 4 (Landlord's access to the premises)
Residential Tenancy Act (2017), Article 2 (Security deposit)
The security deposit may not exceed two months' rent. The landlord shall return the deposit within 30 days ...Use it from Claude Desktop
Add this to claude_desktop_config.json (Settings → Developer → Edit Config), then restart Claude Desktop:
{
"mcpServers": {
"norland-legal": {
"command": "legal-mcp"
}
}
}If legal-mcp is not on your PATH, use the full path to your virtual environment's Python with "args": ["-m", "legal_mcp.server"]. Then ask, for example, "Using norland-legal, how much notice must my landlord give before visiting, and what's the citation?"
Use it from Claude Code
claude mcp add norland-legal -- legal-mcpTests
pytest -q runs 9 tests, and GitHub Actions runs them on Python 3.11 and 3.12 plus the example client on every push. Most tests use a real MCP client session rather than calling the functions directly:
tool discovery, input/output schemas and read-only annotations
the full search → get_article → cite workflow
filters, schema validation (
k=500is rejected) and helpful error messagesresources and prompts
an end-to-end test that launches the server as a subprocess over stdio, the way Claude Desktop does
Project layout
legal_mcp/
library.py domain layer: search, article lookup, citations, snippets (no MCP code)
server.py MCP tools, resource and prompt; stdio / streamable-HTTP entry point
data/ the document collection (fictional Norland statutes)
examples/client.py
tests/Keeping the domain logic in library.py, separate from the protocol layer, means the same search and citation code could also sit behind a REST API or a LangGraph tool.
Note
The statutes are fictional, written for this project (see legal-hybrid-search). Nothing here is legal advice.
License
MIT.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Resolve, search and verify legal citations against the official sources, with provenance.
Grounded MENA legal search, reasoning, citation resolution, and citation-graph traversal.
Search U.S. case law, fetch opinions, and ask matter-aware legal questions over your documents.
Current law as data for AI: search, read and verify statutes and citations. CIS countries first.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides programmatic access to UK legal documents with hybrid semantic search and Model Context Protocol integration for AI assistants.79MIT
- AlicenseAqualityBmaintenanceEnables natural language search and retrieval of Korean laws, precedents, administrative rules, and legal terms, with deep legal chain analysis and full-text access. Supports stdio and streamable-http transports for local and remote deployment.10MIT
- FlicenseAqualityCmaintenanceEnables LLM agents to search and retrieve a hybrid knowledge base of manuals, videos, PDFs, DOCX files and images through tools for hybrid BM25-plus-vector search with facet and tag filters, full document retrieval, semantically similar document lookup, and timestamped video transcript segments. It ships with an in-memory backend for instant local use and an identical Elasticsearch backend for production deployment over stdio or authenticated HTTP.5-
- AlicenseBqualityBmaintenanceEnables citation-safe legal research and document drafting over official Turkish case law and legislation, searching a local 11-million-decision corpus with full-text and semantic retrieval or querying live sources like Bedesten, AYM, Danıştay and mevzuat.gov.tr. It also supports citation verification, petition and bundle preparation, change reports, privacy redaction, and source health checks through core and loadable extended tool sets.1136 PyPI4AGPL 3.0