Ollama MCP Example

v1.0.0Coding Agentsstable

Ollama MCP example for dummies.

mcpmcp-servermodel-context-protocolollamaollama-mcp
Share:
18
Stars
0
Downloads
0
Weekly
0/5

What is Ollama MCP Example?

Ollama MCP Example is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ollama mcp example for dummies.

Ollama MCP example for dummies.

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Ollama MCP example for dummies.

Use Cases

Run local LLM models with Ollama through MCP protocol.
kirillsaidov

Maintainer

LicenseUnlicense
Languagepython
Versionv1.0.0
UpdatedMay 16, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx ollama-mcp-example

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Ollama MCP Example

The Ollama MCP Example is a beginner-friendly reference implementation showing how to connect a local Ollama language model to the Model Context Protocol. It includes a minimal MCP server written in Python with sample tools, and a client that routes natural language queries through Ollama to invoke those tools. The project is designed as a learning template: you run Ollama locally, add your own tool functions with a decorator, and watch the local LLM decide when to call them.

Prerequisites

  • Python 3.8 or later installed
  • Ollama installed and running locally (https://ollama.com)
  • The qwen3:4b-instruct model pulled via 'ollama pull qwen3:4b-instruct'
  • Git to clone the repository
  • An MCP-compatible client or the included Python client script
1

Install Ollama and pull the required model

Download and install Ollama from https://ollama.com, then pull the model the example client is configured to use.

ollama pull qwen3:4b-instruct
2

Clone the repository

Clone the example repository to your local machine.

git clone https://github.com/kirillsaidov/ollama-mcp-example.git
cd ollama-mcp-example
3

Create a virtual environment and install dependencies

Set up an isolated Python environment and install the required packages from requirements.txt.

python3 -m venv venv
./venv/bin/pip install -r requirements.txt
4

Start the MCP server

Run the MCP server in one terminal. It exposes tools decorated with @mcp.tool() — by default, stock price lookup tools for Apple and Google.

./venv/bin/python mcp_server.py
5

Run the MCP client in a second terminal

The client connects to the running server and lets you chat with the local Ollama model, which can invoke the registered tools.

./venv/bin/python mcp_client.py
6

Add your own tools

Open mcp_server.py and add new Python functions decorated with @mcp.tool(). The Ollama model will automatically discover and call them based on the user's question.

Ollama MCP Example Examples

Client configuration

If integrating this server with an external MCP client that supports stdio servers, point it at the Python script inside your virtualenv.

{
  "mcpServers": {
    "ollama-example": {
      "command": "/path/to/ollama-mcp-example/venv/bin/python",
      "args": ["/path/to/ollama-mcp-example/mcp_server.py"]
    }
  }
}

Prompts to try

Example queries to type into the interactive client once both server and client are running.

- "What's Apple's current stock price?"
- "How much is Google trading for?"
- "Compare Apple and Google stock prices"
- "What tools do you have available?"

Troubleshooting Ollama MCP Example

Client fails to connect to the MCP server

Make sure mcp_server.py is running in a separate terminal before you start mcp_client.py. Both must use the same virtual environment.

Ollama model not found error

Run 'ollama pull qwen3:4b-instruct' to download the required model. If you want to use a different model, edit the model reference in mcp_client.py and ensure that model is pulled.

Tools are not being called by the model

Some Ollama models do not support tool/function calling. The qwen3:4b-instruct model is specifically tested with this example. If switching models, ensure the chosen model supports tool use.

Frequently Asked Questions about Ollama MCP Example

What is Ollama MCP Example?

Ollama MCP Example is a Model Context Protocol (MCP) server that ollama mcp example for dummies. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Ollama MCP Example?

Follow the installation instructions on the Ollama MCP Example GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Ollama MCP Example?

Ollama MCP Example works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Ollama MCP Example free to use?

Yes, Ollama MCP Example is open source and available under the Unlicense license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "ollama-mcp-example": { "command": "npx", "args": ["-y", "ollama-mcp-example"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Ollama MCP Example?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides