Calculator
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CalculatorWhat is 123 times 456?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AI Agent with MCP and Ollama: MCP Server for Calculator Application
Introduction
This project demonstrates how to build a simple AI Agent using Model Context Protocol (MCP) and Ollama. The application uses Ollama to run an LLM locally and MCP to connect the AI agent with calculator tools exposed by an MCP server.
An AI Agent is an application that can understand a user's request, determine what action is required, select an appropriate tool, execute that tool, and use the tool's result to generate a response.
Model Context Protocol (MCP) provides a standardized way for AI applications to discover and interact with external tools and services. In this project, the MCP server exposes calculator operations such as addition, subtraction, multiplication, and division.
Ollama runs the LLM locally and acts as the intelligence behind the agent. Based on the user's request, the LLM can select the appropriate calculator tool and provide the required arguments. The MCP client then invokes that tool on the MCP server and sends the result back to the LLM.
Project Flow
User
|
v
AI Agent / MCP Client
|
v
Ollama (Local LLM)
|
| Selects appropriate tool
v
MCP Client
|
| Tool call
v
MCP Server
|
+-- add
+-- subtract
+-- multiply
+-- divide
|
v
Tool Result
|
v
Ollama
|
v
Final AnswerThis project provides a basic understanding of how LLMs, AI Agents, MCP Clients, and MCP Servers work together to create tool-using AI applications.
Related MCP server: Math Operations MCP Server
1. Setup
Prerequisites
Install:
Python 3.10+
Ollama
Git (optional)
Create a virtual environment:
python -m venv venvActivate it:
.\venv\Scripts\Activate.ps1Install dependencies:
python -m pip install -r requirements.txt2. Ollama — Run LLM Locally
Ollama allows you to run open-source LLMs locally without requiring an external API.
Pull the model:
ollama pull qwen3:8bVerify the model:
ollama listYou can also run the model directly:
ollama run qwen3:8bThe Python application communicates with the locally running Ollama service.
3. Project Folder Structure
MCP_Calculator/
│
├── server.py
├── client.py
├── requirements.txt
├── README.md
└── venv/4. MCP Server
server.py creates the MCP server and exposes calculator operations as tools.
mcp = MCPServer("Calculator")Tools are registered using:
@mcp.tool()The server provides four tools:
add
subtract
multiply
divideFor example:
@mcp.tool()
def add(a: float, b: float) -> float:
return a + bThe MCP server is responsible for hosting and executing the tools.
5. MCP Client
client.py acts as the bridge between the Ollama LLM and the MCP server.
The client:
Starts the MCP server.
Establishes an MCP session.
Discovers available tools using
list_tools().Converts MCP tools into tools understood by Ollama.
Sends the user's question and available tools to Ollama.
Receives the selected tool and arguments from the LLM.
Calls the selected MCP tool.
Sends the tool result back to Ollama.
Displays the final answer.
The LLM does not directly execute the Python functions.
Instead:
Ollama / LLM
|
v
MCP Client
|
v
MCP Server
|
v
Calculator Tool6. Run the Application
Make sure Ollama is installed and the model is available:
ollama listThen run:
python client.pyEnter a question:
You: What is 10 + 30?The LLM can select:
addwith arguments:
a = 10
b = 30The MCP client calls:
add(10, 30)The MCP server returns:
40The result is sent back to Ollama, which generates the final response:
Assistant: 10 + 30 = 407. How It Works
User
|
v
MCP Client
|
v
Ollama
|
Tool Selection
|
v
MCP Client
|
stdio
|
v
MCP Server
|
+----------+----------+
| | |
add subtract multiply
|
divide
|
v
Result
|
v
Ollama
|
v
Final AnswerKey Concept
The main components have different responsibilities:
Ollama / LLM
↓
Understands the user's request
and selects an appropriate tool.
MCP Client
↓
Connects the LLM with MCP tools
and invokes the selected tool.
MCP Server
↓
Exposes and executes the actual tools.
Calculator Tools
↓
Perform the required calculation.Together, these components form a simple tool-using AI Agent architecture.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Tested financial & practical calculators as free, no-auth MCP tools for AI agents.
Precision math engine for AI agents. 203 exact methods. Zero hallucination.
MCPCalc gives agents access to a comprehensive library of calculators spanning finance, math, health, construction, engineering, food, automotive, and more. It includes a full Computer Algebra System (CAS) and a grid-based Spreadsheet calculator.
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides basic mathematical calculation functionality through MCP tools including arithmetic operations, exponentiation, and square root calculations. Features proper error handling for edge cases like division by zero and negative square roots.6532MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI applications to perform basic mathematical operations like addition and subtraction through MCP tools. Also provides REST API endpoints for the same operations.MIT
- AlicenseNot gradedqualityDmaintenanceProvides a comprehensive set of mathematical functions as MCP tools, enabling language models to perform calculations including arithmetic, trigonometry, logarithms, and more.231MIT
- FlicenseNot gradedqualityCmaintenanceProvides basic calculator operations (add, subtract, multiply, divide) as MCP tools for use with Claude Desktop and other MCP clients.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jyotibasm/AI-Agent-with-MCP-and-Ollama-MCP-Server-for-Calculator-Application-'
If you have feedback or need assistance with the MCP directory API, please join our Discord server