# tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm architecture

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

- Interactive diagram: https://gitdiagram.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm
- Repository: https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm

## Overview

This is a chat-based calculator that uses a local Ollama model to translate natural-language math into expressions, then routes calculations through an MCP server to the real Windows Calculator. The client also supports direct calculation, button presses, angle-mode changes, and ordinary chat. The server parses and sequences calculator operations, automates the UI, and verifies results. The README documents fallback to the evaluate tool if UI automation fails; omitted server sections limit detail about that fallback’s implementation.

Main entry points: [`client.py`](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/client.py) (Chat client), [`calc_server.py`](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py) (MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_client["Chat client<br/>[client.py]"]
end

subgraph group_server["MCP calculator server"]
  node_mcp["MCP server<br/>[calc_server.py]"]
  node_expression["Expression handling<br/>[calc_server.py]"]
  node_sequence["Button sequencing<br/>[calc_server.py]"]
  node_verification["Result verification<br/>[calc_server.py]"]
end

subgraph group_automation["Calculator automation"]
  node_ui["Windows UI automation<br/>[calc_server.py]"]
end

node_user(("User"))
node_ollama["Local Ollama"]
node_calculator["Windows Calculator"]

node_user -->|"enters requests"| node_client
node_client -->|"requests translation or chat"| node_ollama
node_ollama -->|"returns response"| node_client
node_client -->|"launches over stdio"| node_mcp
node_client -->|"calls calculator tools"| node_mcp
node_mcp -->|"handles expressions"| node_expression
node_expression -->|"compiles operations"| node_sequence
node_sequence -->|"drives operations"| node_ui
node_ui -->|"automates UI"| node_calculator
node_calculator -->|"provides display result"| node_verification
node_verification -->|"returns checked result"| node_mcp
node_mcp -->|"returns tool result"| node_client
node_ui -->|"opens scientific mode"| node_calculator

click node_client "https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/client.py"
click node_mcp "https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py"
click node_expression "https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py"
click node_sequence "https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py"
click node_verification "https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py"
click node_ui "https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_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_client,node_user toneBlue
class node_mcp,node_expression,node_sequence,node_verification toneAmber
class node_ui toneMint
class node_ollama,node_calculator toneIndigo
```

## Components

### Chat client

- [Chat client](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/client.py): `client.py`

### MCP calculator server

- [MCP server](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py): `calc_server.py`
- [Expression handling](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py): `calc_server.py`
- [Button sequencing](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py): `calc_server.py`
- [Result verification](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py): `calc_server.py`

### Calculator automation

- [Windows UI automation](https://github.com/tejasrinathreddysoma-beep/mcp_calls_calc_and_fetch_using_llm/blob/main/calc_server.py): `calc_server.py`

### Other components

- **User**
- **Local Ollama**
- **Windows Calculator**

## Connections

- User → Chat client: enters requests (evidence: `README.md`)
- Chat client → Local Ollama: requests translation or chat (evidence: `client.py`)
- Local Ollama → Chat client: returns response (evidence: `client.py`)
- Chat client → MCP server: launches over stdio (evidence: `client.py`)
- Chat client → MCP server: calls calculator tools (evidence: `client.py`)
- MCP server → Expression handling: handles expressions (evidence: `calc_server.py`)
- Expression handling → Button sequencing: compiles operations (evidence: `calc_server.py`)
- Button sequencing → Windows UI automation: drives operations (evidence: `calc_server.py`)
- Windows UI automation → Windows Calculator: automates UI (evidence: `README.md`)
- Windows Calculator → Result verification: provides display result (evidence: `README.md`)
- Result verification → MCP server: returns checked result (evidence: `calc_server.py`)
- MCP server → Chat client: returns tool result (evidence: `client.py`)
- Windows UI automation → Windows Calculator: opens scientific mode (evidence: `README.md`)
