MoonshotAI / MoonshotAI/kimi-cli

Feature Request:Dynamic Loading/Unloading of MCP Servers and Skills During Active Sessions

Open
#1,708 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

What feature would you like to see?

Motivation

Currently, both MCP Servers and Skills are loaded once during the KimiCLI.create() startup phase:

  • MCP: Configured via kimi mcp add/remove which modifies mcp.json, requires CLI restart to take effect
  • Skills: Discovered from filesystem directories (KLIP-8 layered lookup: ~/.config/agents/skills/.agents/skills/), scanned and registered as slash commands at startup

During long-running interactive sessions, if I want to temporarily connect an MCP Server (e.g., adding Playwright MCP for debugging) or create a new Skill file and use it immediately, the only option is /reload. While /reload does preserve the session (the _reload_loop re-enters _run with the same session_id), it triggers a full KimiCLI.create() rebuild — disconnecting all existing MCP connections, tearing down the entire toolset, and re-initializing everything from scratch.

This is particularly painful in the following scenarios:

  1. Exploratory development: Realizing mid-conversation that a specific MCP tool is needed (database, browser automation, etc.) — /reload forces reconnection of all existing MCP servers just to add one new one
  2. Skill iteration: Writing/debugging a SKILL.md and wanting changes to take effect immediately — /reload restarts the entire tool/skill registration pipeline
  3. SDK/Wire integration: External UI clients needing to dynamically inject MCP configurations based on user actions during a session — Wire mode has no post-initialize tool management

Proposal

1. In-Session MCP Management Slash Commands
/mcp add <name> <command/url> [--transport stdio|http] [--env K=V]
/mcp remove <name>
/mcp list
/mcp reload [name]    # reconnect specified or all MCP Servers
2. Skill Hot-Reload
/skill reload          # re-scan skill directories, register new skills, remove deleted ones
/skill list            # list currently loaded skills
Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the KimiCLI.create startup path and _reload_loop, then trace how mcp.json, the layered skill directories, and Wire mode initialize MCP servers and skills. Compare the proposed /mcp and /skill commands with the current full /reload behavior. Done means supporting in-session MCP and skill updates without tearing down unrelated existing connections.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.