AM

ausboss/mcp-ollama-agent

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

30 stars 13 forks 品質 54 トレンド 0

TypeScript の例では、Ollama の統合をモデルコンテキストプロトコル (MCP) サーバーで表示します.

概要

このプロジェクトでは、モデルコンテキストプロトコル(MCP)サーバーとオラマ間の統合を実証し、AIモデルが統一されたインターフェイスを介してさまざまなツールとやり取りすることができます。 - 複数のMCPサーバー(両方のUVxとnpxテスト済み)をサポート - ファイルシステム操作とWeb研究のための組み込みサポート - claude desktop config.jsonに似たmcp-config.jsonによる簡単な設定 - Ollamaインテグレーション付きのインタラクティブチャットインターフェイス - LLMなしでWebとファイルシステムツールをテストするためのスタンドアローンデモモード - Node.js(バージョン18以上) - Ollamaがインストールして実行 - MCPツールをグローバルにインストールして使用したい: - MCP 互換サーバーを mcpServers セクションに追加 - ホストとモデルの構成 (must サポート関数呼び出し) - Python (uvx) と Node.js (npx) MCP サーバーの両方をサポート この例では、このモデル qwen2.5:latest を使用しました。 一部のローカルモデルでは、ツールの選択に役立ちます。 ChatManagerでシステムプロンプトをカスタマイズします.

概要(AI 翻訳)

このプロジェクトでは、モデルコンテキストプロトコル(MCP)サーバーとオラマ間の統合を実証し、AIモデルが統一されたインターフェイスを介してさまざまなツールとやり取りすることができます。

✨ 機能

  • 複数のMCPサーバーをサポート(UVxとnpxテスト済み)
  • ファイルシステム操作とWeb研究のための組み込みのサポート
  • [[mcp-config.json] で簡単に設定できます。claude_desktop_config.json に似ています。
  • Ollamaの統合とインタラクティブなチャットインターフェイスは、任意のツールをサポートする必要があります
  • LLMなしでWebとファイルシステムツールをテストするためのスタンドアローンのデモモード

OST 始める

  1. 前提条件:
  • Node.js(バージョン18以上)
  • Ollama インストールと実行
  • 使用するMCPツールをグローバルにインストールします。

2.クローンとインストール:

3.[[[[mcp-config.json]]でツールとツールをサポートOllamaモデルを構成する:

4。LMなしでファイルシステムとWebresearchツールをテストするためのデモを実行:

  1. または Ollama とのチャット インターフェイスを始めて下さい:

¢ 設定

  • MCPサーバー: MCP 互換サーバーを mcpServers セクションに追加する
  • オラマ: ホストとモデルの構成(必須サポート関数呼び出し)
  • Python(uvx)とNodeの両方をサポート.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

TypeScript MCP Agent with Ollama Integration

This project demonstrates integration between Model Context Protocol (MCP) servers and Ollama, allowing AI models to interact with various tools through a unified interface.

✨ Features

  • Supports multiple MCP servers (both uvx and npx tested)
  • Built-in support for file system operations and web research
  • Easy configuration through mcp-config.json similar to claude_desktop_config.json
  • Interactive chat interface with Ollama integration that should support any tools
  • Standalone demo mode for testing web and filesystem tools without an LLM

🚀 Getting Started

  1. Prerequisites:

    • Node.js (version 18 or higher)

    • Ollama installed and running

    • Install the MCP tools globally that you want to use:

      # For filesystem operations
      npm install -g @modelcontextprotocol/server-filesystem
      
      # For web research
      npm install -g @mzxrai/mcp-webresearch
      
  2. Clone and install:

    git clone https://github.com/ausboss/mcp-ollama-agent.git
    cd mcp-ollama-agent
    npm install
    
    
  3. Configure your tools and tool supported Ollama model in mcp-config.json:

    {
      "mcpServers": {
        "filesystem": {
          "command": "npx",
          "args": ["@modelcontextprotocol/server-filesystem", "./"]
        },
        "webresearch": {
          "command": "npx",
          "args": ["-y", "@mzxrai/mcp-webresearch"]
        }
      },
      "ollama": {
        "host": "http://localhost:11434",
        "model": "qwen2.5:latest"
      }
    }
    
  4. Run the demo to test filesystem and webresearch tools without an LLM:

    npx tsx ./src/demo.ts
    
  5. Or start the chat interface with Ollama:

    npm start
    

⚙️ Configuration

  • MCP Servers: Add any MCP-compatible server to the mcpServers section
  • Ollama: Configure host and model (must support function calling)
  • Supports both Python (uvx) and Node.js (npx) MCP servers

💡 Example Usage

This example used this model qwen2.5:latest

Chat started. Type "exit" to end the conversation.
You: can you use your list directory tool to see whats in test-directory then use your read file tool to read it to me?
Model is using tools to help answer...
Using tool: list_directory
With arguments: { path: 'test-directory' }
Tool result: [ { type: 'text', text: '[FILE] test.txt' } ]
Assistant:
Model is using tools to help answer...
Using tool: read_file
With arguments: { path: 'test-directory/test.txt' }
Tool result: [ { type: 'text', text: 'rosebud' } ]
Assistant: The content of the file `test.txt` in the `test-directory` is:
rosebud
You: thanks
Assistant: You're welcome! If you have any other requests or need further assistance, feel free to ask.

System Prompts

GitHub で README 全文を見る

インストール

npx @modelcontextprotocol/server-filesystem ./
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "filesystem": { "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "./"] }, "webresearch": { "command": "npx", "args": ["-y", "@mzxrai/mcp-webresearch"] } }, "ollama": { "host": "http://localhost:11434", "model": "qwen2.5:latest" } }