Cover image
Try Now
2025-04-14

本地Ollama模型的MCP客户端

3 years

Works with Finder

16

Github Watches

1

Github Forks

16

Github Stars

Ollama MCP (Model Context Protocol)

Ollama MCP is a tool for connecting Ollama-based language models with external tools and services using the Model Context Protocol (MCP). This integration enables LLMs to interact with various systems like Git repositories, shell commands, and other tool-enabled services.

Features

  • Seamless integration between Ollama language models and MCP servers
  • Support for Git operations through MCP Git server
  • Extensible tool management system
  • Interactive command-line assistant interface

Installation

  1. Ensure you have Python 3.13+ installed
  2. Clone this repository
  3. Install dependencies:
# Create a virtual environment
uv add ruff check
# Activate the virtual environment
source .venv/bin/activate
# Install the package in development mode
uv pip install -e .

Usage

Running the Git Assistant

uv run main.py

To run tests

pytest -xvs tests/test_ollama_toolmanager.py

This will start an interactive CLI where you can ask the assistant to perform Git operations.

Extending with Custom Tools

You can extend the system by:

  1. Creating new tool wrappers
  2. Registering them with the OllamaToolManager
  3. Connecting to different MCP servers

Components

  • OllamaToolManager: Manages tool registrations and execution
  • MCPClient: Handles communication with MCP servers
  • OllamaAgent: Orchestrates Ollama LLM and tool usage

Examples

# Creating a Git-enabled agent
git_params = StdioServerParameters(
    command="uvx",
    args=["mcp-server-git", "--repository", "/path/to/repo"],
    env=None
)

# Connect and register tools
async with MCPClient(git_params) as client:
    # Register tools with the agent
    # Use the agent for Git operations

Requirements

  • Python 3.13+
  • MCP 1.5.0+
  • Ollama 0.4.7+

相关推荐

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • hkr04
  • 轻巧的C ++ MCP(模型上下文协议)SDK

  • sigoden
  • 使用普通的bash/javascript/python函数轻松创建LLM工具和代理。

  • RockChinQ
  • 😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack

  • modelscope
  • 开始以更轻松的方式开始构建具有LLM授权的多代理应用程序。

  • dmayboroda
  • 带有可配置容器的本地对话抹布

    Reviews

    5 (0)