# egep1/yargi-mcp architecture

> Architecture diagram of the GitHub repository egep1/yargi-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/egep1/yargi-mcp
- Repository: https://github.com/egep1/yargi-mcp

## Overview

Yargı MCP exposes search and decision-document retrieval across Turkish courts and public institutions to MCP clients. The principal workflow is an MCP request, tool dispatch in the server, source-specific search or retrieval, and a structured or Markdown result. The README also documents semantic search and broad institutional coverage. Source excerpts show several client behaviors; connections for other source modules rely on the server’s indexed references and documented capabilities, so the graph avoids asserting details of their internal calls.

Main entry points: [`mcp_server_main.py`](https://github.com/egep1/yargi-mcp/blob/main/mcp_server_main.py) (MCP tool server), [`anayasa_mcp_module`](https://github.com/egep1/yargi-mcp/tree/main/anayasa_mcp_module) (Constitutional Court), [`semantic_search/processor.py`](https://github.com/egep1/yargi-mcp/blob/main/semantic_search/processor.py) (Semantic search), [`app.py`](https://github.com/egep1/yargi-mcp/blob/main/app.py) (App entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["MCP entry"]
  node_server["MCP tool server<br/>[mcp_server_main.py]"]
  node_app["App entry<br/>[app.py]"]
end

subgraph group_courts["Court decisions"]
  node_anayasa["Constitutional Court"]
  node_yargitay["Court of Cassation<br/>[client.py]"]
  node_danistay["Council of State<br/>[client.py]"]
  node_emsal["UYAP Emsal<br/>[client.py]"]
  node_uyusmazlik["Jurisdictional Disputes<br/>[client.py]"]
  node_sayistay["Court of Accounts"]
  node_bedesten["Bedesten decisions<br/>[client.py]"]
end

subgraph group_institutions["Public institutions"]
  node_kik["Public Procurement<br/>[client_v2.py]"]
  node_rekabet["Competition Authority<br/>[client.py]"]
  node_kvkk["Data Protection Board<br/>[client.py]"]
  node_bddk["Banking regulator<br/>[client.py]"]
  node_btk["Telecommunications regulator<br/>[client.py]"]
  node_gib["Tax rulings<br/>[client.py]"]
  node_sigorta["Insurance arbitration<br/>[client.py]"]
end

subgraph group_search["Search services"]
  node_semantic["Semantic search<br/>[processor.py]"]
  node_embedder["Text embedding<br/>[embedder.py]"]
  node_vector[("Vector store<br/>[vector_store.py]")]
end

node_user(("MCP client"))

node_user -->|"sends MCP request"| node_server
node_app -->|"loads server"| node_server
node_server -->|"dispatches tools"| node_anayasa
node_server -->|"dispatches tools"| node_yargitay
node_server -->|"dispatches tools"| node_danistay
node_server -->|"dispatches tools"| node_emsal
node_server -->|"dispatches tools"| node_uyusmazlik
node_server -->|"dispatches tools"| node_sayistay
node_server -->|"dispatches tools"| node_bedesten
node_server -->|"dispatches tools"| node_kik
node_server -->|"dispatches tools"| node_rekabet
node_server -->|"dispatches tools"| node_kvkk
node_server -->|"dispatches tools"| node_bddk
node_server -->|"dispatches tools"| node_btk
node_server -->|"dispatches tools"| node_gib
node_server -->|"dispatches tools"| node_sigorta
node_server -->|"runs search"| node_semantic
node_semantic -->|"creates embeddings"| node_embedder
node_semantic -->|"queries vectors"| node_vector
node_anayasa -->|"searches and retrieves"| node_anayasa
node_anayasa -->|"uses shared API"| node_anayasa

click node_server "https://github.com/egep1/yargi-mcp/blob/main/mcp_server_main.py"
click node_app "https://github.com/egep1/yargi-mcp/blob/main/app.py"
click node_anayasa "https://github.com/egep1/yargi-mcp/tree/main/anayasa_mcp_module"
click node_yargitay "https://github.com/egep1/yargi-mcp/blob/main/yargitay_mcp_module/client.py"
click node_danistay "https://github.com/egep1/yargi-mcp/blob/main/danistay_mcp_module/client.py"
click node_emsal "https://github.com/egep1/yargi-mcp/blob/main/emsal_mcp_module/client.py"
click node_uyusmazlik "https://github.com/egep1/yargi-mcp/blob/main/uyusmazlik_mcp_module/client.py"
click node_sayistay "https://github.com/egep1/yargi-mcp/tree/main/sayistay_mcp_module"
click node_bedesten "https://github.com/egep1/yargi-mcp/blob/main/bedesten_mcp_module/client.py"
click node_kik "https://github.com/egep1/yargi-mcp/blob/main/kik_mcp_module/client_v2.py"
click node_rekabet "https://github.com/egep1/yargi-mcp/blob/main/rekabet_mcp_module/client.py"
click node_kvkk "https://github.com/egep1/yargi-mcp/blob/main/kvkk_mcp_module/client.py"
click node_bddk "https://github.com/egep1/yargi-mcp/blob/main/bddk_mcp_module/client.py"
click node_btk "https://github.com/egep1/yargi-mcp/blob/main/btk_mcp_module/client.py"
click node_gib "https://github.com/egep1/yargi-mcp/blob/main/gib_mcp_module/client.py"
click node_sigorta "https://github.com/egep1/yargi-mcp/blob/main/sigorta_tahkim_mcp_module/client.py"
click node_semantic "https://github.com/egep1/yargi-mcp/blob/main/semantic_search/processor.py"
click node_embedder "https://github.com/egep1/yargi-mcp/blob/main/semantic_search/embedder.py"
click node_vector "https://github.com/egep1/yargi-mcp/blob/main/semantic_search/vector_store.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_app,node_user toneBlue
class node_anayasa,node_yargitay,node_danistay,node_emsal,node_uyusmazlik,node_sayistay,node_bedesten toneAmber
class node_kik,node_rekabet,node_kvkk,node_bddk,node_btk,node_gib,node_sigorta toneMint
class node_semantic,node_embedder,node_vector toneRose
```

## Components

### MCP entry

- [MCP tool server](https://github.com/egep1/yargi-mcp/blob/main/mcp_server_main.py): `mcp_server_main.py`
- [App entry](https://github.com/egep1/yargi-mcp/blob/main/app.py): `app.py`

### Court decisions

- [Constitutional Court](https://github.com/egep1/yargi-mcp/tree/main/anayasa_mcp_module): `anayasa_mcp_module`
- [Court of Cassation](https://github.com/egep1/yargi-mcp/blob/main/yargitay_mcp_module/client.py): `yargitay_mcp_module/client.py`
- [Council of State](https://github.com/egep1/yargi-mcp/blob/main/danistay_mcp_module/client.py): `danistay_mcp_module/client.py`
- [UYAP Emsal](https://github.com/egep1/yargi-mcp/blob/main/emsal_mcp_module/client.py): `emsal_mcp_module/client.py`
- [Jurisdictional Disputes](https://github.com/egep1/yargi-mcp/blob/main/uyusmazlik_mcp_module/client.py): `uyusmazlik_mcp_module/client.py`
- [Court of Accounts](https://github.com/egep1/yargi-mcp/tree/main/sayistay_mcp_module): `sayistay_mcp_module`
- [Bedesten decisions](https://github.com/egep1/yargi-mcp/blob/main/bedesten_mcp_module/client.py): `bedesten_mcp_module/client.py`

### Public institutions

- [Public Procurement](https://github.com/egep1/yargi-mcp/blob/main/kik_mcp_module/client_v2.py): `kik_mcp_module/client_v2.py`
- [Competition Authority](https://github.com/egep1/yargi-mcp/blob/main/rekabet_mcp_module/client.py): `rekabet_mcp_module/client.py`
- [Data Protection Board](https://github.com/egep1/yargi-mcp/blob/main/kvkk_mcp_module/client.py): `kvkk_mcp_module/client.py`
- [Banking regulator](https://github.com/egep1/yargi-mcp/blob/main/bddk_mcp_module/client.py): `bddk_mcp_module/client.py`
- [Telecommunications regulator](https://github.com/egep1/yargi-mcp/blob/main/btk_mcp_module/client.py): `btk_mcp_module/client.py`
- [Tax rulings](https://github.com/egep1/yargi-mcp/blob/main/gib_mcp_module/client.py): `gib_mcp_module/client.py`
- [Insurance arbitration](https://github.com/egep1/yargi-mcp/blob/main/sigorta_tahkim_mcp_module/client.py): `sigorta_tahkim_mcp_module/client.py`

### Search services

- [Semantic search](https://github.com/egep1/yargi-mcp/blob/main/semantic_search/processor.py): `semantic_search/processor.py`
- [Text embedding](https://github.com/egep1/yargi-mcp/blob/main/semantic_search/embedder.py): `semantic_search/embedder.py`
- [Vector store](https://github.com/egep1/yargi-mcp/blob/main/semantic_search/vector_store.py): `semantic_search/vector_store.py`

### Other components

- **MCP client**

## Connections

- MCP client → MCP tool server: sends MCP request
- App entry → MCP tool server: loads server (evidence: `app.py`)
- MCP tool server → Constitutional Court: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Court of Cassation: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Council of State: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → UYAP Emsal: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Jurisdictional Disputes: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Court of Accounts: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Bedesten decisions: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Public Procurement: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Competition Authority: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Data Protection Board: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Banking regulator: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Telecommunications regulator: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Tax rulings: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Insurance arbitration: dispatches tools (evidence: `mcp_server_main.py`)
- MCP tool server → Semantic search: runs search (evidence: `mcp_server_main.py`)
- Semantic search → Text embedding: creates embeddings (evidence: `semantic_search/processor.py`)
- Semantic search → Vector store: queries vectors (evidence: `semantic_search/processor.py`)
- Constitutional Court → Constitutional Court: searches and retrieves (evidence: `anayasa_mcp_module/client.py`)
- Constitutional Court → Constitutional Court: uses shared API (evidence: `anayasa_mcp_module/bireysel_client.py`)
