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 complete integration with Ollama, allowing users to pull, push, list, create, copy, and run local LLM models. Includes model management, execution of models with customizable prompts, and an OpenAI-compatible chat completion API.

  • Offers an OpenAI-compatible chat completion API that serves as a drop-in replacement, enabling the use of local Ollama models with the familiar OpenAI chat interface and message structure.

Ollama MCP サーバー

🚀 Ollama とモデルコンテキストプロトコル (MCP) 間の強力なブリッジであり、Ollama のローカル LLM 機能を MCP 対応アプリケーションにシームレスに統合できます。

🌟 特徴

Ollamaとの完全な統合

  • 完全なAPIカバレッジ:クリーンなMCPインターフェースを通じてOllamaのすべての重要な機能にアクセスできます
  • OpenAI 互換チャット: OpenAI のチャット補完 API の代替
  • ローカルLLMパワー:完全な制御とプライバシーを確保しながらAIモデルをローカルで実行

コア機能

  • 🔄モデル管理
    • レジストリからモデルを取得する
    • モデルをレジストリにプッシュする
    • 利用可能なモデルの一覧
    • モデルファイルからカスタムモデルを作成する
    • モデルのコピーと削除
  • 🤖モデルの実行
    • カスタマイズ可能なプロンプトでモデルを実行する
    • システム/ユーザー/アシスタントの役割を持つチャット完了 API
    • 設定可能なパラメータ(温度、タイムアウト)
    • 直接応答のためのRawモードのサポート
  • 🛠サーバーコントロール
    • Ollama サーバーの起動と管理
    • 詳細なモデル情報を見る
    • エラー処理とタイムアウト管理

🚀 はじめに

前提条件

  • システムにOllamaがインストールされている
  • Node.js と npm/pnpm

インストール

  1. 依存関係をインストールします:
pnpm install
  1. サーバーを構築します。
pnpm run build

構成

サーバーを MCP 構成に追加します。

Claude Desktopの場合:

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

Ollama のローカル LLM 機能を MCP ベースのアプリケーションにシームレスに統合できるブリッジ。これにより、ユーザーは完全な API カバレッジを使用して AI モデルをローカルで管理および実行できます。

  1. 🌟 Features
    1. Complete Ollama Integration
    2. Core Capabilities
  2. 🚀 Getting Started
    1. Prerequisites
    2. Installation
    3. Configuration
  3. 🛠 Usage Examples
    1. Pull and Run a Model
    2. Chat Completion (OpenAI-compatible)
    3. Create Custom Model
  4. 🔧 Advanced Configuration
    1. 🤝 Contributing
      1. 📝 License
        ID: sxt5su901q