Ollama MCP server

Integrates Ollama's local LLM models with MCP-compatible applications, enabling on-premise AI processing and custom model deployment while maintaining data control.
Back to servers
Setup instructions
Provider
tigreen
Release date
Feb 13, 2025
Language
TypeScript
Package
Stats
3.3K downloads
111 stars

This MCP server enables direct integration between Ollama (for local LLM access) and MCP-compatible applications like Claude Desktop and Cline, giving AI assistants the ability to use local language models through a simple protocol.

Installation

Adding to Claude Desktop

Add the following to your Claude Desktop configuration file (located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

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

Global Installation

You can install the package globally using npm:

npm install -g ollama-mcp

Setting Up for Cline (VS Code)

Add this to your Cline MCP settings file (cline_mcp_settings.json):

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

Available Tools

Model Management

Tool Description
ollama_list List all available local models
ollama_show Get detailed information about a specific model
ollama_pull Download models from Ollama library
ollama_push Push models to Ollama library
ollama_copy Create a copy of an existing model
ollama_delete Remove models from local storage
ollama_create Create custom models from Modelfile

Model Operations

Tool Description
ollama_ps List currently running models
ollama_generate Generate text completions
ollama_chat Interactive chat with models (supports tools/functions)
ollama_embed Generate embeddings for text

Web Tools (Ollama Cloud)

Tool Description
ollama_web_search Search the web with customizable result limits (requires API key)
ollama_web_fetch Fetch and parse web page content (requires API key)

Configuration

Environment Variables

Variable Default Description
OLLAMA_HOST http://127.0.0.1:11434 Ollama server endpoint
OLLAMA_API_KEY - API key for Ollama Cloud features

Custom Ollama Host

To specify a custom Ollama host:

{
  "mcpServers": {
    "ollama": {
      "command": "npx",
      "args": ["-y", "ollama-mcp"],
      "env": {
        "OLLAMA_HOST": "http://localhost:11434"
      }
    }
  }
}

Ollama Cloud Configuration

To use Ollama's cloud platform with web search capabilities:

{
  "mcpServers": {
    "ollama": {
      "command": "npx",
      "args": ["-y", "ollama-mcp"],
      "env": {
        "OLLAMA_HOST": "https://ollama.com",
        "OLLAMA_API_KEY": "your-ollama-cloud-api-key"
      }
    }
  }
}

Hybrid Mode (Local + Cloud)

You can use both local and cloud models with this configuration:

{
  "mcpServers": {
    "ollama": {
      "command": "npx",
      "args": ["-y", "ollama-mcp"],
      "env": {
        "OLLAMA_HOST": "http://127.0.0.1:11434",
        "OLLAMA_API_KEY": "your-ollama-cloud-api-key"
      }
    }
  }
}

This enables:

  • Running local models from your Ollama instance
  • Using cloud-only web search and fetch tools
  • Getting the best of both worlds: privacy and web connectivity

Usage Examples

Chat with a Model

// MCP clients can invoke:
{
  "tool": "ollama_chat",
  "arguments": {
    "model": "llama3.2:latest",
    "messages": [
      { "role": "user", "content": "Explain quantum computing" }
    ]
  }
}

Generate Embeddings

{
  "tool": "ollama_embed",
  "arguments": {
    "model": "nomic-embed-text",
    "input": ["Hello world", "Embeddings are great"]
  }
}

Web Search

{
  "tool": "ollama_web_search",
  "arguments": {
    "query": "latest AI developments",
    "max_results": 5
  }
}

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "rawveg-ollama-mcp" '{"command":"npx","args":["-y","@rawveg/ollama-mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "@rawveg/ollama-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@rawveg/ollama-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "@rawveg/ollama-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@rawveg/ollama-mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later