AM

ausboss/mcp-ollama-agent

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

30 stars 13 forks Качество 54 Тренд 0

Пример TypeScript, демонстрирующий интеграцию Ollama с серверами Model Context Protocol (MCP).

Обзор

Этот проект демонстрирует интеграцию между серверами Model Context Protocol (MCP) и Ollama, позволяя моделям ИИ взаимодействовать с различными инструментами через унифицированный интерфейс. Поддержка нескольких MCP-серверов (как uvx, так и npx tested) - встроенная поддержка операций файловой системы и веб-исследований - Легкая конфигурация через mcp-config.json, аналогичная claude desktop config.json - Интерактивный чат-интерфейс с интеграцией Ollama, который должен поддерживать любые инструменты - автономный демонстрационный режим для тестирования инструментов веб- и файловой системы без LLM Node.js (версия 18 или выше) - Установка и запуск Ollama - Установите инструменты MCP по всему миру, которые вы хотите использовать: - Добавить любой MCP-совместимый сервер в раздел mcpServers - Настроить хост и модель (обязательно поддерживать функцию вызова) - Поддерживает как Python (uvx), так и Node.js (npx) MCP серверы В этом примере используется модель qwen2.5:latest. Некоторые местные модели могут нуждаться в помощи при выборе инструмента. Настройте систему в ChatManager.

Обзор (машинный перевод)

Этот проект демонстрирует интеграцию между серверами Model Context Protocol (MCP) и Ollama, позволяя моделям ИИ взаимодействовать с различными инструментами через унифицированный интерфейс.

Feature Особенности

Поддержка нескольких MCP-серверов (как uvx, так и npx) Встроенная поддержка операций файловой системы и веб-исследований Легкая конфигурация через mcp-config.json, аналогичная claude_desktop_config.json Интерактивный чат с интеграцией Ollama, который должен поддерживать любые инструменты Автономный демонстрационный режим для тестирования инструментов веб- и файловой системы без LLM

Начало работы

1.** Предпосылки:**

Node.js (версия 18 или выше)

  • Ollama установлен и работает Установите инструменты MCP по всему миру, которые вы хотите использовать:

2Клон и установка:

  1. **Настройте свои инструменты и инструмент, поддерживаемый моделью Ollama в mcp-config.json: **

  2. ** Запустите демо-версию для тестирования файловой системы и инструментов веб-исследования без LLM: **

5.Или запустите чат-интерфейс с Ollama:

️ Конфигурация

**MCP серверы: ** Добавьте любой MCP-совместимый сервер в раздел mcpServers

  • Олама* Настройка хоста и модели (должна поддерживать функцию вызова) Поддерживает Python (uvx) и Node.

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

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

Открыть полный README на GitHub

Установка

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" } }