# Ollama MCP桥接器
## 基本信息
- Slug: `rawveg-ollama-mcp`
- Source: modelscope
- Publisher: @rawveg/ollama-mcp
- Categories: developer-tools / note-taking / speech-processing
- Hosted: No
- License: GNU Affero General Public License v3.0
- Source URL: https://www.modelscope.cn/mcp/servers/@rawveg/ollama-mcp
## 简介
# 翻译 实现了Ollama的本地LLM模型与支持MCP协议的应用程序之间的无缝集成，支持模型管理和聊天互动。
## 安装提示

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

## MCP Server 详情

# Ollama MCP 服务器
[![smithery 徽章](https://smithery.ai/badge/@rawveg/ollama-mcp)](https://smithery.ai/server/@rawveg/ollama-mcp)

一个用于 Ollama 的 MCP（模型上下文协议）服务器，可实现 Ollama 的本地 LLM 模型与像 Claude Desktop 这样的 MCP 兼容应用程序之间的无缝集成。

## 功能

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

## 前提条件

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

## 安装

### 通过 Smithery 安装

要通过 [Smithery](https://smithery.ai/server/@rawveg/ollama-mcp) 自动为 Claude Desktop 安装 Ollama MCP 服务器：

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


### 手动安装
通过 npm 全局安装：

```bash
npm install -g @rawveg/ollama-mcp
```


### 在其他 MCP 应用程序中安装

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

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


设置文件的位置因应用程序而异：
- Claude Desktop: Claude 应用数据目录中的 `claude_desktop_config.json`
- Cline: VS Code 全局存储中的 `cline_mcp_settings.json`

## 使用

### 启动服务器

只需运行：

```bash
ollama-mcp
```


服务器默认将在端口 3456 上启动。您可以使用 PORT 环境变量指定不同的端口：

```bash
PORT=3457 ollama-mcp
```


### 环境变量

- `PORT`: 服务器端口（默认：3456）。在直接运行时和通过 Smithery 安装时都可以使用：
  ```bash
  # 直接运行时
  PORT=3457 ollama-mcp

  # 通过 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. 克隆仓库：
```bash
git clone https://github.com/rawveg/ollama-mcp.git
cd ollama-mcp
```


2. 安装依赖项：
```bash
npm install
```


3. 构建项目：
```bash
npm run build
```


4. 启动服务器：
```bash
npm start
```


## 贡献

欢迎贡献！请随时提交 Pull Request。

## 许可证

MIT

## 相关链接

- [Ollama](https://ollama.ai)
- [模型上下文协议](https://github.com/anthropics/model-context-protocol)

