How ahmetaliunaall-prog/turk-hukuk-ai-mcp works
Türk Hukuk AI MCP turns a user’s case description into a privacy-masked legal research plan, searches case law and legislation through MCP tools, verifies source text, and presents cited research or a petition draft. The local web bridge handles access checks and research requests; the frontend also supports access-key entry and administrator key management. The graph follows documented workflows and excerpted imports/calls; vendor clients and some frontend-to-service wiring are described in the README rather than shown in source excerpts.
Main entry points: orchestrator.py Research orchestrator · web.py Local web bridge · index.ts Access Edge Function · planning.py Query planning
Components 20
User interface
- Research interface
frontend/app.js - Admin panel
frontend/admin.js
Local research service
- Local web bridge
local_ai/web.py - Local access checks
legal_mcp/access.py
Research pipeline
- Research orchestrator
legal_mcp/orchestrator.py - Privacy masking
legal_mcp/privacy.py - Query planning
legal_mcp/planning.py - Local Qwen
local_ai/ollama.py - Evidence ranking
legal_mcp/evidence.py - Source cache
legal_mcp/cache.py
Legal source access
- MCP client
legal_mcp/client.py - MCP server
legal_mcp/server.py - Source adapters
legal_mcp/adapters.py - HTTP transport
legal_mcp/transport.py
Access management
- Access Edge Function
supabase/functions/thaimcp-access/index.ts - Access database
supabase/migrations/202609280001_thaimcp_access.sql
Other components
- Researcher
- Administrator
- Official legal sources
- Supabase service
Connections 25
- Researcher → Research interface: submits research
README.md - Research interface → Local web bridge: sends request
README.md - Local web bridge → Local access checks: validates key
local_ai/web.py - Local web bridge → Research orchestrator: runs research
local_ai/web.py - Local web bridge → Local Qwen: checks readiness
local_ai/web.py - Administrator → Admin panel: manages keys
README.md - Admin panel → Access Edge Function: admin actions
README.md - Local access checks → Access Edge Function: verifies or consumes
legal_mcp/access.py - Access Edge Function → Access database: reads and updates
README.md - Access Edge Function → Supabase service: uses service role
README.md - Research orchestrator → Privacy masking: masks and filters
legal_mcp/orchestrator.py - Research orchestrator → Query planning: builds queries
legal_mcp/orchestrator.py - Research orchestrator → Local Qwen: requests analysis
legal_mcp/orchestrator.py - Research orchestrator → MCP client: calls tools
legal_mcp/orchestrator.py - Research orchestrator → Source cache: uses cache
legal_mcp/orchestrator.py - Research orchestrator → Evidence ranking: ranks and verifies
legal_mcp/orchestrator.py - Query planning → Local Qwen: uses plan types
legal_mcp/planning.py - Local Qwen → Query planning: uses fallback terms
local_ai/ollama.py - Evidence ranking → Query planning: uses matching
legal_mcp/evidence.py - MCP client → MCP server: starts session
legal_mcp/client.py - MCP server → Source adapters: registers tools
legal_mcp/server.py - MCP server → HTTP transport: configures lifespan
legal_mcp/server.py - Source adapters → HTTP transport: uses pooled clients
legal_mcp/adapters.py - Source adapters → Official legal sources: searches and fetches
legal_mcp/adapters.py - Evidence ranking → Research interface: returns cited results
README.md