# ayzekhdawy/turkiye-mcp architecture

> Architecture diagram of the GitHub repository ayzekhdawy/turkiye-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/ayzekhdawy/turkiye-mcp
- Repository: https://github.com/ayzekhdawy/turkiye-mcp

## Overview

Türkiye MCP is a desktop/web AI assistant and MCP server for Turkish legal, financial, procurement, and market data. The main user journey is asking a natural-language question or attaching a document, then receiving a sourced answer or related precedent; users can also resume saved conversations or connect the tools to an MCP client. The graph preserves the documented domain branches. Source excerpts are partial, so links between the application and unsampled subsystems are shown only where the README or source index supports them.

Main entry points: [`app.py`](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/app.py) (Assistant and MCP app), [`static/js/app.js`](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/static/js/app.js) (Chat interface), [`workspace.py`](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/workspace.py) (Workspace sessions), [`yargitay_mcp_module/client.py`](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/yargitay_mcp_module/client.py) (Court decisions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Assistant experience"]
  node_web_ui["Chat interface<br/>[app.js]"]
  node_workspace["Workspace sessions<br/>[workspace.py]"]
  node_memory["Conversation memory<br/>[memory.py]"]
  node_document["Document extraction<br/>[parser.py]"]
  node_session_store[("Saved sessions<br/>[workspace.py]")]
end

subgraph group_legal["Law and legislation"]
  node_precedent["Precedent search<br/>[client.py]"]
  node_judicial["Court decisions<br/>[client.py]"]
  node_bedesten["Bedesten decisions<br/>[client.py]"]
  node_legislation["Legislation search<br/>[mevzuat_client.py]"]
  node_legal_agencies["Legal agencies<br/>[client_v2.py]"]
end

subgraph group_public["Public services"]
  node_gazette["Official Gazette<br/>[client.py]"]
  node_tax_services["Tax and benefits<br/>[client.py]"]
  node_professional_services["Professional services<br/>[client.py]"]
end

subgraph group_markets["Markets and procurement"]
  node_procurement["Procurement search<br/>[ihale_client.py]"]
  node_market_router["Market routing<br/>[market_router.py]"]
  node_market_service["Market data service<br/>[borsa_client.py]"]
  node_market_providers["Market providers"]
end

subgraph group_runtime["Runtime and state"]
  node_app["Assistant and MCP app<br/>[app.py]"]
  node_gateway["Model gateway<br/>[gateway.py]"]
end

node_user(("User"))
node_mcp_client(("MCP client"))
node_external_data{{"Government and market sources"}}
node_llm{{"LLM services"}}

node_user -->|"asks or uploads"| node_web_ui
node_web_ui -->|"sends requests"| node_app
node_app -->|"routes model requests"| node_gateway
node_gateway -->|"requests completion"| node_llm
node_app -.->|"parses uploads"| node_document
node_app -->|"searches precedents"| node_precedent
node_app -->|"calls search tool"| node_bedesten
node_app -.->|"manages sessions"| node_workspace
node_workspace -->|"persists sessions"| node_session_store
node_mcp_client -->|"connects over SSE"| node_app
node_app -.->|"exposes legal tools"| node_judicial
node_app -.->|"exposes search tools"| node_legislation
node_app -.->|"exposes agency tools"| node_legal_agencies
node_app -.->|"exposes data tools"| node_gazette
node_app -.->|"exposes data tools"| node_tax_services
node_app -.->|"exposes data tools"| node_professional_services
node_app -.->|"exposes tender tools"| node_procurement
node_app -.->|"exposes market tools"| node_market_router
node_market_router -->|"delegates requests"| node_market_service
node_market_service -->|"delegates data calls"| node_market_providers
node_judicial -.->|"retrieves decisions"| node_external_data
node_legislation -.->|"retrieves legislation"| node_external_data
node_gazette -.->|"retrieves notices"| node_external_data
node_procurement -.->|"retrieves tenders"| node_external_data
node_market_providers -.->|"retrieves market data"| node_external_data

click node_app "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/app.py"
click node_web_ui "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/static/js/app.js"
click node_gateway "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/gateway.py"
click node_workspace "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/workspace.py"
click node_memory "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/memory.py"
click node_document "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/uyap_module/parser.py"
click node_precedent "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/emsal_mcp_module/client.py"
click node_judicial "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/yargitay_mcp_module/client.py"
click node_bedesten "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/bedesten_mcp_module/client.py"
click node_legislation "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/mevzuat_search_module/mevzuat_client.py"
click node_legal_agencies "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/kik_mcp_module/client_v2.py"
click node_gazette "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/resmi_gazete_module/client.py"
click node_tax_services "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/gib_module/client.py"
click node_professional_services "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/turmob_module/client.py"
click node_procurement "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/ihale_module/ihale_client.py"
click node_market_router "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/providers/market_router.py"
click node_market_service "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/borsa_module/borsa_client.py"
click node_market_providers "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/providers/borsapy_provider.py"
click node_session_store "https://github.com/ayzekhdawy/turkiye-mcp/blob/master/workspace.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_web_ui,node_workspace,node_memory,node_document,node_session_store,node_user,node_mcp_client toneBlue
class node_precedent,node_judicial,node_bedesten,node_legislation,node_legal_agencies toneAmber
class node_gazette,node_tax_services,node_professional_services toneMint
class node_procurement,node_market_router,node_market_service,node_market_providers toneRose
class node_app,node_gateway,node_external_data,node_llm toneIndigo
```

## Components

### Assistant experience

- [Chat interface](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/static/js/app.js): `static/js/app.js`
- [Workspace sessions](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/workspace.py): `workspace.py`
- [Conversation memory](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/memory.py): `memory.py`
- [Document extraction](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/uyap_module/parser.py): `uyap_module/parser.py`
- [Saved sessions](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/workspace.py): `workspace.py`

### Law and legislation

- [Precedent search](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/emsal_mcp_module/client.py): `emsal_mcp_module/client.py`
- [Court decisions](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/yargitay_mcp_module/client.py): `yargitay_mcp_module/client.py`
- [Bedesten decisions](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/bedesten_mcp_module/client.py): `bedesten_mcp_module/client.py`
- [Legislation search](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/mevzuat_search_module/mevzuat_client.py): `mevzuat_search_module/mevzuat_client.py`
- [Legal agencies](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/kik_mcp_module/client_v2.py): `kik_mcp_module/client_v2.py`

### Public services

- [Official Gazette](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/resmi_gazete_module/client.py): `resmi_gazete_module/client.py`
- [Tax and benefits](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/gib_module/client.py): `gib_module/client.py`
- [Professional services](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/turmob_module/client.py): `turmob_module/client.py`

### Markets and procurement

- [Procurement search](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/ihale_module/ihale_client.py): `ihale_module/ihale_client.py`
- [Market routing](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/providers/market_router.py): `providers/market_router.py`
- [Market data service](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/borsa_module/borsa_client.py): `borsa_module/borsa_client.py`
- [Market providers](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/providers/borsapy_provider.py): `providers/borsapy_provider.py`

### Runtime and state

- [Assistant and MCP app](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/app.py): `app.py`
- [Model gateway](https://github.com/ayzekhdawy/turkiye-mcp/blob/master/gateway.py): `gateway.py`

### Other components

- **User**
- **MCP client**
- **Government and market sources**
- **LLM services**

## Connections

- User → Chat interface: asks or uploads (evidence: `README.md`)
- Chat interface → Assistant and MCP app: sends requests (evidence: `README.md`)
- Assistant and MCP app → Model gateway: routes model requests (evidence: `app.py`)
- Model gateway → LLM services: requests completion (evidence: `README.md`)
- Assistant and MCP app → Document extraction: parses uploads
- Assistant and MCP app → Precedent search: searches precedents (evidence: `app.py`)
- Assistant and MCP app → Bedesten decisions: calls search tool (evidence: `app.py`)
- Assistant and MCP app → Workspace sessions: manages sessions
- Workspace sessions → Saved sessions: persists sessions (evidence: `README.md`)
- MCP client → Assistant and MCP app: connects over SSE (evidence: `README.md`)
- Assistant and MCP app → Court decisions: exposes legal tools
- Assistant and MCP app → Legislation search: exposes search tools (evidence: `app.py`)
- Assistant and MCP app → Legal agencies: exposes agency tools (evidence: `app.py`)
- Assistant and MCP app → Official Gazette: exposes data tools
- Assistant and MCP app → Tax and benefits: exposes data tools
- Assistant and MCP app → Professional services: exposes data tools
- Assistant and MCP app → Procurement search: exposes tender tools
- Assistant and MCP app → Market routing: exposes market tools
- Market routing → Market data service: delegates requests (evidence: `providers/market_router.py`)
- Market data service → Market providers: delegates data calls (evidence: `borsa_module/borsa_client.py`)
- Court decisions → Government and market sources: retrieves decisions
- Legislation search → Government and market sources: retrieves legislation
- Official Gazette → Government and market sources: retrieves notices
- Procurement search → Government and market sources: retrieves tenders
- Market providers → Government and market sources: retrieves market data
