MCP + Ollama Local Tool Calling Example
@rajeevchandra
About MCP + Ollama Local Tool Calling Example
No overview available yet
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"mcp-client-server-example": {
"command": "python",
"args": [
"math_server.py"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is MCP + Ollama Local Tool Calling Example?
It is a demonstration project that shows how a local AI agent can understand user queries and automatically call Python functions using the Model Context Protocol (MCP), a local LLM via Ollama, and a Python MCP client and server.
How to use MCP + Ollama Local Tool Calling Example?
Install dependencies with pip install "mcp[cli] @ git+https://github.com/awslabs/mcp.git" openai==0.28 httpx, ensure Ollama is installed and running, pull a tool-calling‑capable model (e.g., ollama run llama3), run the MCP server (python math_server.py), then start the client with python ollama_client.py math_server.py. Finally, type queries like “What is 5 + 8?” and the system will respond with the computed result.
Key features of MCP + Ollama Local Tool Calling Example
- Uses MCP to describe tools for the LLM
- Runs a local LLM (e.g., Llama3) via Ollama
- Python functions (
add,multiply) become callable tools - Fully autonomous – no manual tool selection
- Everything runs offline and locally
Use cases of MCP + Ollama Local Tool Calling Example
- Building a local AI developer assistant that can perform calculations
- Creating secure, offline‑only AI workflows for sensitive data
- Prototyping autonomous agents that reason about and invoke functions
FAQ from MCP + Ollama Local Tool Calling Example
What does this project demonstrate?
It demonstrates how an LLM can automatically decide which Python function to call based on a user’s intent, using MCP to describe available tools and Ollama to run the model locally.
What are the runtime requirements?
You need Python, the mcp[cli], openai==0.28, and httpx packages, plus Ollama installed and running with a model that supports tool calling (e.g., Llama3).
Does the system require an internet connection?
No – everything runs locally. The LLM is served by Ollama on your machine, and the MCP components communicate over local transports.
Which tools are exposed by the MCP server?
The example server (math_server.py) exposes two tools: add(a: int, b: int) -> int and multiply(a: int, b: int) -> int.
Can I use a different LLM model?
Yes, as long as the model supports tool‑calling. The README suggests Llama3 via the ollama run llama3 command; you can replace it with any compatible Ollama model.
Frequently asked questions
What does this project demonstrate?
It demonstrates how an LLM can automatically decide which Python function to call based on a user’s intent, using MCP to describe available tools and Ollama to run the model locally.
What are the runtime requirements?
You need Python, the `mcp[cli]`, `openai==0.28`, and `httpx` packages, plus Ollama installed and running with a model that supports tool calling (e.g., Llama3).
Does the system require an internet connection?
No – everything runs locally. The LLM is served by Ollama on your machine, and the MCP components communicate over local transports.
Which tools are exposed by the MCP server?
The example server (`math_server.py`) exposes two tools: `add(a: int, b: int) -> int` and `multiply(a: int, b: int) -> int`.
Can I use a different LLM model?
Yes, as long as the model supports tool‑calling. The README suggests Llama3 via the `ollama run llama3` command; you can replace it with any compatible Ollama model.
Basic information
More AI & Agents MCP servers
Mcp Agent
lastmile-aiBuild effective agents using Model Context Protocol and simple workflow patterns
Open Multi-Agent Canvas
CopilotKitThe open-source multi-agent chat interface that lets you manage multiple agents in one dynamic conversation and add MCP servers for deep research

Plainpaper
PlainpaperThe AI marketing canvas for Claude and MCP agents. Your agent drafts campaigns as cards on a shared board, briefed by your brand rules, approved by you.

q-ring
I4cTimeQuantum-inspired keyring for AI coding agents. Secure secrets with superposition, entanglement, tunneling, and teleportation — CLI + 44 MCP tools.
欢迎来到 智言平台
Shy2593666979AgentChat 是一个基于 LLM 的智能体交流平台,内置默认 Agent 并支持用户自定义 Agent。通过多轮对话和任务协作,Agent 可以理解并协助完成复杂任务。项目集成 LangChain、Function Call、MCP 协议、RAG、Memory、HITL、Skill、Milvus 和 ElasticSearch 等技术,实现高效的知识检索与工具调用,使用 FastAPI 构建高性能后端服务。
Comments