mcp-management
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMCP Management
MCP管理
Skill for managing and interacting with Model Context Protocol (MCP) servers.
用于管理和与Model Context Protocol (MCP) 服务器交互的Skill。
Overview
概述
MCP is an open protocol enabling AI agents to connect to external tools and data sources. This skill provides scripts and utilities to discover, analyze, and execute MCP capabilities from configured servers without polluting the main context window.
Key Benefits:
- Progressive disclosure of MCP capabilities (load only what's needed)
- Intelligent tool/prompt/resource selection based on task requirements
- Multi-server management from single config file
- Context-efficient: subagents handle MCP discovery and execution
- Persistent tool catalog: automatically saves discovered tools to JSON for fast reference
MCP是一种开放协议,支持AI Agent连接到外部工具和数据源。本Skill提供了相关脚本和实用工具,可以从已配置的服务器中发现、分析和执行MCP能力,且不会污染主上下文窗口。
核心优势:
- MCP能力渐进式披露(仅加载所需内容)
- 基于任务需求智能选择工具/提示词/资源
- 单配置文件即可实现多服务器管理
- 上下文高效:由子Agent处理MCP发现和执行
- 持久化工具目录:自动将发现的工具保存为JSON,便于快速查阅
When to Use This Skill
何时使用本Skill
Use this skill when:
- Discovering MCP Capabilities: Need to list available tools/prompts/resources from configured servers
- Task-Based Tool Selection: Analyzing which MCP tools are relevant for a specific task
- Executing MCP Tools: Calling MCP tools programmatically with proper parameter handling
- MCP Integration: Building or debugging MCP client implementations
- Context Management: Avoiding context pollution by delegating MCP operations to subagents
出现以下场景时可使用本Skill:
- 发现MCP能力:需要列出已配置服务器的可用工具/提示词/资源
- 基于任务的工具选择:分析哪些MCP工具适用于特定任务
- 执行MCP工具:通过正确的参数处理以程序化方式调用MCP工具
- MCP集成:构建或调试MCP客户端实现
- 上下文管理:通过将MCP操作委托给子Agent来避免上下文污染
Core Capabilities
核心功能
1. Configuration Management
1. 配置管理
MCP servers configured in .
.claude/.mcp.jsonGemini CLI Integration (recommended): Create symlink to :
.gemini/settings.jsonbash
mkdir -p .gemini && ln -sf .claude/.mcp.json .gemini/settings.jsonMCP服务器配置在中。
.claude/.mcp.jsonGemini CLI集成(推荐):创建指向的软链接:
.gemini/settings.jsonbash
mkdir -p .gemini && ln -sf .claude/.mcp.json .gemini/settings.json2. Capability Discovery
2. 能力发现
bash
undefinedbash
undefinedPreferred: Using bun (faster)
首选:使用bun(速度更快)
bunx tsx scripts/cli.ts list-tools # Saves to assets/tools.json
bunx tsx scripts/cli.ts list-prompts
bunx tsx scripts/cli.ts list-resources
bunx tsx scripts/cli.ts list-tools # 保存到assets/tools.json
bunx tsx scripts/cli.ts list-prompts
bunx tsx scripts/cli.ts list-resources
Alternative: Using bunx
备选:使用bunx
bunx tsx scripts/cli.ts list-tools
bunx tsx scripts/cli.ts list-prompts
bunx tsx scripts/cli.ts list-resources
Aggregates capabilities from multiple servers with server identification.bunx tsx scripts/cli.ts list-tools
bunx tsx scripts/cli.ts list-prompts
bunx tsx scripts/cli.ts list-resources
聚合来自多个服务器的能力,并附带服务器标识。3. Intelligent Tool Analysis
3. 智能工具分析
LLM analyzes directly - better than keyword matching algorithms.
assets/tools.jsonLLM直接分析,效果优于关键词匹配算法。
assets/tools.json4. Tool Execution
4. 工具执行
Primary: Gemini CLI (if available)
bash
gemini -y -m gemini-2.5-flash -p "Take a screenshot of https://example.com"Secondary: Direct Scripts
bash
undefined首选:Gemini CLI(如果可用)
bash
gemini -y -m gemini-2.5-flash -p "Take a screenshot of https://example.com"次选:直接脚本调用
bash
undefinedPreferred: Using bun
首选:使用bun
bunx tsx scripts/cli.ts call-tool memory create_entities '{"entities":[...]}'
bunx tsx scripts/cli.ts call-tool memory create_entities '{"entities":[...]}'
Alternative: Using bunx
备选:使用bunx
bunx tsx scripts/cli.ts call-tool memory create_entities '{"entities":[...]}'
**Fallback: mcp-manager Subagent**bunx tsx scripts/cli.ts call-tool memory create_entities '{"entities":[...]}'
**兜底方案:mcp-manager 子Agent**Implementation Patterns
实现模式
Pattern 1: Gemini CLI Auto-Execution (Primary)
模式1:Gemini CLI自动执行(首选)
Use Gemini CLI for automatic tool discovery and execution.
Quick Example:
bash
gemini -y -m gemini-2.5-flash -p "Take a screenshot of https://example.com"Benefits: Automatic tool discovery, natural language execution, faster than subagent orchestration.
使用Gemini CLI实现自动工具发现和执行。
快速示例:
bash
gemini -y -m gemini-2.5-flash -p "Take a screenshot of https://example.com"优势:自动工具发现、自然语言执行,速度快于子Agent编排。
Pattern 2: Subagent-Based Execution (Fallback)
模式2:基于子Agent的执行(兜底)
Use agent when Gemini CLI unavailable. Subagent discovers tools, selects relevant ones, executes tasks, reports back.
mcp-managerBenefit: Main context stays clean, only relevant tool definitions loaded when needed.
当Gemini CLI不可用时使用 Agent。子Agent会发现工具、选择相关工具、执行任务并返回结果。
mcp-manager优势:主上下文保持干净,仅在需要时加载相关工具定义。
Pattern 3: LLM-Driven Tool Selection
模式3:LLM驱动的工具选择
LLM reads , intelligently selects relevant tools using context understanding, synonyms, and intent recognition.
assets/tools.jsonLLM读取,通过上下文理解、同义词和意图识别智能选择相关工具。
assets/tools.jsonPattern 4: Multi-Server Orchestration
模式4:多服务器编排
Coordinate tools across multiple servers. Each tool knows its source server for proper routing.
跨多个服务器协调工具。每个工具都知晓其所属源服务器,可实现正确路由。
Quick Start
快速开始
Method 1: Gemini CLI (recommended)
bash
bun install -g gemini-cli # or: bun add -g gemini-cli
mkdir -p .gemini && ln -sf .claude/.mcp.json .gemini/settings.json
gemini -y -m gemini-2.5-flash -p "Take a screenshot of https://example.com"Method 2: Scripts
bash
cd .claude/skills/mcp-management/scripts
bun install # or: bun install
bunx tsx cli.ts list-tools # Saves to assets/tools.json
bunx tsx cli.ts call-tool memory create_entities '{"entities":[...]}'Method 3: mcp-manager Subagent
Dispatch subagent to handle MCP operations, keeping main context clean.
方法1:Gemini CLI(推荐)
bash
bun install -g gemini-cli # 或:bun add -g gemini-cli
mkdir -p .gemini && ln -sf .claude/.mcp.json .gemini/settings.json
gemini -y -m gemini-2.5-flash -p "Take a screenshot of https://example.com"方法2:脚本调用
bash
cd .claude/skills/mcp-management/scripts
bun install # 或:bun install
bunx tsx cli.ts list-tools # 保存到assets/tools.json
bunx tsx cli.ts call-tool memory create_entities '{"entities":[...]}'方法3:mcp-manager 子Agent
调度子Agent处理MCP操作,保持主上下文干净。
Integration Strategy
集成策略
Execution Priority
执行优先级
-
Gemini CLI (Primary): Fast, automatic, intelligent tool selection
- Check:
command -v gemini - Execute:
gemini -y -m gemini-2.5-flash -p "<task>" - Best for: All tasks when available
- Check:
-
Direct CLI Scripts (Secondary): Manual tool specification
- Use when: Need specific tool/server control
- Execute:
bunx tsx scripts/cli.ts call-tool <server> <tool> <args>
-
mcp-manager Subagent (Fallback): Context-efficient delegation
- Use when: Gemini unavailable or failed
- Keeps main context clean
-
Gemini CLI(首选):快速、自动、智能工具选择
- 检查:
command -v gemini - 执行:
gemini -y -m gemini-2.5-flash -p "<task>" - 适用场景:可用情况下的所有任务
- 检查:
-
直接CLI脚本(次选):手动指定工具
- 使用场景:需要对特定工具/服务器进行控制时
- 执行:
bunx tsx scripts/cli.ts call-tool <server> <tool> <args>
-
mcp-manager 子Agent(兜底):上下文高效的任务委托
- 使用场景:Gemini不可用或执行失败时
- 保持主上下文干净
Integration with Agents
与Agent集成
The agent uses this skill to:
mcp-manager- Check Gemini CLI availability first
- Execute via command if available
gemini - Fallback to direct script execution
- Discover MCP capabilities without loading into main context
- Report results back to main agent
This keeps main agent context clean and enables efficient MCP integration.
mcp-manager- 优先检查Gemini CLI是否可用
- 如可用则通过命令执行
gemini - 兜底方案为直接脚本执行
- 无需加载到主上下文即可发现MCP能力
- 向主Agent返回执行结果
这样可以保持主Agent上下文干净,实现高效的MCP集成。