Ollama Agent

v1.0.0Coding Agentsstable

A TypeScript example showcasing the integration of Ollama with the Model Context Protocol (MCP) servers. This project provides an interactive command-line interface for an AI agent that can utilize the tools from multiple MCP Servers..

agentmcp-agentmcp-clientmcp-serverollama
Share:
29
Stars
0
Downloads
0
Weekly
0/5

What is Ollama Agent?

Ollama Agent is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to typescript example showcasing the integration of ollama with the model context protocol (mcp) servers. this project provides an interactive command-line interface for an ai agent that can utilize the ...

A TypeScript example showcasing the integration of Ollama with the Model Context Protocol (MCP) servers. This project provides an interactive command-line interface for an AI agent that can utilize the tools from multiple MCP Servers..

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

Features

  • A TypeScript example showcasing the integration of Ollama wi

Use Cases

Build interactive AI agents that use Ollama with MCP servers.
Combine multiple MCP server tools in unified agent workflows.
Create command-line agents for testing and integration.
ausboss

Maintainer

LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedFeb 24, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-ollama-agent

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 Agent

MCP Ollama Agent is a TypeScript reference implementation that demonstrates how to build an interactive command-line AI agent using Ollama as the LLM backend alongside one or more MCP servers for tool access. It reads server configuration from an mcp-config.json file (similar to claude_desktop_config.json), connects to any MCP-compatible servers at startup, and gives the local Ollama model access to all discovered tools — enabling a fully local, private AI agent that can perform filesystem operations, web research, or any other capability exposed by the connected MCP servers.

Prerequisites

  • Node.js 18 or higher
  • Ollama installed and running locally (https://ollama.com) with a tool-capable model such as qwen2.5 or llama3.1
  • At least one MCP server installed (e.g., @modelcontextprotocol/server-filesystem or @mzxrai/mcp-webresearch)
  • Git to clone the repository
1

Clone the repository

Clone the mcp-ollama-agent repository to your local machine.

git clone https://github.com/ausboss/mcp-ollama-agent.git
cd mcp-ollama-agent
2

Install dependencies

Install the required npm packages.

npm install
3

Install MCP server packages you want to use

Install the MCP servers your agent will have access to. The example uses filesystem and web research servers.

npm install -g @modelcontextprotocol/server-filesystem
npm install -g @mzxrai/mcp-webresearch
4

Configure mcp-config.json

Edit mcp-config.json to specify which MCP servers to connect to and which Ollama model to use. The model must support function/tool calling.

5

Pull the Ollama model

Pull a tool-capable model in Ollama. qwen2.5 is confirmed to work well with MCP tool calls.

ollama pull qwen2.5:latest
6

Start the agent

Run the interactive chat interface. The agent will connect to configured MCP servers and make their tools available to the Ollama model.

npm start

Ollama Agent Examples

Client configuration

mcp-config.json example configuring two MCP servers (filesystem and web research) and the Ollama model. Place this file in the project root.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-filesystem", "./"]
    },
    "webresearch": {
      "command": "npx",
      "args": ["-y", "@mzxrai/mcp-webresearch"]
    }
  },
  "ollama": {
    "host": "http://localhost:11434",
    "model": "qwen2.5:latest"
  }
}

Prompts to try

Example interactive chat prompts for the mcp-ollama-agent once the CLI is running with filesystem and web research MCP servers.

- "Use your list directory tool to see what's in the test-directory folder"
- "Read the file at test-directory/test.txt and tell me what it says"
- "Search the web for the latest release notes for Node.js 22"
- "List all .json files in the current directory"
- "Run the demo mode to test filesystem and web tools without the LLM: npx tsx ./src/demo.ts"

Troubleshooting Ollama Agent

The Ollama model does not use tools and just responds conversationally

Only models with native function/tool calling support work correctly. Use qwen2.5:latest or llama3.1 — verify the model supports tools at https://ollama.com/library. You can also customize the system prompt in ChatManager.ts to guide the model to use tools more aggressively.

MCP server fails to connect on startup with ENOENT or command not found

The MCP server commands in mcp-config.json (e.g., npx @modelcontextprotocol/server-filesystem) must be resolvable from the current shell environment. Install the packages globally first (npm install -g ...) or use absolute paths for command entries.

Ollama returns connection refused errors

Ensure Ollama is running before starting the agent: run ollama serve in a separate terminal, or start the Ollama desktop app. Verify the host in mcp-config.json matches where Ollama is listening (default: http://localhost:11434).

Frequently Asked Questions about Ollama Agent

What is Ollama Agent?

Ollama Agent is a Model Context Protocol (MCP) server that typescript example showcasing the integration of ollama with the model context protocol (mcp) servers. this project provides an interactive command-line interface for an ai agent that can utilize the tools from multiple mcp servers.. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Ollama Agent?

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

Which AI clients work with Ollama Agent?

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

Is Ollama Agent free to use?

Yes, Ollama Agent is open source and available under the MIT 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": { "mcp-ollama-agent": { "command": "npx", "args": ["-y", "mcp-ollama-agent"] } } }

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

Read the full setup guide →

Ready to use Ollama Agent?

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