Skip to main content
Glama

Ollama MCP Server

by NightTrek

Ollama MCP 服务器

🚀 Ollama 和模型上下文协议 (MCP) 之间的强大桥梁,可将 Ollama 的本地 LLM 功能无缝集成到由 MCP 驱动的应用程序中。

🌟 功能

完成 Ollama 集成

  • 完整的 API 覆盖:通过简洁的 MCP 界面访问所有必要的 Ollama 功能
  • OpenAI 兼容聊天:OpenAI 聊天完成 API 的直接替代品
  • Local LLM Power :在本地运行 AI 模型,并具有完全控制权和隐私

核心能力

  • 🔄模型管理
    • 从注册表中提取模型
    • 将模型推送到注册表
    • 列出可用模型
    • 从模型文件创建自定义模型
    • 复制和删除模型
  • 🤖模型执行
    • 使用可自定义的提示运行模型
    • 具有系统/用户/助理角色的聊天完成 API
    • 可配置参数(温度、超时)
    • 原始模式支持直接响应
  • 🛠服务器控制
    • 启动和管理 Ollama 服务器
    • 查看详细模型信息
    • 错误处理和超时管理

🚀 入门

先决条件

  • 您的系统上已安装Ollama
  • Node.js 和 npm/pnpm

安装

  1. 安装依赖项:
pnpm install
  1. 构建服务器:
pnpm run build

配置

将服务器添加到您的 MCP 配置:

对于 Claude 桌面:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "ollama": { "command": "node", "args": ["/path/to/ollama-server/build/index.js"], "env": { "OLLAMA_HOST": "http://127.0.0.1:11434" // Optional: customize Ollama API endpoint } } } }

🛠 使用示例

拉取并运行模型

// Pull a model await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "pull", arguments: { name: "llama2" } }); // Run the model await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "run", arguments: { name: "llama2", prompt: "Explain quantum computing in simple terms" } });

聊天完成(兼容 OpenAI)

await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "chat_completion", arguments: { model: "llama2", messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "What is the meaning of life?" } ], temperature: 0.7 } });

创建自定义模型

await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "create", arguments: { name: "custom-model", modelfile: "./path/to/Modelfile" } });

🔧 高级配置

  • OLLAMA_HOST :配置自定义 Ollama API 端点(默认值: http ://127.0.0.1:11434 )
  • 模型执行的超时设置(默认值:60秒)
  • 温度控制响应随机性(0-2范围)

🤝 贡献

欢迎贡献!请随意:

  • 报告错误
  • 建议新功能
  • 提交拉取请求

📝 许可证

MIT 许可证 - 请随意在您自己的项目中使用!


用❤️为 MCP 生态系统打造

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

local-only server

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

这座桥梁可将 Ollama 的本地 LLM 功能无缝集成到 MCP 驱动的应用程序中,让用户能够在本地管理和运行具有完整 API 覆盖的 AI 模型。

  1. 🌟 功能
    1. 完成 Ollama 集成
    2. 核心能力
  2. 🚀 入门
    1. 先决条件
    2. 安装
    3. 配置
  3. 🛠 使用示例
    1. 拉取并运行模型
    2. 聊天完成(兼容 OpenAI)
    3. 创建自定义模型
  4. 🔧 高级配置
    1. 🤝 贡献
      1. 📝 许可证

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          Enables seamless integration between Ollama's local LLM models and MCP-compatible applications, supporting model management and chat interactions.
          Last updated -
          165
          47
          TypeScript
          AGPL 3.0
        • -
          security
          F
          license
          -
          quality
          A generic Model Context Protocol framework for building AI-powered applications that provides standardized ways to create MCP servers and clients for integrating LLMs with support for Ollama and Supabase.
          Last updated -
          TypeScript
        • -
          security
          F
          license
          -
          quality
          A server that enables seamless integration between local Ollama LLM instances and MCP-compatible applications, providing advanced task decomposition, evaluation, and workflow management capabilities.
          Last updated -
          1
          Python
          • Apple
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server that loads multiple OpenAPI specifications and exposes them to LLM-powered IDE integrations, enabling AI to understand and work with your APIs directly in development tools like Cursor.
          Last updated -
          7
          292
          7
          TypeScript
          MIT License

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/NightTrek/Ollama-mcp'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server