Agent specific mcp server initialization

From ychampion/cskill-agents · View interactive version

Agent specific mcp server initialization is an AI agent skill from the GitHub repository ychampion/cskill-agents. Connect each agent’s frontmatter MCP servers safely and tear them down without leaking clients, while honoring plugin-only guards.

How to use this skill

Skill file

SKILL: Agent-Specific MCP Server Initialization

Domain: mcp-initialization

Trigger: Load this skill when an agent defines extra MCP servers in its frontmatter and those clients must be joined to the parent session.

Source Pattern: Distilled from reviewed subagent orchestration, isolation, and lifecycle implementations.

Core Method

Iterate the servers declared by the child agent, resolve named references from shared MCP configuration, and treat inline declarations as new agent-owned connections. Merge the resulting clients and tools into the inherited parent context, but keep track of which connections were created specifically for that child agent. When the agent ends, tear down only those agent-owned connections while leaving inherited shared clients intact. If no extra servers are declared, return the parent context unchanged.

Key Rules

Example Application

When implementing a custom agent that needs access to an inline MCP server, plug into this skill to merge the new server with the parent clients, reuse any shared configs, and ensure only the inline connection runs its cleanup path.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.