MCP中心及通知服务

SERVICE是一款集成了多个下游MCP服务器并提供实时通知网关的持久化后台守护进程,适用于AI代理的统一工具连接和事件管理。

  • by baiehclaca
  • HTML
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 baiehclaca/service

使用说明

 ____  _____ ______     _____ ____ _____
/ ___|| ____|  _ \ \   / /_ _/ ___| ____|
\___ \|  _| | |_) \ \ / / | | |   |  _|
 ___) | |___|  _ < \ V /  | | |___| |___
|____/|_____|_| \_\ \_/  |___\____|_____|

  MCP Hub & Notification Center

您的AI代理需要的唯一MCP服务器。


如今,人工智能代理要处理十几个MCP服务器:一个用于GitHub,一个用于文件系统,一个用来搜索,一个用在Slack。每次重启、每个新项目、每个新代理都必须重新配置所有这些。 服务解决了这个问题。 它是一个持久的24/7后台守护进程,将所有下游MCP服务器聚合到一个统一的连接中,并在实时通知网关上分层,以便您的代理可以在事件发生时从X/Twitter、Slack、电子邮件和webhooks接收事件。

一个连接。你所有的工具。总是开着。


为什么服务?

  • 🔌 单一MCP端点,适用于一切 --Claude Desktop、Cursor、Copilot和任何MCP客户端连接到一个URL(http://localhost:3333/mcp)并立即从所有下游服务器获取所有工具,命名空间清晰(github__create_issue, filesystem__read_file等等)
  • ⚡ 实时推送,而非轮询 --Slack、Email、X/Twitter和webhooks等集成在事件通过SSE到达时将其流式传输给您的代理,因此代理可以实时做出反应,而不会在轮询循环中烧毁令牌
  • 🔒 本地优先和私人 --所有数据都存在于 ~/.service/service.db (SQLite),凭据是AES-256-GCM加密的,除非您将其配置为
  • 🧩 插件风格集成 -通过CLI向导或REST API添加新集成;无需重建

建筑

AI Agent (Claude Desktop / Cursor / Copilot / any MCP client)
              │
              │  Single MCP connection (Streamable HTTP)
              ▼
┌─────────────────────────────────────────────────────────────┐
│                      SERVICE DAEMON                         │
│                                                             │
│  ┌───────────────────────────────────────────────────────┐  │
│  │            MCP Hub  ·  port 3333                      │  │
│  │  Aggregates & proxies tools from all downstream MCPs  │  │
│  │  Namespaced tools: github__create_issue, etc.         │  │
│  └───────────────────────────────────────────────────────┘  │
│                                                             │
│  ┌───────────────────────────────────────────────────────┐  │
│  │      Notification Gateway  ·  port 3334               │  │
│  │  24/7 listener for all integrations                   │  │
│  │  SQLite persistence + SSE push to agents              │  │
│  └───────────────────────────────────────────────────────┘  │
│                                                             │
│  ┌───────────────────────────────────────────────────────┐  │
│  │      Integration System  (plugin-based)               │  │
│  │  X/Twitter · Slack · Email · Webhooks · HTTP-poll     │  │
│  └───────────────────────────────────────────────────────┘  │
│                                                             │
│  ┌───────────────────────────────────────────────────────┐  │
│  │      Interactive TUI Dashboard  (Ink v6)              │  │
│  │  Notification Center · Integration Manager ·          │  │
│  │  MCP Manager · Full keyboard navigation               │  │
│  └───────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘
         │                              │
    ┌────┘                              └──────────────────┐
    ▼                                                      ▼
Downstream MCPs (stdio)                      External Platforms
github, filesystem, memory,          X/Twitter, Slack, Email,
brave-search, any MCP server         Webhook, HTTP-poll, custom

快速入门

# 1. Install globally
npm install -g service-mcp

# 2. Start the daemon
service start

# 3. Add your AI client config (see below)

# 4. Add integrations interactively
service integration add

# 5. Watch it live
service dashboard

端口: 3333 --MCP Hub(代理在此连接)· 3334 -管理员API+SSE流


连接您的AI客户端

克劳德桌面

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "service": {
      "url": "http://localhost:3333/mcp"
    }
  }
}

光标

编辑光标MCP设置(~/.cursor/mcp.json 或通过设置→ MCP):

{
  "mcpServers": {
    "service": {
      "url": "http://localhost:3333/mcp"
    }
  }
}

任何兼容stdio的客户端

{
  "mcpServers": {
    "service": {
      "command": "npx",
      "args": ["service-mcp", "mcp-server"]
    }
  }
}

