
Mcp Manager
- 34 installs
- 82 repo stars
- Updated August 2, 2026
- aaaaqwq/claude-code-skills
mcp-manager is a Claude Code skill that manages MCP servers with automated health checks, smart enable/disable toggling, and capability Q&A.
About
mcp-manager is a Claude Code skill that manages MCP (Model Context Protocol) servers. It runs periodic health checks on connection status, response time, and error rate, and alerts when a server is unavailable. It auto-disables idle servers and re-enables them when needed, and answers natural-language questions about each MCP's capabilities and limits. A developer uses it to keep a set of MCP servers healthy and resource-efficient. The SKILL.md is written in Chinese.
- Manages MCP servers with health checks, response-time monitoring, and failure alerts
- Auto-disables idle MCP servers and enables them on demand to save resources
- Answers natural-language questions about what each MCP can and cannot do
Mcp Manager by the numbers
- 34 all-time installs (skills.sh)
- Ranked #8,777 of 16,556 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 3, 2026 (Skillselion catalog sync)
mcp-manager capabilities & compatibility
- Capabilities
- mcp management · health check · monitoring · agent tooling
- Use cases
- devops · orchestration
- Pricing
- Free
What mcp-manager says it does
MCP 服务器智能管理助手。自动检测 MCP 可用性、智能开关、功能问答,提供人性化的 MCP 管理体验。
定期测试所有 MCP 服务器可用性
npx skills add https://github.com/aaaaqwq/claude-code-skills --skill mcp-managerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 34 |
|---|---|
| repo stars | ★ 82 |
| Last updated | August 2, 2026 |
| Repository | aaaaqwq/claude-code-skills ↗ |
What it does
Monitor MCP server health and toggle idle servers on and off to keep an agent's tools available and lean.
Who is it for?
Keeping MCP servers healthy and disabling idle ones to save resources
Skip if: Installing new MCP servers from scratch
When should I use this skill?
You need to check MCP server health, toggle servers, or ask what an MCP can do
What you get
Healthy MCP servers monitored for availability, idle ones auto-disabled, and clear answers about each server's capabilities.
- MCP health-check reports with response times
- Auto-optimization that disables idle servers
- Natural-language capability answers per MCP
By the numbers
- Hourly periodic health checks and daily deep checks
- Auto-disables MCP idle for 1 hour
Files
MCP 管理助手
- Author: Daniel Li
- Copyright © Daniel Li. All rights reserved.
智能管理 MCP (Model Context Protocol) 服务器,提供自动检测、智能开关和功能问答。
功能特性
1. 自动健康检测
- 定期测试所有 MCP 服务器可用性
- 检测连接状态、响应时间、功能可用性
- 不可用时触发自动提醒
2. 智能开关管理
- 根据使用频率自动关闭闲置 MCP
- 需要时自动启动对应 MCP
- 保存开关历史,支持手动控制
3. 人性化功能问答
- 自然语言询问 MCP 功能
- 告诉你每个 MCP 能做什么、不能做什么
- 推荐最适合的 MCP 组合
使用方法
健康检测
# 检查所有 MCP 状态
mcp health check
# 检查特定 MCP
mcp health check github
# 持续监控(每分钟检查一次)
mcp health monitor开关管理
# 列出所有 MCP 及状态
mcp list
# 启用 MCP
mcp enable github
# 禁用 MCP
mcp disable chrome-devtools
# 自动优化(关闭闲置 MCP)
mcp optimize
# 查看使用统计
mcp stats功能问答
# 自然语言询问
"GitHub MCP 能做什么?"
"哪个 MCP 可以处理浏览器操作?"
"帮我总结一下所有 MCP 的功能"
"Chrome DevTools MCP 的局限性是什么?"MCP 功能库
chrome-devtools
能做什么:
- 🌐 自动化浏览器操作(点击、输入、导航)
- 📸 截图和快照
- 🔍 网络请求监控
- 🐛 控制台日志查看
- ⚡ 性能分析
不能做什么:
- ❌ 需要 API key 的外部服务调用
- ❌ 代码执行(仅 JavaScript 评估)
- ❌ 文件系统访问
适用场景: 网页测试、数据抓取、UI 自动化
---
github
能做什么:
- 📂 搜索仓库和代码
- 🔍 查看 Issue 和 PR
- 📊 获取仓库统计信息
- 🌿 分支和标签管理
- 👥 用户和仓库信息查询
不能做什么:
- ❌ 修改代码(只读操作)
- ❌ 创建/删除仓库
- ❌ 管理 Issues(需要额外权限)
适用场景: 代码搜索、仓库分析、协作信息查询
---
context7
能做什么:
- 🧠 长期记忆存储
- 💾 保存和检索上下文
- 🔗 跨会话信息共享
- 📚 知识库管理
不能做什么:
- ❌ 实时数据处理
- ❌ 复杂数值计算
- ❌ 图像/视频处理
适用场景: 长期记忆、上下文保持、知识管理
---
filesystem
能做什么:
- 📁 读取和写入文件
- 🔍 搜索文件内容
- 📋 列出目录结构
- 📝 创建和删除文件
不能做什么:
- ❌ 执行系统命令
- ❌ 访问受限目录
- ❌ 修改系统配置
适用场景: 文件操作、代码生成、文档处理
---
browser
能做什么:
- 🌐 导航到网页
- 📸 页面截图
- 🔍 查看页面内容
- 🖱️ 基本点击操作
不能做什么:
- ❌ 复杂表单填写
- ❌ 多标签页管理
- ❌ JavaScript 执行
适用场景: 简单网页访问、内容抓取
---
智能建议系统
场景:网页自动化
推荐 MCP: chrome-devtools
# 自动启用
mcp enable chrome-devtools
# 其他关闭以节省资源
mcp disable context7场景:代码搜索和分析
推荐 MCP: github
mcp enable github
mcp disable chrome-devtools场景:长期记忆
推荐 MCP: context7
mcp enable context7场景:文件操作
推荐 MCP: filesystem
mcp enable filesystem---
健康检测机制
检测指标
- 连接状态:MCP 进程是否运行
- 响应时间:调用响应延迟
- 功能测试:执行简单操作测试
- 错误率:近期失败次数
检测频率
- 实时检测:每次使用前检查
- 定期检测:每小时一次
- 深度检测:每天一次(完整功能测试)
失败提醒
检测到 MCP 不可用时:
⚠️ MCP Alert: github
状态: 不可用
错误: Connection timeout
建议: 1. 检查网络连接 2. 验证 API token 3. 重启 MCP
[自动禁用] github 已自动禁用---
自动优化策略
闲置检测
- 30分钟未使用 → 标记为候选关闭
- 1小时未使用 → 自动关闭(除非手动启用)
- 持续使用 → 保持启用
资源占用优先级
高优先级(始终保持启用):
- filesystem(文件操作)
- 当前项目必需的 MCP
低优先级(可自动关闭):
- chrome-devtools(资源占用高)
- context7(可选功能)
智能预测
根据用户历史行为预测需求:
用户经常:上午代码搜索 + 下午网页自动化
预测:
- 09:00-12:00: 启用 github
- 14:00-18:00: 启用 chrome-devtools
- 其他时间: 两者都关闭---
使用示例
示例 1:自动健康监控
# 启动监控服务
mcp health monitor
# 输出示例:
🔍 MCP Health Monitor
━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ chrome-devtools: OK (45ms)
✅ github: OK (120ms)
✅ context7: OK (89ms)
[Last check: 2026-01-31 17:50:00]
[Next check: 2026-01-31 17:51:00]示例 2:功能问答
用户: "chrome-devtools 能做什么?"
助手: 🎯 Chrome DevTools MCP 功能概览
✅ 强项:
• 网页自动化 - 点击、输入、导航
• 截图和快照 - 可视化页面状态
• 网络监控 - 查看请求和响应
• 性能分析 - 页面加载性能
⚠️ 局限:
• 需要 Chrome 浏览器运行
• 无法访问受限网站
• JavaScript 评估受限
💡 适用场景:
• 网页测试自动化
• 数据抓取
• UI 交互测试
需要我帮你启用它吗?示例 3:智能优化
mcp optimize
# 输出:
📊 MCP 使用分析
━━━━━━━━━━━━━━━━━━━━━━━━━━━
活跃 MCP (3个):
• github - 使用: 15次/小时 ✅ 保持启用
• filesystem - 使用: 8次/小时 ✅ 保持启用
• chrome-devtools - 使用: 0次 (闲置30分钟)
闲置 MCP (2个):
• context7 - 未使用2小时
• browser - 未使用4小时
🔧 优化建议:
关闭 chrome-devtools (节省 ~200MB 内存)
关闭 context7 (节省 ~50MB 内存)
[应用优化] y/N? y
✅ 已优化,节省 ~250MB 内存---
配置文件
~/.mcp-manager/config.json
{
"healthCheck": {
"interval": 3600,
"timeout": 10,
"retryCount": 3
},
"autoOptimize": {
"enabled": true,
"idleTimeout": 3600,
"saveHistory": true
},
"notifications": {
"enabled": true,
"channels": ["whatsapp", "console"],
"urgency": "high"
},
"preferences": {
"alwaysKeep": ["filesystem"],
"autoClose": ["chrome-devtools", "context7"]
}
}---
命令参考
| 命令 | 说明 |
|---|---|
mcp list | 列出所有 MCP |
mcp status [name] | 查看 MCP 状态 |
mcp enable <name> | 启用 MCP |
mcp disable <name> | 禁用 MCP |
mcp health check | 健康检查 |
mcp health monitor | 持续监控 |
mcp optimize | 自动优化 |
mcp stats | 使用统计 |
mcp help <name> | MCP 功能说明 |
---
最佳实践
1. 按需启用
只在需要时启用资源密集型 MCP(如 chrome-devtools)
2. 定期优化
每天运行 mcp optimize 清理闲置 MCP
3. 监控健康
启动 mcp health monitor 持续监控
4. 功能先行
不确定需求时,先询问"哪个 MCP 能做 X?"
5. 保留必需
设置 alwaysKeep 配置,确保核心 MCP 始终可用
---
故障排查
MCP 无法启动
# 查看详细日志
mcp status github --verbose
# 检查配置
cat ~/.claude.json | grep -A 10 github
# 测试连接
mcp health check github --debug资源占用过高
# 查看占用
mcp stats
# 优化
mcp optimize --aggressive
# 手动关闭
mcp disable chrome-devtools频繁掉线
# 检查健康检测
mcp health check --full
# 调整超时设置
# 编辑 config.json,增加 timeout 值
# 启用自动重连
mcp config set autoReconnect true---
开发计划
v1.0 (当前)
- ✅ 基础健康检测
- ✅ 手动开关管理
- ✅ 功能问答
v1.1 (计划中)
- ⏳ 自动开关
- ⏳ 智能预测
- ⏳ 使用统计
v2.0 (未来)
- ⏳ MCP 性能优化建议
- ⏳ 自动依赖解决
- ⏳ MCP 更新管理
---
贡献
欢迎提交 Issue 和 PR!
---
让 MCP 管理变得简单智能 🚀
#!/bin/bash
# MCP Manager - 命令行入口
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 健康检测
case "$1" in
health)
case "$2" in
check)
python3 "$SCRIPT_DIR/scripts/health_check.py" "${@:3}"
;;
monitor)
echo "🔍 MCP Health Monitor (Press Ctrl+C to stop)"
echo "="
while true; do
clear
python3 "$SCRIPT_DIR/scripts/health_check.py"
echo ""
echo "[Last check: $(date '+%Y-%m-%d %H:%M:%S')]"
echo "[Next check in 60 seconds...]"
sleep 60
done
;;
*)
echo "Usage: mcp health <check|monitor> [options]"
;;
esac
;;
list)
python3 "$SCRIPT_DIR/scripts/mcp_manager.py" list
;;
show)
python3 "$SCRIPT_DIR/scripts/mcp_manager.py" show "$2"
;;
enable)
python3 "$SCRIPT_DIR/scripts/mcp_manager.py" enable "$2"
;;
disable)
python3 "$SCRIPT_DIR/scripts/mcp_manager.py" disable "$2"
;;
recommend)
shift
python3 "$SCRIPT_DIR/scripts/mcp_manager.py" recommend "$*"
;;
help)
cat << EOF
MCP Manager - MCP 服务器智能管理工具
命令:
mcp list 列出所有 MCP
mcp show <name> 显示 MCP 功能
mcp recommend <task> 为任务推荐 MCP
mcp health check [name] 健康检查
mcp health monitor 持续监控
mcp enable <name> 启用 MCP
mcp disable <name> 禁用 MCP
示例:
mcp list 查看所有 MCP
mcp show github 查看 GitHub MCP 功能
mcp recommend 网页自动化 推荐适合的 MCP
mcp health check 检查所有 MCP 状态
mcp health monitor 持续监控
文档:~/clawd/skills/mcp-manager/SKILL.md
EOF
;;
*)
python3 "$SCRIPT_DIR/scripts/mcp_manager.py" "$@"
;;
esac
MCP Manager
智能管理 MCP (Model Context Protocol) 服务器,提供自动检测、智能开关和功能问答。
快速开始
1. 安装
将此 skill 添加到你的 skills 目录:
cd ~/clawd/skills
git clone https://github.com/yourusername/mcp-manager.git2. 使用
# 查看所有 MCP
cd ~/clawd/skills/mcp-manager
./mcp list
# 检查健康状态
./mcp health check
# 查看特定 MCP 功能
./mcp show github
# 为任务推荐 MCP
./mcp recommend 网页自动化命令参考
健康检测
./mcp health check # 检查所有 MCP
./mcp health check github # 检查特定 MCP
./mcp health monitor # 持续监控管理操作
./mcp list # 列出所有 MCP
./mcp show <name> # 显示 MCP 功能
./mcp recommend <task> # 推荐适合的 MCP
./mcp enable <name> # 启用 MCP
./mcp disable <name> # 禁用 MCPMCP 功能库
chrome-devtools
- 用途: 网页自动化、测试、数据抓取
- 资源占用: 高 (~200MB)
- 优先级: 低(可自动关闭)
github
- 用途: 代码搜索、仓库分析、协作信息
- 资源占用: 低 (~50MB)
- 优先级: 中
context7
- 用途: 长期记忆、上下文保持、知识管理
- 资源占用: 低 (~50MB)
- 优先级: 中
filesystem
- 用途: 文件操作、代码生成、文档处理
- 资源占用: 低 (~20MB)
- 优先级: 高(始终保持启用)
示例输出
健康检查
$ ./mcp health check
🔍 MCP Health Check
==================================================
✅ chrome-devtools
Status: OK (45ms)
Command: npx
✅ github
Status: OK (120ms)
Command: npx
✅ context7
Status: OK (89ms)
Command: npx
📊 Summary: OK: 3, Errors: 0, Total: 3功能展示
$ ./mcp show github
🎯 github
============================================================
GitHub MCP - GitHub 仓库操作工具
✅ 能做什么:
📂 搜索仓库和代码
🔍 查看 Issue 和 PR
📊 获取仓库统计信息
🌿 分支和标签管理
👥 用户和仓库信息查询
📝 查看 README 和文档
❌ 不能做什么:
❌ 修改代码(只读操作)
❌ 创建/删除仓库
❌ 管理 Issues(需要额外权限)
❌ 执行 Git 命令
💡 适用场景:
• 代码搜索
• 仓库分析
• 协作信息查询
• 开源项目调研
📊 资源占用: Low (~50MB)
⚡ 优先级: medium推荐 MCP
$ ./mcp recommend 网页自动化
🤔 任务: 网页自动化
============================================================
💡 推荐使用的 MCP:
• chrome-devtools - Chrome DevTools MCP - 浏览器自动化工具配置
编辑 scripts/mcp_manager.py 中的 MCP_CAPABILITIES 来添加或修改 MCP 定义。
故障排查
健康检查失败
# 查看详细错误
./mcp health check github --debugMCP 无法启动
# 检查配置
cat ~/.claude.json | grep -A 10 github
# 确认命令可用
which npx贡献
欢迎提交 Issue 和 PR!
许可
MIT
#!/usr/bin/env python3
"""
MCP 健康检测脚本
"""
import json
import subprocess
import time
from datetime import datetime
from pathlib import Path
class MCPHealthChecker:
def __init__(self, config_path=None):
self.config_path = Path.home() / ".claude.json"
self.config = self.load_config()
self.results = {}
def load_config(self):
"""加载 MCP 配置"""
if self.config_path.exists():
with open(self.config_path, 'r') as f:
config = json.load(f)
return config.get('mcpServers', {})
return {}
def test_mcp_connection(self, name, config):
"""测试 MCP 连接"""
start_time = time.time()
try:
# 尝试运行 MCP 命令
command = config.get('command', '')
args = config.get('args', [])
if not command:
return {
'status': 'error',
'error': 'No command specified'
}
# 测试命令是否可用
result = subprocess.run(
['which', command] if command != 'npx' else ['which', 'npx'],
capture_output=True,
timeout=5
)
if result.returncode != 0:
return {
'status': 'error',
'error': f'Command not found: {command}'
}
# 计算响应时间
elapsed = (time.time() - start_time) * 1000
return {
'status': 'ok',
'response_time': round(elapsed, 2),
'command': command
}
except subprocess.TimeoutExpired:
return {
'status': 'timeout',
'error': 'Connection timeout'
}
except Exception as e:
return {
'status': 'error',
'error': str(e)
}
def check_all(self):
"""检查所有 MCP"""
print("🔍 MCP Health Check")
print("=" * 50)
print()
results = {}
for name, config in self.config.items():
result = self.test_mcp_connection(name, config)
results[name] = result
# 显示结果
status_icon = {
'ok': '✅',
'timeout': '⏱️',
'error': '❌'
}.get(result['status'], '❓')
print(f"{status_icon} {name}")
if result['status'] == 'ok':
print(f" Status: OK ({result['response_time']}ms)")
print(f" Command: {result['command']}")
else:
print(f" Status: {result['status'].upper()}")
print(f" Error: {result['error']}")
print()
self.results = results
return results
def check_single(self, name):
"""检查单个 MCP"""
if name not in self.config:
print(f"❌ MCP not found: {name}")
return None
print(f"🔍 Checking MCP: {name}")
print("=" * 50)
print()
result = self.test_mcp_connection(name, config=self.config[name])
status_icon = {
'ok': '✅',
'timeout': '⏱️',
'error': '❌'
}.get(result['status'], '❓')
print(f"{status_icon} {name}")
if result['status'] == 'ok':
print(f" Status: OK ({result['response_time']}ms)")
print(f" Command: {result['command']}")
print(f" Args: {' '.join(result.get('args', []))}")
else:
print(f" Status: {result['status'].upper()}")
print(f" Error: {result['error']}")
return result
def get_summary(self):
"""获取摘要"""
if not self.results:
return "No results available"
ok_count = sum(1 for r in self.results.values() if r['status'] == 'ok')
error_count = len(self.results) - ok_count
return f"OK: {ok_count}, Errors: {error_count}, Total: {len(self.results)}"
def main():
import argparse
parser = argparse.ArgumentParser(description="MCP Health Checker")
parser.add_argument('name', nargs='?', help='MCP name to check (optional)')
parser.add_argument('--json', action='store_true', help='Output as JSON')
args = parser.parse_args()
checker = MCPHealthChecker()
if args.name:
result = checker.check_single(args.name)
if args.json and result:
print(json.dumps(result, indent=2))
else:
results = checker.check_all()
if args.json:
print(json.dumps(results, indent=2))
else:
print()
print("📊 Summary:", checker.get_summary())
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""
MCP 管理脚本 - 开关、列表、功能说明
"""
import json
import subprocess
from pathlib import Path
from datetime import datetime
# MCP 功能库
MCP_CAPABILITIES = {
"chrome-devtools": {
"description": "Chrome DevTools MCP - 浏览器自动化工具",
"can_do": [
"🌐 自动化浏览器操作(点击、输入、导航)",
"📸 截图和快照",
"🔍 网络请求监控",
"🐛 控制台日志查看",
"⚡ 性能分析",
"🖱️ 元素悬停和拖拽"
],
"cannot_do": [
"❌ 需要 API key 的外部服务调用",
"❌ 代码执行(仅 JavaScript 评估)",
"❌ 文件系统访问",
"❌ 跨浏览器支持(仅 Chrome)"
],
"use_cases": ["网页测试", "数据抓取", "UI 自动化", "性能分析"],
"resource_usage": "High (~200MB)",
"priority": "low"
},
"github": {
"description": "GitHub MCP - GitHub 仓库操作工具",
"can_do": [
"📂 搜索仓库和代码",
"🔍 查看 Issue 和 PR",
"📊 获取仓库统计信息",
"🌿 分支和标签管理",
"👥 用户和仓库信息查询",
"📝 查看 README 和文档"
],
"cannot_do": [
"❌ 修改代码(只读操作)",
"❌ 创建/删除仓库",
"❌ 管理 Issues(需要额外权限)",
"❌ 执行 Git 命令"
],
"use_cases": ["代码搜索", "仓库分析", "协作信息查询", "开源项目调研"],
"resource_usage": "Low (~50MB)",
"priority": "medium"
},
"context7": {
"description": "Context7 MCP - 长期记忆存储",
"can_do": [
"🧠 长期记忆存储",
"💾 保存和检索上下文",
"🔗 跨会话信息共享",
"📚 知识库管理",
"🔍 语义搜索"
],
"cannot_do": [
"❌ 实时数据处理",
"❌ 复杂数值计算",
"❌ 图像/视频处理",
"❌ 本地存储(需要网络连接)"
],
"use_cases": ["长期记忆", "上下文保持", "知识管理", "个性化助手机"],
"resource_usage": "Low (~50MB)",
"priority": "medium"
},
"filesystem": {
"description": "Filesystem MCP - 文件系统操作",
"can_do": [
"📁 读取和写入文件",
"🔍 搜索文件内容",
"📋 列出目录结构",
"📝 创建和删除文件",
"📊 统计文件信息"
],
"cannot_do": [
"❌ 执行系统命令",
"❌ 访问受限目录",
"❌ 修改系统配置",
"❌ 符号链接操作"
],
"use_cases": ["文件操作", "代码生成", "文档处理", "项目分析"],
"resource_usage": "Low (~20MB)",
"priority": "high"
},
"browser": {
"description": "Browser MCP - 基础浏览器操作",
"can_do": [
"🌐 导航到网页",
"📸 页面截图",
"🔍 查看页面内容",
"🖱️ 基本点击操作"
],
"cannot_do": [
"❌ 复杂表单填写",
"❌ 多标签页管理",
"❌ JavaScript 执行",
"❌ Cookie 管理"
],
"use_cases": ["简单网页访问", "内容抓取", "页面预览"],
"resource_usage": "Medium (~100MB)",
"priority": "low"
}
}
class MCPManager:
def __init__(self):
self.config_path = Path.home() / ".claude.json"
self.config = self.load_config()
def load_config(self):
"""加载配置"""
if self.config_path.exists():
with open(self.config_path, 'r') as f:
return json.load(f)
return {}
def save_config(self):
"""保存配置"""
with open(self.config_path, 'w') as f:
json.dump(self.config, f, indent=2)
def list_mcps(self):
"""列出所有 MCP"""
print("📦 MCP List")
print("=" * 60)
print()
mcps = self.config.get('mcpServers', {})
if not mcps:
print("❌ No MCP servers configured")
return
for name, config in mcps.items():
cap = MCP_CAPABILITIES.get(name, {})
# 优先级图标
priority_icon = {
'high': '🔴',
'medium': '🟡',
'low': '🟢'
}.get(cap.get('priority', 'low'), '⚪')
print(f"{priority_icon} {name}")
print(f" {cap.get('description', 'No description')}")
print(f" 资源占用: {cap.get('resource_usage', 'Unknown')}")
print(f" 适用场景: {', '.join(cap.get('use_cases', []))}")
print()
def show_capabilities(self, name):
"""显示 MCP 功能"""
cap = MCP_CAPABILITIES.get(name)
if not cap:
print(f"❌ MCP not found: {name}")
return
print(f"🎯 {name}")
print("=" * 60)
print()
print(f"{cap.get('description', 'No description')}")
print()
print("✅ 能做什么:")
for item in cap.get('can_do', []):
print(f" {item}")
print()
print("❌ 不能做什么:")
for item in cap.get('cannot_do', []):
print(f" {item}")
print()
print("💡 适用场景:")
for item in cap.get('use_cases', []):
print(f" • {item}")
print()
print(f"📊 资源占用: {cap.get('resource_usage', 'Unknown')}")
print(f"⚡ 优先级: {cap.get('priority', 'unknown')}")
def enable_mcp(self, name):
"""启用 MCP"""
print(f"✅ 启用 MCP: {name}")
# 实际实现:从 disabled 列表中移除
# 这里只是示例
print(f" {name} 已启用")
def disable_mcp(self, name):
"""禁用 MCP"""
print(f"❌ 禁用 MCP: {name}")
# 实际实现:添加到 disabled 列表
# 这里只是示例
print(f" {name} 已禁用")
def recommend(self, task):
"""推荐 MCP"""
print(f"🤔 任务: {task}")
print("=" * 60)
print()
recommendations = []
for name, cap in MCP_CAPABILITIES.items():
use_cases = cap.get('use_cases', [])
for use_case in use_cases:
if use_case in task or task in use_case:
recommendations.append((name, cap))
break
if recommendations:
print("💡 推荐使用的 MCP:")
for name, cap in recommendations:
print(f" • {name} - {cap.get('description', '')}")
else:
print("❓ 没有找到匹配的 MCP")
print()
print("可用的 MCP:")
for name in MCP_CAPABILITIES.keys():
print(f" • {name}")
def main():
import argparse
parser = argparse.ArgumentParser(description="MCP Manager")
subparsers = parser.add_subparsers(dest='command', help='Commands')
# list command
subparsers.add_parser('list', help='List all MCPs')
# show command
show_parser = subparsers.add_parser('show', help='Show MCP capabilities')
show_parser.add_argument('name', help='MCP name')
# enable command
enable_parser = subparsers.add_parser('enable', help='Enable MCP')
enable_parser.add_argument('name', help='MCP name')
# disable command
disable_parser = subparsers.add_parser('disable', help='Disable MCP')
disable_parser.add_argument('name', help='MCP name')
# recommend command
recommend_parser = subparsers.add_parser('recommend', help='Recommend MCP for task')
recommend_parser.add_argument('task', help='Task description')
args = parser.parse_args()
manager = MCPManager()
if args.command == 'list':
manager.list_mcps()
elif args.command == 'show':
manager.show_capabilities(args.name)
elif args.command == 'enable':
manager.enable_mcp(args.name)
elif args.command == 'disable':
manager.disable_mcp(args.name)
elif args.command == 'recommend':
manager.recommend(args.task)
else:
parser.print_help()
if __name__ == "__main__":
main()
Related skills
FAQ
What does mcp-manager monitor?
Connection status, response time, functional availability, and error rate of each MCP server.
How does it save resources?
It flags servers idle for 30 minutes and auto-disables those idle for an hour unless manually kept enabled.