Projects · 01

Emsal MCP

A research server I built so that AI assistants can work with Turkish law without inventing decisions or articles. The assistant does not write a decision from memory: it finds it among 11.1 million court decisions and 305 thousand legislative articles on the firm's own server, reads the full text and checks the citation against it.

Version 1.1.0 · Python · Open source on GitHub (AGPL-3.0) · Türkçe

In short. Emsal MCP connects AI assistants such as Claude to a local corpus of decisions of the Turkish Court of Cassation, the Council of State, the Constitutional Court and the regional courts of appeal, together with Turkish legislation. When the assistant cites, it has to rely on the full text of the decision; a decision whose full text cannot be found does not make it into a quotation or a petition. The firm's day-to-day legal research runs on this infrastructure.

What
MCP serverModel Context Protocol: an open standard for connecting AI assistants to external tools and data sources
Corpus
11,111,190 court decisions, 304,906 legislative articlesMeasured on 7 October 2026
Use
In-house, single userNot a public service
Source code
github.com/afsozer/emsal-mcpOpen source, AGPL-3.0 license
Package
pypi.org/project/emsal-mcpInstalls with pip, pipx or uvx

Why I built it

General-purpose AI assistants are often confidently wrong about Turkish law: a docket number that does not exist, a decision attributed to the wrong chamber, an article quoted in its wording before an amendment. Once such errors get into a petition they are hard to spot, and the client pays for them.

The fix is to tie the assistant to the source: not letting it write a decision from its own knowledge, and checking every citation against a full text taken from an official source. Emsal MCP is the toolkit that does this.

What is in the corpus?

LayerSizeUpdated
Court decisions11,111,190 decisions, from 1962 to todayEvery night
Legislation14,351 documents, 304,906 articles: laws, decree-laws, Presidential decrees, regulations, communiquésEvery week
Amendment records96,229 article amendmentsEvery week
Semantic search index29.6 million text chunksWith new decisions

Where does the corpus come from?

The base of the decisions is the Türk İçtihat Korpusu (Turkish Case Law Corpus), a dataset published by Hamza Bağırsakçı on Hugging Face in 2026 under the CC0 (public domain dedication) license. It consists of 11,045,085 unique decisions compiled from the public search systems of the Court of Cassation, the Council of State, UYAP Emsal and the Constitutional Court:

  • Court of Cassation: 9,820,145 decisions (1997–2026)
  • UYAP Emsal, regional courts of appeal and first-instance courts: 815,702 decisions (2017–2026)
  • Council of State: 386,608 decisions (1965–2026)
  • Constitutional Court, individual applications: 17,067 decisions (2012–2026)
  • Constitutional Court, constitutional review of norms: 5,563 decisions (1962–2026)

The decisions appear in the dataset in the anonymised form in which they are published at the source; identifiers left in the text, such as national ID numbers, IBANs, card numbers, phone numbers and email addresses, are additionally masked.

Decisions given after the dataset's cut-off date are added every night through an incremental pull from Bedesten, the Ministry of Justice's decision search system (mevzuat.adalet.gov.tr). Because the last three months are re-scanned every night, decisions uploaded to the system late are picked up as well.

Legislation is taken from mevzuat.gov.tr and refreshed every week for changed texts; earlier versions of documents are kept in an archive. The title index of the Official Gazette since 2000 is updated every morning.

Compiling and processing decisions in this way is permitted: under Article 31 of Law No. 5846 on Intellectual and Artistic Works, the reproduction, dissemination and processing of officially published legislation and court decisions is free.

How does it work?

  1. Question. The assistant looks for a decision or an article for a legal question, using Emsal MCP's tools.
  2. Search. Two searches run together: keyword-based full-text search and semantic search. Semantic search also finds decisions that discuss the same issue in different words. The results are merged into a single list. For recent decisions not yet in the local corpus, the server can also query live official sources.
  3. Full text. The full text of the candidate decision is retrieved. The citation details, such as the chamber, docket and decision numbers and the date, are taken from this text, not from the assistant's memory.
  4. Citation check. Citations in a draft are compared with the text in the corpus and, where needed, in the live source; a citation that does not match is flagged.
  5. Output. The draft is exported as Word (DOCX) or in UDF, the format of UYAP, the Turkish courts' electronic filing system.

Red lines

  • Decisions, dates, docket and decision numbers, chambers and article texts are never invented.
  • A document without a full text cannot go into a quotation or a draft petition; the system flags this for every document.
  • If the source looked for cannot be found, this is said plainly; the gap is not filled with a guess.
  • A legislative article is returned together with its amendment records.

What it does not do

  • It gives no legal opinion. It finds and verifies the source; whether that source applies to the case at hand is for the lawyer to decide.
  • It does not know about finality. Whether a decision has become final is not recorded in the corpus. This is why the decision notes on this site mention, for reversals by a chamber of the Court of Cassation, that it is not known whether the lower court complied.
  • It is not real-time. New decisions are pulled at night; a decision uploaded today reaches the corpus the next morning at the earliest.
  • It is not a public service. It runs on the firm's own server for a single user; it has no publicly accessible interface.

How is it used on this site?

The decisions cited in the articles on this site (in Turkish) were found with this infrastructure and read in full text; the time limits and article citations on the practice area pages were checked against the legislation corpus. Each decision at the end of an article links to the official text on mevzuat.adalet.gov.tr, so readers can open and check it themselves.

Technical details

Language
Python 3.11+The MCP server runs over stdio and streamable HTTP
Search
SQLite FTS5 full-text search; semantic search with FAISSIVF16384, PQ64 index with fp16 re-ranking; embedding model intfloat/multilingual-e5-small (384 dimensions)
Tools
47 MCP tools: 11 core, 36 extendedDecision and legislation search, citation checking, draft petitions, DOCX and UDF export, personal data scanning and masking, chamber profiles
Live sources
Bedesten (Court of Cassation and regional courts of appeal), Constitutional Court, Council of State, Court of Jurisdictional Disputes, Competition Authority, Court of Accounts, Revenue Administration, mevzuat.gov.tr, Official Gazette, Personal Data Protection Authority, European Court of Human Rights
Development
Design and product decisions are mineCoding done with AI-assisted tools (Claude Code)

Installation

Emsal MCP is published on PyPI as the emsal-mcp package and also works without the 11-million-decision local corpus; in that case decision and legislation searches run live against the official sources, and full decision texts are fetched live as well. To add it to Claude Code (uv must be installed):

claude mcp add emsal -- uvx --from emsal-mcp emsal-mcp-server

For a permanent install, pipx install emsal-mcp is enough; Python 3.11 or later is required. The Claude Desktop configuration and the environment variables are described in the repository's README.

pypi.org/project/emsal-mcp

Source code

The source code is open on GitHub under the GNU Affero General Public License, version 3 (AGPL-3.0). You may use, modify and distribute it; if you offer a modified version to others over a network, you must make your modified source code available to them under the same license. Security vulnerabilities can be reported privately as described in the repository's SECURITY.md file.

github.com/afsozer/emsal-mcp

Figures as measured on 7 October 2026; the corpus grows every night.

About Alpaslan Fatih Sözer (in Turkish)