CLI 参考

守护进程生命周期

命令 描述
service start 在后台启动SERVICE守护进程
service stop 优雅地停止守护进程
service status 显示守护进程状态(正常运行时间、端口、集成、MCP)

整合管理

命令 描述
service integration list 列出所有已配置的集成及其状态
service integration add [type] 通过交互式向导添加新集成
service integration remove <id> 永久删除集成
service integration enable <id> 重新启用已禁用的集成
service integration disable <id> 禁用而不删除

MCP连接管理

命令 描述
service mcp list 列出所有下游MCP连接
service mcp add [name] [command] [args...] 添加下游MCP服务器(如果没有参数,则使用交互式向导)
service mcp remove <id> 断开并移除下游MCP

公用事业

命令 描述
service dashboard 打开交互式TUI仪表板(全屏Ink v6应用程序)
service completion <shell> 生成shell完成脚本(bash/zsh/fish)
service update 从npm检查并安装更新版本
service --help 显示所有命令的帮助
service --version 显示已安装版本

交互式TUI仪表板

这 service dashboard 命令启动基于以下内容的全屏键盘驱动终端UI 墨水v6 (React for CLI——支持Claude Code和Gemini CLI的相同框架)。它提供了对通知、集成和MCP连接的完整管理,而无需离开终端。

导航

关键 行动
Tab 窗格之间的循环(实时馈送→ 集成→ MCPs → 系统)
↑/↓ 或 j/k 浏览列表
Enter 打开所选项目的详细视图
Escape 返回上一屏幕
q 退出仪表板
? 显示/隐藏键盘快捷键帮助覆盖
r 刷新当前窗格

通知中心

实时管理所有通知:

  • 实时更新:通过SSE推送立即出现新通知——无轮询
  • 视觉指示器: ● 未读(粗体)vs ○ 读取(变暗)
  • 标记为已读: Space 标记所选通知, A 将所有内容标记为已读
  • 过滤器: u 切换只读视图
  • 搜索: / 打开内联全文搜索(FTS5)
  • 详细视图: Enter 显示完整的通知正文、来源、类型和时间戳

集成经理

查看、配置和管理所有集成:

  • 身份徽章: 🟢 活跃/🔴 错误/⏸ 禁用(颜色编码)
  • 详细视图:显示机密被编辑为的配置字段 ••••••
  • 启用/禁用: e/d 按键切换集成状态
  • 移除: x 带有确认对话框的密钥
  • 添加新的: a 以TUI多步骤形式打开,包括类型选择、模式驱动字段和秘密字段的密码掩码

MCP连接管理器

管理所有下游MCP服务器连接:

  • 身份徽章: 🟢 已连接/🔴 错误/⏳ 连接,带有刀具计数显示
  • 详细视图:完整命令+参数、状态和可滚动工具列表
  • 重新连接: r 键触发断开连接的MCP重新连接
  • 移除: x 带有确认对话框的密钥
  • 添加新的: a 以TUI形式打开名称、命令和参数

MCP工具参考

所有内置的维修工具都以前缀 service__下游MCP工具的名称为 {mcpName}__toolName (例如。 github__create_issue).

通知

工具 参数 说明
service__get_notifications limit?, source? 使用可选筛选器获取最近的通知
service__get_unread_count -- 未读通知计数
service__mark_notification_read id 将特定通知标记为已读
service__search_notifications query 在通知历史记录中进行全文搜索

代理记忆

工具 参数 说明
service__save_note key, value 保存持久键值注释
service__get_note key 按键检索笔记
service__list_notes -- 列出所有已保存的笔记键
service__delete_note key 按键删除注释

MCP管理

工具 参数 说明
service__connect_mcp name, command, args? 在运行时添加下游MCP
service__disconnect_mcp id 移除下游MCP连接
service__list_connected_mcps -- 列出所有活动的下游MCP连接

系统

工具 参数 说明
service__service_status -- 守护进程运行状况:正常运行时间、版本、集成计数
service__help -- 所有可用工具的格式化指南

平台工具(从集成中自动注册)

当集成处于活动状态时,他们的工具会自动注册并可供您的代理使用:

集成 工具
X/推特 x__tweet, x__reply, x__retweet, x__like, x__search_tweets
Slack slack__send_message, slack__list_channels, slack__get_thread, slack__react
电子邮件 email__send_email, email__list_emails, email__read_email, email__reply_email
HTTP轮询 httpPoll__fetch_now

集成设置

网络钩子

最简单的集成是接收HTTP POST请求并将其转换为通知。

