# modesi/publicreponistproject architecture

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

- Interactive diagram: https://gitdiagram.com/modesi/publicreponistproject
- Repository: https://github.com/modesi/publicreponistproject

## Overview

This repository is a collection of LLM client examples and related chat, agent, and MCP integrations rather than one unified application. The simplest user workflow sends text or image input to a configured model and prints its response. The richer MCP workflow uses a chat interface to obtain tool choices, call server tools, and return results to the model for a final answer. Other branches include a file-reading agent and an OpenAI-compatible API proxy. Some server implementations are unsampled, so only documented or directly evidenced relationships are shown.

Main entry points: [`resources/mcp_client/main.py`](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/main.py) (CLI Chat), [`resources/mcp_client/app.py`](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/app.py) (Chat UI), [`resources/mcp_client/chatbot.py`](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/chatbot.py) (Chat Loop), [`resources/mcp_server`](https://github.com/modesi/publicreponistproject/tree/main/resources/mcp_server) (MCP Tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_examples["LLM Examples"]
  node_text_example["Text Query<br/>[example_text.py]"]
  node_image_example["Image Query<br/>[example_image.py]"]
end

subgraph group_mcp["MCP Chat"]
  node_chat_ui["Chat UI<br/>[app.py]"]
  node_chat_loop["Chat Loop<br/>[chatbot.py]"]
  node_tool_formatting["Tool Formatting<br/>[llm_utils.py]"]
  node_cli_chat["CLI Chat<br/>[main.py]"]
  node_mcp_client["MCP Client<br/>[client.py]"]
  node_client_config["Client Config<br/>[config.py]"]
end

subgraph group_agents["Agent Demo"]
  node_agent["File Agent<br/>[agent_demo.py]"]
  node_agent_files["Sample Files"]
  node_agent_mcp["MCP File Agent<br/>[agent_demo_v2.py]"]
end

subgraph group_services["API And Tools"]
  node_mcp_tools["MCP Tools"]
  node_ontology_server["Ontology Server<br/>[ontology-server.py]"]
  node_calculator_server["Calculator Server<br/>[calculator.py]"]
  node_api_proxy["OpenAI-Compatible Proxy<br/>[openai.py]"]
end

node_user(("User"))
node_llm_api{{"LLM API"}}
node_mcp_http{{"MCP Service"}}

node_user -->|"enters prompt"| node_text_example
node_text_example -->|"sends text"| node_llm_api
node_llm_api -->|"returns response"| node_text_example
node_user -->|"asks about image"| node_image_example
node_image_example -->|"sends image query"| node_llm_api
node_llm_api -->|"returns response"| node_image_example
node_user -->|"enters message"| node_chat_ui
node_chat_ui -->|"processes turn"| node_chat_loop
node_chat_loop -->|"requests LLM response"| node_tool_formatting
node_chat_loop -->|"calls tools"| node_mcp_tools
node_chat_ui -->|"loads settings"| node_client_config
node_chat_ui -->|"requests completion"| node_llm_api
node_cli_chat -->|"processes turns"| node_chat_loop
node_cli_chat -->|"formats tools"| node_tool_formatting
node_cli_chat -->|"calls tools"| node_mcp_tools
node_cli_chat -->|"loads settings"| node_client_config
node_mcp_client -->|"reads settings"| node_client_config
node_mcp_client -->|"calls tools"| node_mcp_tools
node_user -->|"submits query"| node_agent
node_agent -->|"runs model"| node_llm_api
node_agent -->|"lists and reads"| node_agent_files
node_user -->|"submits query"| node_agent_mcp
node_agent_mcp -->|"runs model"| node_llm_api
node_agent_mcp -->|"connects to"| node_mcp_http
node_mcp_http -.->|"serves tools"| node_mcp_tools

click node_text_example "https://github.com/modesi/publicreponistproject/blob/main/example_text.py"
click node_image_example "https://github.com/modesi/publicreponistproject/blob/main/example_image.py"
click node_chat_ui "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/app.py"
click node_chat_loop "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/chatbot.py"
click node_tool_formatting "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/llm_utils.py"
click node_cli_chat "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/main.py"
click node_mcp_client "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/client.py"
click node_client_config "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/config.py"
click node_mcp_tools "https://github.com/modesi/publicreponistproject/tree/main/resources/mcp_server"
click node_ontology_server "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_server/ontology-server.py"
click node_calculator_server "https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_server/calculator.py"
click node_agent "https://github.com/modesi/publicreponistproject/blob/main/resources/agent_demo/agent_demo.py"
click node_agent_files "https://github.com/modesi/publicreponistproject/tree/main/resources/agent_demo/sample_directory"
click node_agent_mcp "https://github.com/modesi/publicreponistproject/blob/main/resources/agent_demo/agent_demo_v2.py"
click node_api_proxy "https://github.com/modesi/publicreponistproject/blob/main/rag_execution/openai.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_text_example,node_image_example,node_user toneBlue
class node_chat_ui,node_chat_loop,node_tool_formatting,node_cli_chat,node_mcp_client,node_client_config toneAmber
class node_agent,node_agent_files,node_agent_mcp,node_llm_api toneMint
class node_mcp_tools,node_ontology_server,node_calculator_server,node_api_proxy toneRose
class node_mcp_http toneIndigo
```

## Components

### LLM Examples

- [Text Query](https://github.com/modesi/publicreponistproject/blob/main/example_text.py): `example_text.py`
- [Image Query](https://github.com/modesi/publicreponistproject/blob/main/example_image.py): `example_image.py`

### MCP Chat

- [Chat UI](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/app.py): `resources/mcp_client/app.py`
- [Chat Loop](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/chatbot.py): `resources/mcp_client/chatbot.py`
- [Tool Formatting](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/llm_utils.py): `resources/mcp_client/llm_utils.py`
- [CLI Chat](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/main.py): `resources/mcp_client/main.py`
- [MCP Client](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/client.py): `resources/mcp_client/client.py`
- [Client Config](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_client/config.py): `resources/mcp_client/config.py`

### Agent Demo

- [File Agent](https://github.com/modesi/publicreponistproject/blob/main/resources/agent_demo/agent_demo.py): `resources/agent_demo/agent_demo.py`
- [Sample Files](https://github.com/modesi/publicreponistproject/tree/main/resources/agent_demo/sample_directory): `resources/agent_demo/sample_directory`
- [MCP File Agent](https://github.com/modesi/publicreponistproject/blob/main/resources/agent_demo/agent_demo_v2.py): `resources/agent_demo/agent_demo_v2.py`

### API And Tools

- [MCP Tools](https://github.com/modesi/publicreponistproject/tree/main/resources/mcp_server): `resources/mcp_server`
- [Ontology Server](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_server/ontology-server.py): `resources/mcp_server/ontology-server.py`
- [Calculator Server](https://github.com/modesi/publicreponistproject/blob/main/resources/mcp_server/calculator.py): `resources/mcp_server/calculator.py`
- [OpenAI-Compatible Proxy](https://github.com/modesi/publicreponistproject/blob/main/rag_execution/openai.py): `rag_execution/openai.py`

### Other components

- **User**
- **LLM API**
- **MCP Service**

## Connections

- User → Text Query: enters prompt (evidence: `example_text.py`)
- Text Query → LLM API: sends text (evidence: `example_text.py`)
- LLM API → Text Query: returns response (evidence: `example_text.py`)
- User → Image Query: asks about image (evidence: `example_image.py`)
- Image Query → LLM API: sends image query (evidence: `example_image.py`)
- LLM API → Image Query: returns response (evidence: `example_image.py`)
- User → Chat UI: enters message (evidence: `resources/mcp_client/app.py`)
- Chat UI → Chat Loop: processes turn (evidence: `resources/mcp_client/app.py`)
- Chat Loop → Tool Formatting: requests LLM response (evidence: `resources/mcp_client/chatbot.py`)
- Chat Loop → MCP Tools: calls tools (evidence: `resources/mcp_client/chatbot.py`)
- Chat UI → Client Config: loads settings (evidence: `resources/mcp_client/app.py`)
- Chat UI → LLM API: requests completion (evidence: `resources/mcp_client/app.py`)
- CLI Chat → Chat Loop: processes turns (evidence: `resources/mcp_client/main.py`)
- CLI Chat → Tool Formatting: formats tools (evidence: `resources/mcp_client/main.py`)
- CLI Chat → MCP Tools: calls tools (evidence: `resources/mcp_client/main.py`)
- CLI Chat → Client Config: loads settings (evidence: `resources/mcp_client/main.py`)
- MCP Client → Client Config: reads settings (evidence: `resources/mcp_client/client.py`)
- MCP Client → MCP Tools: calls tools (evidence: `resources/mcp_client/client.py`)
- User → File Agent: submits query (evidence: `resources/agent_demo/agent_demo.py`)
- File Agent → LLM API: runs model (evidence: `resources/agent_demo/agent_demo.py`)
- File Agent → Sample Files: lists and reads (evidence: `resources/agent_demo/agent_demo.py`)
- User → MCP File Agent: submits query (evidence: `resources/agent_demo/agent_demo_v2.py`)
- MCP File Agent → LLM API: runs model (evidence: `resources/agent_demo/agent_demo_v2.py`)
- MCP File Agent → MCP Service: connects to (evidence: `resources/agent_demo/agent_demo_v2.py`)
- MCP Service → MCP Tools: serves tools
