Ollama MCP Server

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides access to Ollama's local LLM models through a Model Context Protocol server, allowing listing, pulling, and chatting with Ollama models

Ollama MCP 服务器

Ollama 的 MCP(模型上下文协议)服务器,可实现 Ollama 本地 LLM 模型与 Claude Desktop 等 MCP 兼容应用程序之间的无缝集成。

特征

  • 列出可用的 Ollama 型号
  • 从 Ollama 提取新模型
  • 使用 Ollama 的聊天 API 与模特聊天
  • 获取详细模型信息
  • 自动端口管理
  • 环境变量配置

先决条件

  • Node.js(v16 或更高版本)
  • npm
  • Ollama 已在本地安装并运行

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Ollama MCP 服务器:

npx -y @smithery/cli install @rawveg/ollama-mcp --client claude

手动安装

通过 npm 全局安装:

npm install -g @rawveg/ollama-mcp

在其他 MCP 应用程序中安装

要在其他 MCP 兼容应用程序(如 Cline 或 Claude Desktop)中安装 Ollama MCP 服务器,请将以下配置添加到应用程序的 MCP 设置文件中:

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

设置文件位置因应用程序而异:

  • Claude 桌面:Claude 应用数据目录中的claude_desktop_config.json
  • Cline:VS Code 全局存储中的cline_mcp_settings.json

用法

启动服务器

只需运行:

ollama-mcp

服务器默认在 3456 端口启动。你可以使用 PORT 环境变量指定其他端口:

PORT=3457 ollama-mcp

环境变量

  • PORT :服务器端口(默认值:3456)。可在直接运行时使用,也可在 Smithery 安装期间使用:
    # When running directly PORT=3457 ollama-mcp # When installing via Smithery PORT=3457 npx -y @smithery/cli install @rawveg/ollama-mcp --client claude
  • OLLAMA_API :Ollama API 端点(默认: http://localhost:11434

API 端点

  • GET /models - 列出可用模型
  • POST /models/pull - 拉取新模型
  • POST /chat - 与模特聊天
  • GET /models/:name - 获取模型详细信息

发展

  1. 克隆存储库:
git clone https://github.com/rawveg/ollama-mcp.git cd ollama-mcp
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build
  1. 启动服务器:
npm start

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

麻省理工学院

有关的

-
security - not tested
A
license - permissive license
-
quality - not tested

实现Ollama本地LLM模型与MCP兼容应用程序的无缝集成,支持模型管理和聊天交互。

  1. Features
    1. Prerequisites
      1. Installation
        1. Installing via Smithery
        2. Manual Installation
        3. Installing in Other MCP Applications
      2. Usage
        1. Starting the Server
        2. Environment Variables
        3. API Endpoints
      3. Development
        1. Contributing
          1. License
            1. Related
              ID: n798ehuw4c