service integration add webhook --name my-webhook
# Returns webhook URL: http://localhost:3334/webhooks/<integration-id>

从任何外部系统发送事件:

curl -X POST http://localhost:3334/webhooks/<id> \
  -H "Content-Type: application/json" \
  -d '{"title": "Deploy Complete", "body": "v2.1.0 deployed to production"}'

X/推特

需要Twitter API v2承载令牌。可选:关键字跟踪。

service integration add x
# Wizard prompts for:
#   bearer_token     — Twitter API v2 bearer token
#   track_keywords   — (optional) comma-separated keywords to monitor

Slack

需要启用套接字模式的Slack Bot令牌。

service integration add slack
# Wizard prompts for:
#   bot_token   — xoxb-... (Bot User OAuth Token)
#   app_token   — xapp-... (App-Level Token for Socket Mode)

所需范围: channels:read, chat:write, reactions:write, channels:history


电子邮件 (SMTP + IMAP)

通过IMAP监控您的收件箱,并通过SMTP发送电子邮件。适用于Gmail、Outlook、Fastmail和任何标准邮件服务器。

service integration add email
# Wizard prompts for:
#   imap_host, imap_port   — e.g. imap.gmail.com:993
#   smtp_host, smtp_port   — e.g. smtp.gmail.com:587
#   user, password         — your email credentials (stored encrypted)

Gmail提示: 在您的Google帐户安全设置中启用“应用程序密码”。


HTTP轮询

按计划轮询URL,并在内容更改时创建通知。

service integration add http-poll
# Wizard prompts for:
#   url               — endpoint to poll
#   interval_seconds  — polling interval (e.g. 60)
#   method            — GET or POST

管理员REST API

SERVICE在端口上公开完整的REST API 3334 用于程序化管理和自动化:

端点 方法 描述
/health GET 健康检查-退货 {"status":"ok"}
/api/status GET 完整守护进程状态(正常运行时间、版本、计数)
/api/notifications GET 列出通知(?unread, ?source, ?limit)
/api/notifications/:id/read PATCH 将通知标记为已读
/api/integrations GET 列出所有已配置的集成
/api/integrations POST 创建新的集成
/api/integrations/:id DELETE 删除集成
/api/integrations/types GET 列出所有可用的集成类型
/api/mcp-connections GET 列出下游MCP连接
/api/mcp-connections POST 添加下游MCP服务器
/api/mcp-connections/:id DELETE 拆除下游MCP
/events GET SSE流——实时通知事件
/webhooks/:id POST 入站webhook接收器

SSE事件流

订阅实时事件:

curl -N http://localhost:3334/events

事件采用JSON编码 NotificationEvent 物体到达时被推动。


数据存储

所有数据都存储在本地计算机上。除非配置集成,否则不会向外部服务器发送任何内容。

路径 目的
~/.service/service.db SQLite数据库——通知、集成、注释
~/.service/config.json 守护进程配置
~/.service/service.pid 守护进程PID文件
~/.service/state.json 运行时状态(连接的代理、正常运行时间)
~/.service/logs/ 旋转日志文件
~/.service/.encryption_key 为凭证自动生成AES-256-GCM加密密钥

存储在集成中的凭据在静止时使用AES-256-GCM进行加密。加密密钥在首次运行时生成一次,并存储在 ~/.service/.encryption_key.


例子

请参阅 examples/ 即用配置的目录:

文件 描述
claude-desktop-config.json 完整的Claude桌面配置
cursor-mcp-config.json 光标编辑器MCP配置
mcp-connections.json 下游MCP连接示例(github、文件系统、brave)
webhook-integration.sh 用于发送webhook事件的Shell脚本

需求

要求 版本
Node.js ≥20.0.0
npm ≥9.0.0
操作系统 macOS、Linux、Windows(WSL2)

发展

# Clone and install
git clone https://github.com/baiehclaca/service-mcp.git
cd service-mcp
npm install

# Build TypeScript
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Development mode (watch + auto-reload)
npm run dev

# Lint
npm run lint

添加自定义集成

每个集成都实现了 IntegrationAdapter 接口:

interface IntegrationAdapter {
  id: string
  name: string
  description: string
  configSchema: JSONSchema          // Fields the wizard will prompt for
  connect(config: Record<string, string>): Promise<void>
  disconnect(): Promise<void>
  onEvent(handler: (event: NotificationEvent) => void): void
  getTools(): MCPTool[]             // Tools exposed to agents
}

在中注册适配器 src/integrations/index.ts --不需要重建核心守护进程。


许可证

麻省理工学院 --©2024服务mcp贡献者