模型上下文协议服务

一个基于Ollama和多种MCP服务器的模型上下文协议服务,支持文件系统、浏览器自动化、Notion集成等功能。

  • by MichaelXian
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 MichaelXian/MCP-Agent

使用说明

先决条件

如果你想使用不同的模型,请相应地更改mcp_config

在 .env 文件中添加环境变量,如 .env.example 中所示

  • 全局安装所有npm包,以避免服务器启动超时
npm i -g \
  @modelcontextprotocol/server-filesystem \
  brave-search-mcp \
  puppeteer-mcp-server \
  @notionhq/notion-mcp-server \
  @modelcontextprotocol/server-sequential-thinking
  • 安装Python/Docker

调试

如果你无法从Dolphin MCP客户端找到日志,可以暂时在它的client.py文件中将日志记录器替换为以下代码,以将日志记录到文件中:

class FileLogger:
    def __init__(self, filename):
        self.filename = filename

    def _write(self, level, msg):
        with open(self.filename, "a", encoding="utf-8") as f:
            f.write(f"[{level}] {msg}\n") 

    def info(self, msg):
        self._write("INFO", msg)

    def warning(self, msg):
        self._write("WARNING", msg)

    def error(self, msg):
        self._write("ERROR", msg)

    def debug(self, msg):
        self._write("DEBUG", msg)

logger = FileLogger("mcp_log.txt")