Skip to main content
Glama
claude-ollama-mcp

claude-ollama-mcp

by LukeLamb

Claude Ollama

让 Claude Desktop 可以查询和管理本地 Ollama 服务器。无需打开终端,即可列出已安装的模型、检查模型详情、针对任何本地模型运行一次性 generate/chat 补全,或从注册表中拉取/删除模型。

典型用途:将 Claude 的回答与本地模型针对同一提示词的回答进行比较、针对量化模型运行低成本的批量补全,或检查您导入到 Ollama 中的自定义训练检查点模型。

要求

  • 正在运行的 Ollama 服务器(ollama serve 或 Ollama 应用程序)。

  • 默认端点为 http://localhost:11434。如果您在不同的主机或端口上运行 Ollama,请通过 Claude Desktop 扩展设置中的 ollama_url 用户配置进行覆盖。

  • 无 npm 依赖——纯 Node 通过 HTTP API 实现。

Related MCP server: Ollama MCP Server

安装 (Claude Desktop)

  1. 从 Releases 页面下载最新的 Ollama.mcpb。

  2. 在 Claude Desktop 中:设置 → 扩展 → 扩展开发者 → 安装扩展 → 选择 .mcpb 文件。

  3. (可选) 在扩展设置中,如果您在非默认主机/端口上运行 Ollama,请设置 Ollama server URL。如果使用 http://localhost:11434,请留空。

工具

工具

注解

用途

ollama_status

只读

健康检查 + 服务器版本

list_models

只读

本地模型(包含大小、摘要、系列、参数量、量化信息)

list_running

只读

当前加载在显存 (VRAM) 中的模型

show_model

只读

模型详情:模型文件、参数、模板、能力

generate

开放世界

一次性文本补全(非流式)

chat

开放世界

带有消息历史的聊天补全(非流式)

pull_model

开放世界

从注册表下载模型

delete_model

破坏性

删除本地安装的模型

提示词示例

“我安装了哪些本地模型,目前哪个模型加载在显存中?”

“使用 forge:b6c1 运行此提示词:''。将输出结果与你自己的回答进行比较。”

“向我展示 forge:b7c1 的模型文件 (modelfile) —— 我想检查一下温度设置。”

“拉取 llama3.1:70b。” (对于大型模型,请耐心等待)

“删除 forge:b5c3 模型 —— 我不再需要那个检查点了。”

隐私政策

此扩展完全在您的本地机器上运行,仅向您的 Ollama 服务器(默认 http://localhost:11434)发送 HTTP 请求。除非您明确配置 ollama_url 指向远程 Ollama 实例,否则没有任何数据会离开您的机器;如果配置了远程实例,提示词和响应将会传输到该服务器。

Claude 可见的信息包括:

  • 您传递给 generate 和 chat 的所有提示词和聊天消息(这些消息会发送到 Ollama 服务器,服务器可能会根据其配置记录这些信息)。

  • Ollama 返回的补全全文。

  • 每个已安装模型的元数据(名称、摘要、大小、量化、模型文件内容)。

  • 当前加载在显存中的模型及其大小占用。

如果您安装的模型包含专有的微调数据或带有敏感元数据的模型文件,请注意,当您调用 show_model 或 list_models 时,Claude 将会看到这些信息。

delete_model 是破坏性的,且无法通过此扩展撤销——如果误删,必须从注册表重新拉取(或从源二进制文件重新导入)。

故障排除

“无法连接到 http://localhost:11434 上的 Ollama — 服务器是否在运行?” — 请使用 ollama serve 启动 Ollama 或运行 Ollama 应用程序。使用 curl http://localhost:11434/ 进行验证(应返回 "Ollama is running")。

pull_model 长时间挂起 — Ollama 的 stream: false 拉取 API 会阻塞直到完整下载完成,对于多 GB 的模型,这可能需要几分钟。如果您正在拉取大型模型,请改在终端中运行 ollama pull <name> —— 您可以在那里看到流式进度,后续的 MCP 调用将发现模型已安装。

自定义/远程 Ollama 端点 — 在扩展设置中设置 ollama_url(例如 http://192.168.1.42:11434)。需要重启扩展。

list_running 在您停止使用后仍显示模型 — Ollama 会将模型保持在显存中,直到达到可配置的 TTL(默认 5 分钟)。expires_at 时间戳会告诉您它何时卸载。这是 Ollama 的行为,而非扩展的行为。

开发

单个约 400 行的 Node.js 脚本,零 npm 依赖。重新构建 .mcpb:

cd bundle-source
zip -j ../Ollama.mcpb manifest.json package.json server.js README.md LICENSE icon.png glama.json

许可证

MIT。请参阅 LICENSE。

相关

Available Tools

8 tools
chatA

Run a chat completion against a local model with message history (non-streaming). Returns the assistant's reply plus timing.

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

delete_modelA
Destructive

Delete a locally-installed model. Does not affect the remote registry copy. Free the disk space of a model you no longer need.

Inputs: name (required).

generateA

Run a one-shot text completion against a local model (non-streaming). Returns the full response text plus timing and tokens/second.

Inputs: model (required), prompt (required), system, options.

list_modelsA
Read-only

List locally-installed models: name, size in bytes, digest, modified timestamp, family (e.g. llama), parameter size (e.g. 8.0B), and quantization level (e.g. Q4_K_M).

Inputs: no named parameters.

list_runningA
Read-only

List models currently loaded into VRAM with their size, VRAM footprint, and expiry timestamp. Empty list means Ollama is idle.

Inputs: no named parameters.

ollama_statusA
Read-only

Health check: whether the Ollama server is reachable and its version. Use this as a precondition before other tools if you're unsure whether Ollama is running.

Inputs: no named parameters.

pull_modelA

Download a model from the Ollama registry. Blocks until complete — can take a long time for multi-GB models. For very large pulls, prefer ollama pull in a terminal where you can watch progress.

Inputs: name (required).

show_modelA
Read-only

Show detailed information for a specific model: modelfile excerpt, parameters, template, capabilities, architecture details, quantization level.

Inputs: name (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: chat vs generate differentiate by context (with/without history); model management tools (list, pull, delete, show, list_running) are non-overlapping; ollama_status is a standalone health check. No ambiguity in roles.

    Naming Consistency4/5

    Most names follow a verb_noun pattern (e.g., delete_model, list_models, pull_model). 'chat' and 'generate' are single verbs but still actions. 'ollama_status' deviates slightly (noun_noun) but is readable. Overall consistent with minor exceptions.

    Tool Count5/5

    8 tools cover the essential operations for a local Ollama server: model management (list, pull, delete, show, list_running), two inference modes (chat, generate), and a health check. Well-scoped without bloat or deficiency.

    Completeness4/5

    Core CRUD and inference are covered, but streaming support is absent (only non-streaming provided). No tool to adjust model parameters or embeddings. Minor gaps for advanced use, but sufficient for standard workflows.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with locally running Ollama models through chat, generation, and model management operations. Supports listing, downloading, and deleting models while maintaining conversation history for interactive sessions.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      A bridge that enables Claude Code to interact with local Ollama instances for text generation, multi-turn chat, and vision-based analysis. It supports model management tasks such as listing, pulling, and showing details, alongside generating text embeddings.
      6
      1
      MIT
    • 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