npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ollama-remote-mcp

v1.1.1

Published

A Model Context Protocol (MCP) server for remote Ollama access

Readme

Ollama Remote MCP

一个基于Model Context Protocol (MCP) 的Ollama远程访问实现。

项目概述

本项目实现了一个MCP服务器,提供对Ollama AI模型的远程访问能力。通过MCP协议,可以安全地与远程Ollama实例进行交互。

技术栈

  • TypeScript - 类型安全的JavaScript
  • Model Context Protocol (MCP) SDK - 标准化的上下文协议实现
  • Zod - TypeScript优先的schema验证库
  • Node.js - 运行时环境

安装

# 安装依赖
npm install

构建

# 编译TypeScript
npm run build

使用

可用的 MCP 工具

  1. list_ollama_models - 列出可用模型

    • 参数:only_remote?: boolean - 只显示云端模型
    • 功能:获取服务器上所有模型列表,包含大小和更新时间
  2. chat_with_remote_ollama - 发送对话请求

    • 参数:model, message, system_prompt?, temperature?
    • 功能:向指定模型发送对话请求

开发模式

# 编译并运行
npm run build
npm start

直接运行

npm start

npx 启动

# 直接运行
npx ollama-remote-mcp

# 在 Claude Desktop 中使用
# 配置文件中添加 MCP 服务器设置

环境变量配置

通过环境变量配置远程 Ollama 连接:

  • OLLAMA_BASE_URL - Ollama 服务器地址(默认:http://localhost:11434)
  • OLLAMA_API_KEY - API 认证密钥(可选)

示例

# 设置环境变量
export OLLAMA_BASE_URL="https://your-ollama-server.com:11434"
export OLLAMA_API_KEY="your-api-key"

# 运行 MCP 服务器
npx ollama-remote-mcp

测试

项目包含完整的测试工具,可以快速验证MCP工具功能:

快速测试

# 运行所有测试(连接 + 构建 + 启动)
npm test

# 只测试 Ollama 连接
npm run test:connection

# 只测试构建过程
npm run test:build

# 只测试 MCP 服务器启动
npm run test:start

高级测试

# 直接使用测试脚本
node test.cjs all              # 运行所有测试
node test.cjs connection       # 测试连接
node test.cjs build            # 测试构建
node test.cjs start            # 测试启动
node test.cjs help             # 显示帮助

测试输出示例

🔧 Ollama Remote MCP 测试工具
================================

🔌 测试 Ollama 连接...
✅ Ollama 连接成功
📋 发现 2 个模型:
  1. llama3.2:latest (4.7 GB)
  2. codellama:7b (3.8 GB)

🔨 测试构建过程...
✅ 构建成功

🚀 测试 MCP 服务器启动...
✅ MCP 服务器启动成功 (正常运行5秒)

🎉 测试完成!

测试功能说明

  1. 连接测试: 验证 Ollama API 是否可访问
  2. 构建测试: 运行 npm run build 验证 TypeScript 编译
  3. 启动测试: 启动 MCP 服务器并等待 5 秒验证正常运行

测试前提条件

  • 确保 Ollama 服务器正在运行 (ollama serve)
  • 确保有至少一个可用的模型
  • 网络连接正常(如果使用远程 Ollama)
  • Node.js 环境已安装

项目结构

ollama-remote-mcp/
├── src/                 # TypeScript源文件
├── dist/                # 编译后的JavaScript文件
├── tsconfig.json        # TypeScript配置
├── package.json         # 项目配置和依赖
└── README.md           # 项目文档

功能特性

  • 🤖 列出可用模型 - 查看远程 Ollama 服务器上所有可用模型(本地 + 云端)
  • 💬 智能对话 - 向远程 Ollama 模型发送对话请求
  • ☁️ 云端支持 - 支持云端和本地模型混合显示
  • 🔐 认证支持 - 支持 API Key 认证
  • 📊 模型信息 - 显示模型大小、更新时间等详细信息

trae 使用

mcp 配置

{
  "mcpServers": {
    "remote-ollama": {
      "command": "npx",
      "args": [
        "ollama-remote-mcp"
      ],
      "env": {
        "OLLAMA_BASE_URL": "https://ollama.com",
        "OLLAMA_API_KEY": "实际api_key"
      }
    }
  }
}

提问1

请使用 remote ollama 工具,调用 gemini-3-pro-preview 模型帮我写一个 Python 的 Hello World。

ps:

gemini-3-pro-preview 变为了 gemini-3-pro-preview:latest 换 kimi-k2-thinking:cloud 才好使。

效果1

在trae中使用效果

提问2

请使用 remote ollama mini_swe_execute_task 工具,

function add(a, b) {

return a + b;

}

// This should return 10, but returns "55"

console.log(add(5, 5));

修复 add 函数里的bug

效果2

在kiro中使用效果

开发

开发依赖

  • typescript: TypeScript编译器
  • @types/node: Node.js类型定义

生产依赖

  • @modelcontextprotocol/sdk: MCP SDK实现
  • @cfworker/json-schema: JSON Schema支持
  • zod: 数据验证

许可证

MIT