Skip to main content
Glama
Ollama MCP Server
by ngc-shj

Ollama MCP Server

A bridge to use Ollama as an MCP server from Claude Code.

日本語版 README はこちら

Features

  • ollama_generate: Single-turn text generation (supports vision models with image input)

  • ollama_chat: Multi-turn chat conversations (supports vision models with image input)

  • ollama_list: List available models

  • ollama_show: Show model details

  • ollama_pull: Download models

  • ollama_embeddings: Generate text embeddings

Supported Vision Models

  • llava - General-purpose vision model

  • llama3.2-vision - Meta's multimodal model

  • deepseek-ocr - OCR-specialized vision model

Related MCP server: Ollama MCP Server

Prerequisites

  1. Ollama installed and running

    # Install Ollama (macOS)
    brew install ollama
    
    # Start Ollama server
    ollama serve
  2. At least one model downloaded

    ollama pull llama3.2

Installation

cd ollama-mcp-server
npm install
npm run build

Claude Code Configuration

# Add to local scope (current project)
claude mcp add --transport stdio ollama -- node /path/to/ollama-mcp-server/dist/index.js

# Add to user scope (all projects)
claude mcp add --transport stdio ollama --scope user -- node /path/to/ollama-mcp-server/dist/index.js

To add environment variables:

claude mcp add --transport stdio ollama \
  --env OLLAMA_BASE_URL=http://localhost:11434 \
  -- node /path/to/ollama-mcp-server/dist/index.js

Method 2: Manual Configuration

Project scope (.mcp.json in project root):

{
  "mcpServers": {
    "ollama": {
      "command": "node",
      "args": ["/path/to/ollama-mcp-server/dist/index.js"],
      "env": {
        "OLLAMA_BASE_URL": "http://localhost:11434"
      }
    }
  }
}

User scope (~/.claude.json):

{
  "mcpServers": {
    "ollama": {
      "command": "node",
      "args": ["/path/to/ollama-mcp-server/dist/index.js"],
      "env": {
        "OLLAMA_BASE_URL": "http://localhost:11434"
      }
    }
  }
}

Verify Installation

# List configured MCP servers
claude mcp list

# Inside Claude Code
/mcp

Auto-approve Tool Calls (Optional)

By default, Claude Code asks for confirmation each time an Ollama tool is called. To skip confirmations, add the following to ~/.claude/settings.json:

{
  "permissions": {
    "allow": [
      "mcp__ollama__ollama_generate",
      "mcp__ollama__ollama_chat",
      "mcp__ollama__ollama_list",
      "mcp__ollama__ollama_show",
      "mcp__ollama__ollama_pull",
      "mcp__ollama__ollama_embeddings"
    ]
  }
}

Environment Variables

Variable

Default

Description

OLLAMA_BASE_URL

http://localhost:11434

Ollama server URL

Usage Examples

From Claude Code:

List Models

List available Ollama models

Text Generation

Generate "3 features of Rust" using Ollama's llama3.2 model

Chat

I'd like to have Ollama do a code review

Vision / Image Analysis

Analyze this image using llava: /path/to/image.jpg
Use deepseek-ocr to extract text from this document: /path/to/document.png

Troubleshooting

Cannot connect to Ollama

# Check if Ollama is running
curl http://localhost:11434/api/tags

# If not running
ollama serve

No models available

ollama pull llama3.2

MCP server not showing up

# Verify server is registered
claude mcp list

# Check server health
claude mcp get ollama

License

MIT

Available Tools

6 tools
ollama_chatC

Have a multi-turn chat conversation with an Ollama model. Supports vision models (llava, llama3.2-vision, deepseek-ocr) with image input.

Inputs: model (required), messages (required), temperature.

ollama_embeddingsC

Generate embeddings for text using an Ollama model.

Inputs: input (required), model (required).

ollama_generateB

Generate text using an Ollama model. Use this for single-turn text generation. Supports vision models (llava, llama3.2-vision, deepseek-ocr) with image input.

Inputs: model (required), prompt (required), images, system, +2 more.

ollama_listA

List all locally available Ollama models.

Inputs: no named parameters.

ollama_pullB

Pull (download) a model from the Ollama library.

Inputs: model (required).

ollama_showC

Show detailed information about a specific model.

Inputs: model (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool maps to a distinct Ollama operation: single-turn generation vs multi-turn chat, model listing vs model detail inspection, downloading, and embeddings. The generate/chat distinction is explicitly spelled out in the descriptions, eliminating the main plausible source of confusion.

    Naming Consistency5/5

    All six tools follow a strict `ollama_<verb>` snake_case pattern (generate, chat, list, show, pull, embeddings). No mixed conventions or stylistic outliers.

    Tool Count5/5

    Six tools is well-scoped for an Ollama client: each covers a core operation and none feels redundant or padded. Nothing obvious is missing from the set that would warrant adding more tools for basic use.

    Completeness4/5

    Core lifecycle is covered: discovery (list, show), acquisition (pull), inference (generate, chat), and embeddings. However, there is no model removal/delete operation (ollama rm) or way to inspect running models (ps), leaving a minor but real dead end for cleanup workflows.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      Enables Claude to delegate coding tasks to local Ollama models, reducing API token usage by up to 98.75% while leveraging local compute resources. Supports code generation, review, refactoring, and file analysis with Claude providing oversight and quality assurance.
      11
      27
      AGPL 3.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Exposes local Ollama instances as tools for Claude Code, allowing users to offload code generation, text drafting, and embedding tasks to local GPUs. It supports multi-turn conversations and model management through the Model Context Protocol.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables Claude Code to offload routine code generation and text processing tasks to a local Ollama LLM, saving Cloud API tokens and costs with automatic model selection and security features.
      11
      204 npm
      3
      Apache 2.0