使用说明
项目简介
LocalMCP 是一个开源项目,旨在提供一个易于部署和使用的本地 MCP (Model Context Protocol) 服务器实现。它允许用户在本地 Linux 服务器上搭建 MCP 服务,集成各种常用在线服务(如Gmail、Discord、Twitter等)和本地部署的大型语言模型,为 LLM 应用提供上下文数据和工具能力。项目提供了一个 Web 管理界面,方便用户监控服务状态、测试工具和管理配置。
主要功能点
- 本地自托管: 完全掌控数据和基础设施,保障数据隐私和安全。
- Web 管理界面: 通过友好的 Web 界面监控服务运行状态、管理模型和配置。
- 服务集成: 支持 Gmail, Google Drive, Discord, Slack, Twitter, Bluesky, Telegram, Signal, Reddit, Notion 等常用服务集成,扩展 LLM 的数据访问和工具调用能力。
- 模型集成: 内置 Gemma3:27b 和 qwq:32b 等先进大模型的支持,利用 GPU 加速提供本地推理能力。
- 动态工具注册: 各服务以模块化方式实现,支持动态注册和发现工具,方便扩展和定制。
- 优化的模型推理: 针对消费级硬件进行模型优化,如 4-bit 量化、Flash Attention 2 等,提升 VRAM 效率和推理速度。
- 全面的监控和日志: 提供服务健康监控、系统日志查看等功能,便于运维和问题排查。
安装步骤
- 环境准备: 确保已安装 Linux 服务器环境(推荐 Ubuntu)、NVIDIA GPU 及驱动、Conda 和 Python 3.8+。
- 克隆仓库: 使用 'git clone https://github.com/jhacksman/LocalMCP' 命令克隆仓库到本地。
- 配置环境: 根据 'README.md' 指引,设置 Conda 虚拟环境,并安装各服务和模型所需的 Python 依赖。
- 配置认证: 根据 'README.md' 和各服务目录下的说明,配置各个服务所需的 API 密钥、Token 或 OAuth 凭据,例如 Gmail 的 OAuth2 凭据、Twitter 的 API keys、Discord 的 Bot Token 等。
- 启动 Web 界面: 进入 'web-interface' 目录,根据 'README.md' 启动 Web 管理界面。
- 访问 Dashboard: 通过浏览器访问 Web 界面地址(默认为 'http://localhost:9000'),即可开始监控和管理 LocalMCP 服务。
服务器配置
以下 JSON 配置信息可用于 MCP 客户端连接 LocalMCP 服务器。请根据实际使用的服务进行配置,例如要使用 Gmail 服务,则配置 Gmail 服务的启动命令。
[ { "serverName": "GmailService", "command": "python", "args": ["mcp-services/gmail/gmail_server.py"], "description": "Gmail MCP Service", "enabled": true }, { "serverName": "DiscordService", "command": "python", "args": ["mcp-services/discord/discord_server.py"], "description": "Discord MCP Service", "enabled": true }, { "serverName": "TwitterService", "command": "python", "args": ["mcp-services/twitter/twitter_server.py"], "description": "Twitter MCP Service", "enabled": true }, { "serverName": "NotionService", "command": "python", "args": ["mcp-services/notion/notion_server.py"], "description": "Notion MCP Service", "enabled": true }, { "serverName": "GoogleDriveService", "command": "python", "args": ["mcp-services/google-drive/google_drive_server.py"], "description": "Google Drive MCP Service", "enabled": true }, { "serverName": "BlueskyService", "command": "python", "args": ["mcp-services/bluesky/bluesky_server.py"], "description": "Bluesky MCP Service", "enabled": true }, { "serverName": "TelegramService", "command": "python", "args": ["mcp-services/telegram/telegram_server.py"], "description": "Telegram MCP Service", "enabled": true }, { "serverName": "SignalService", "command": "python", "args": ["mcp-services/signal/signal_server.py"], "description": "Signal MCP Service", "enabled": true }, { "serverName": "RedditService", "command": "python", "args": ["mcp-services/reddit/reddit_server.py"], "description": "Reddit MCP Service", "enabled": true }, { "serverName": "SlackService", "command": "python", "args": ["mcp-services/slack/slack_server.py"], "description": "Slack MCP Service", "enabled": true }, { "serverName": "SQLService", "command": "python", "args": ["mcp-services/sql/sql_server.py"], "description": "SQL MCP Service", "enabled": true }, { "serverName": "ManusMCPService", "command": "node", "args": ["mcp-services/manusmcp/.runtime/index.js"], "description": "Manus MCP Service (File, Shell, Browser Tools)", "enabled": true }, { "serverName": "Gemma3Model", "command": "python", "args": ["models/gemma3-27b/gemma3_model.py"], "description": "Gemma3 27B Model Service", "enabled": true }, { "serverName": "QWQModel", "command": "python", "args": ["models/qwq-32b/qwq_model.py"], "description": "QWQ 32B Model Service", "enabled": true } ]
基本使用方法
- 启动 LocalMCP 服务器: 按照安装步骤启动 Web 界面和所需的服务进程。
- 配置 MCP 客户端: 在支持 MCP 协议的 LLM 客户端中,配置上述服务器配置信息,指定要连接的 LocalMCP 服务。
- 使用 LLM 应用: 在 LLM 应用中,即可利用 LocalMCP 服务器提供的工具和资源,例如:
- 让 LLM 读取 Gmail 邮件、搜索 Google Drive 文件。
- 让 LLM 控制 Discord 频道、发送 Slack 消息。
- 让 LLM 调用本地部署的 Gemma3 或 QWQ 模型进行文本生成。
- 通过 Web 管理界面监控服务状态和测试工具功能。
信息
分类
AI与计算