Skip to main content
Glama

ollama-mcp

MCP server for delegating coding tasks to local Ollama models.

Setup

cd ollama-mcp
npm install
npm run build

Related MCP server: mcp-coding

Tools

ollama_list_models

List available Ollama models.

ollama_execute_task

Delegate a coding task to an Ollama model. Returns output with change preview.

  • If changes are detected, requires_approval: true is returned

  • Review changes, then use ollama_write_files to apply

ollama_write_files

Write files from Ollama output. Use after reviewing changes.

ollama_preview_changes

Analyze text for file write markers and show change preview.

Tool Calling

Models that support tool calling (e.g., qwen3-coder-next, deepseek-r1:8b) use structured JSON tool calls for file writes. This is more reliable than text markers.

The write_file tool is automatically provided to the model:

{
  "type": "function",
  "function": {
    "name": "write_file",
    "description": "Write content to a file at the given path",
    "parameters": {
      "type": "object",
      "properties": {
        "path": { "type": "string" },
        "content": { "type": "string" }
      },
      "required": ["path", "content"]
    }
  }
}

If the model doesn't support tool calling, the server falls back to {file_write} text markers automatically.

Usage

OpenCode

Add to opencode.json:

{
  "mcp": {
    "ollama": {
      "type": "stdio",
      "command": "node",
      "args": ["./dist/index.js"]
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "ollama": {
      "command": "node",
      "args": ["/absolute/path/to/ollama-mcp/dist/index.js"]
    }
  }
}

Workflow

1. ollama_execute_task(task, model)  →  output + changes[]
   - Tool calling models: structured tool_calls
   - Non-tool models: text markers (fallback)
2. Review changes
3. ollama_write_files(output or tool_calls)  →  files written

Environment Variables

Variable

Default

Description

OLLAMA_HOST

http://localhost:11434

Ollama server address

OLLAMA_TIMEOUT_MS

120000

Request timeout in ms

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A universal MCP server that integrates with local Ollama instances, enabling AI-powered chat, model management, and text generation from any MCP-compatible IDE or application.
      6
      163 npm
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Experimental MCP server for local LLM orchestration with filesystem tools (read, write, list, delete files) and a CLI agent that communicates via Ollama.
      6 npm
      ISC