# pratikchetry/agentic-ai-client-server-system architecture

> Architecture diagram of the GitHub repository pratikchetry/agentic-ai-client-server-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pratikchetry/agentic-ai-client-server-system
- Repository: https://github.com/pratikchetry/agentic-ai-client-server-system

## Overview

Nexus takes terminal input through the CLI, enriches it with mentioned documents or server-side slash prompts, then runs an LLM tool-use loop over MCP. Tools are dispatched to the server and results return to the model before the final response is displayed. The document server exposes tools, resources, and formatting prompts; README also documents a summarize prompt, though its implementation is not shown. Edges are based on the excerpts and README; server capability links reflect documented MCP behavior.

Main entry points: [`main.py`](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/main.py) (Application setup), [`mcp_server.py`](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py) (MCP document server), [`core/cli_chat.py`](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/cli_chat.py) (CLI chat logic), [`mcp_client.py`](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_client.py) (MCP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Terminal interface"]
  node_cli["Prompt UI<br/>[cli.py]"]
  node_entry["Application setup<br/>[main.py]"]
end

subgraph group_conversation["Chat orchestration"]
  node_cli_chat["CLI chat logic<br/>[cli_chat.py]"]
  node_chat["Agent loop<br/>[chat.py]"]
  node_tools["Tool dispatch<br/>[tools.py]"]
end

subgraph group_model["Model integration"]
  node_adapter["Groq adapter<br/>[claude.py]"]
end

subgraph group_mcp["MCP document services"]
  node_client["MCP client<br/>[mcp_client.py]"]
  node_server["MCP document server<br/>[mcp_server.py]"]
  node_doc_store[("In-memory documents<br/>[mcp_server.py]")]
  node_doc_tools["Read and edit tools<br/>[mcp_server.py]"]
  node_resources["Document resources<br/>[mcp_server.py]"]
  node_prompts["Format and summarize prompts<br/>[mcp_server.py]"]
end

node_user(("Terminal user"))
node_groq{{"Groq API"}}

node_user -->|"enters query"| node_cli
node_entry -->|"starts UI"| node_cli
node_entry -->|"opens session"| node_client
node_entry -->|"configures model"| node_adapter
node_entry -->|"constructs chat"| node_cli_chat
node_cli -->|"submits query"| node_cli_chat
node_cli_chat -->|"delegates run"| node_chat
node_cli_chat -->|"reads docs and prompts"| node_client
node_chat -->|"requests completion"| node_adapter
node_adapter -->|"calls completion API"| node_groq
node_chat -->|"executes tool requests"| node_tools
node_tools -->|"lists and calls tools"| node_client
node_client -->|"stdio protocol"| node_server
node_server -->|"registers tools"| node_doc_tools
node_server -->|"registers resources"| node_resources
node_server -->|"registers prompts"| node_prompts
node_doc_tools -->|"reads and edits"| node_doc_store
node_resources -->|"lists and fetches"| node_doc_store
node_prompts -->|"directs edit tool use"| node_doc_tools
node_prompts -.->|"uses document identifier"| node_doc_store

click node_cli "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/cli.py"
click node_entry "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/main.py"
click node_cli_chat "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/cli_chat.py"
click node_chat "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/chat.py"
click node_tools "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/tools.py"
click node_adapter "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/claude.py"
click node_client "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_client.py"
click node_server "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py"
click node_doc_store "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py"
click node_doc_tools "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py"
click node_resources "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py"
click node_prompts "https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.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_cli,node_entry,node_user toneBlue
class node_cli_chat,node_chat,node_tools toneAmber
class node_adapter,node_groq toneMint
class node_client,node_server,node_doc_store,node_doc_tools,node_resources,node_prompts toneRose
```

## Components

### Terminal interface

- [Prompt UI](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/cli.py): `core/cli.py`
- [Application setup](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/main.py): `main.py`

### Chat orchestration

- [CLI chat logic](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/cli_chat.py): `core/cli_chat.py`
- [Agent loop](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/chat.py): `core/chat.py`
- [Tool dispatch](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/tools.py): `core/tools.py`

### Model integration

- [Groq adapter](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/core/claude.py): `core/claude.py`

### MCP document services

- [MCP client](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_client.py): `mcp_client.py`
- [MCP document server](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py): `mcp_server.py`
- [In-memory documents](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py): `mcp_server.py`
- [Read and edit tools](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py): `mcp_server.py`
- [Document resources](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py): `mcp_server.py`
- [Format and summarize prompts](https://github.com/pratikchetry/agentic-ai-client-server-system/blob/main/mcp_server.py): `mcp_server.py`

### Other components

- **Terminal user**
- **Groq API**

## Connections

- Terminal user → Prompt UI: enters query (evidence: `README.md`)
- Application setup → Prompt UI: starts UI (evidence: `main.py`)
- Application setup → MCP client: opens session (evidence: `main.py`)
- Application setup → Groq adapter: configures model (evidence: `main.py`)
- Application setup → CLI chat logic: constructs chat (evidence: `main.py`)
- Prompt UI → CLI chat logic: submits query (evidence: `core/cli.py`)
- CLI chat logic → Agent loop: delegates run (evidence: `core/cli_chat.py`)
- CLI chat logic → MCP client: reads docs and prompts (evidence: `core/cli_chat.py`)
- Agent loop → Groq adapter: requests completion (evidence: `core/chat.py`)
- Groq adapter → Groq API: calls completion API (evidence: `core/claude.py`)
- Agent loop → Tool dispatch: executes tool requests (evidence: `core/chat.py`)
- Tool dispatch → MCP client: lists and calls tools (evidence: `core/tools.py`)
- MCP client → MCP document server: stdio protocol (evidence: `README.md`)
- MCP document server → Read and edit tools: registers tools (evidence: `mcp_server.py`)
- MCP document server → Document resources: registers resources (evidence: `mcp_server.py`)
- MCP document server → Format and summarize prompts: registers prompts (evidence: `mcp_server.py`)
- Read and edit tools → In-memory documents: reads and edits (evidence: `mcp_server.py`)
- Document resources → In-memory documents: lists and fetches (evidence: `mcp_server.py`)
- Format and summarize prompts → Read and edit tools: directs edit tool use (evidence: `mcp_server.py`)
- Format and summarize prompts → In-memory documents: uses document identifier (evidence: `mcp_server.py`)
