Skip to main content
Glama

ollama-ssh-mcp

MCP server that gives an MCP client (Claude Code) access to an Ollama instance on another machine, where Ollama listens only on 127.0.0.1. It reaches it through an SSH local forward that the server manages itself.

  • The tunnel opens on the first tool call, on a random free local port, so it never collides with a hand-made -L 11434 forward.

  • If the ssh process dies (laptop suspend, Wi-Fi change), the next call reopens it. A connection error mid-request triggers one restart and retry.

  • The tunnel closes when the MCP server exits. Nothing runs while the server is unused, and the model unloads on Ollama's normal idle timer.

Tools

Tool

Purpose

chat

Prompt the model. Optional system, format ("json" or a JSON schema), temperature, think, model, and conversation (a named multi-turn history kept in memory for the server's lifetime).

models

List installed models and which are loaded on the GPU.

forget_conversation

Drop one named conversation, or all of them.

Related MCP server: MCP Ollama

Config

Env

Default

OLLAMA_SSH_TARGET

(required)

e.g. user@gpu-box.local; needs key-based, non-interactive SSH

OLLAMA_REMOTE_PORT

11434

Ollama port on the remote host

OLLAMA_MODEL

gemma4:e4b

default model

OLLAMA_NUM_CTX

16384

context window sent on every request; match other clients of the same model, since a different value forces a reload

Register with Claude Code

claude mcp add -s user ollama -e OLLAMA_SSH_TARGET=user@gpu-box.local \
  -- ~/.local/bin/uv run --project ~/Projects/ollama-ssh-mcp ollama-ssh-mcp

Pinned to mcp<2. The 2.x SDK renamed FastMCP to MCPServer.

Available Tools

3 tools
chatA

Send a prompt to the local model and return its reply.

Args: prompt: The user message. system: Optional system prompt. With conversation, only applied when the conversation starts. conversation: Optional name; prior turns under this name are sent as context and this turn is appended. Kept in memory for the life of this MCP server process. model: Ollama model name (default from OLLAMA_MODEL). format: "json", or a JSON schema object, to force structured output. think: Enable the model's thinking mode (slower; off by default). temperature: Sampling temperature; use 0 for extraction tasks.

Inputs: prompt (required), model, think, format, +3 more.

forget_conversationB

Drop a named conversation's history, or all of them if no name is given.

Inputs: conversation.

modelsB

List models installed on the remote Ollama and which are currently loaded in GPU memory.

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool maps to a clearly distinct action: chat runs inference, models lists installed/loaded models, and forget_conversation clears history. There is no plausible way to confuse one for another, even though chat and forget_conversation both touch conversation state (one appends, one deletes).

    Naming Consistency3/5

    Two tools use verb-style names (chat, forget_conversation) while models is a bare noun, and chat is a single generic verb rather than verb_noun. The names remain readable and reasonably predictable, but the convention is mixed rather than uniform.

    Tool Count4/5

    Three tools is a slim but well-scoped surface for a thin Ollama-over-SSH wrapper, and each tool earns its place: generate, enumerate models, reset context. It sits just below the ideal range but does not feel artificially padded or truncated.

    Completeness3/5

    Core chat workflow is covered, but there are notable gaps: no model management (pull/delete), no way to inspect or list existing conversations (only drop them), and no stop/stream control. Agents can work around these via the chat tool alone, but the surface is not full lifecycle coverage for the domain.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables seamless integration between Ollama's local LLM models and MCP-compatible applications, supporting model management and chat interactions.
      13
      817 npm
      180
      AGPL 3.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP-compatible clients to access local or cloud LLMs, manage and run models, generate completions and embeddings, chat with tool/function support, and use web search/fetch through Ollama Cloud.
      817 npm
      AGPL 3.0